Skip to content

Commit

Permalink
chore: Bump Kubernetes 1.29.2 (#17491)
Browse files Browse the repository at this point in the history
* run: go mod tidy

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* change interface of Broadcaster

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* modify some logic due to updating controller-runtime version

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* modify some logic due to updating controller-runtime version

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* fix args of GetInformer

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* fix signature for mock

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* update mock

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* use ptr instead of pointer

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* use recommended function instead of deprecated it in wait package

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* run make codegen

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* re-run codegen

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* fix codegen tasks to pass the codegen

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* replace pointer package with ptr package

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* add option to manage subresource

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* fix len args

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* fix: error message for updating lib-version

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* use poll

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* add cache opt

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* use ptr instead of pointer

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* add status subresource

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* use latest commit

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* fix watch namespace

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* use latest gitops-engine

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* delete unnecessary polling

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* revert changes in Makefile

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* re-add openapi-gen

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* codegen w/ correct versions

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

* revert

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* extend timeout

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* break loop even if service account does not have secrets

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* fix review points

Signed-off-by: sivchari <shibuuuu5@gmail.com>

* replace gitops-engine

Signed-off-by: sivchari <shibuuuu5@gmail.com>

---------

Signed-off-by: sivchari <shibuuuu5@gmail.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
sivchari and crenshaw-dev committed May 8, 2024
1 parent 2727aec commit ef96dec
Show file tree
Hide file tree
Showing 43 changed files with 738 additions and 669 deletions.
3 changes: 1 addition & 2 deletions applicationset/controllers/applicationset_controller.go
Expand Up @@ -41,7 +41,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/source"

"github.com/argoproj/argo-cd/v2/applicationset/generators"
"github.com/argoproj/argo-cd/v2/applicationset/utils"
Expand Down Expand Up @@ -623,7 +622,7 @@ func (r *ApplicationSetReconciler) SetupWithManager(mgr ctrl.Manager, enableProg
Owns(&argov1alpha1.Application{}, builder.WithPredicates(ownsHandler)).
WithEventFilter(ignoreNotAllowedNamespaces(r.ApplicationSetNamespaces)).
Watches(
&source.Kind{Type: &corev1.Secret{}},
&corev1.Secret{},
&clusterSecretEventHandler{
Client: mgr.GetClient(),
Log: log.WithField("type", "createSecretEventHandler"),
Expand Down
21 changes: 11 additions & 10 deletions applicationset/controllers/applicationset_controller_test.go
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/client-go/tools/record"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
crtcache "sigs.k8s.io/controller-runtime/pkg/cache"
crtclient "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
Expand Down Expand Up @@ -66,7 +67,7 @@ type fakeCache struct {
cache.Cache
}

func (f *fakeCache) GetInformer(ctx context.Context, obj crtclient.Object) (cache.Informer, error) {
func (f *fakeCache) GetInformer(ctx context.Context, obj crtclient.Object, opt ...crtcache.InformerGetOption) (cache.Informer, error) {
return &fakeInformer{}, nil
}

Expand Down Expand Up @@ -2439,7 +2440,7 @@ func TestReconcilerValidationProjectErrorBehaviour(t *testing.T) {
argoDBMock := dbmocks.ArgoDB{}
argoObjs := []runtime.Object{&project}

client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appSet).WithIndex(&v1alpha1.Application{}, ".metadata.controller", appControllerIndexer).Build()
client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appSet).WithStatusSubresource(&appSet).WithIndex(&v1alpha1.Application{}, ".metadata.controller", appControllerIndexer).Build()
goodCluster := v1alpha1.Cluster{Server: "https://good-cluster", Name: "good-cluster"}
badCluster := v1alpha1.Cluster{Server: "https://bad-cluster", Name: "bad-cluster"}
argoDBMock.On("GetCluster", mock.Anything, "https://good-cluster").Return(&goodCluster, nil)
Expand Down Expand Up @@ -2535,7 +2536,7 @@ func TestReconcilerCreateAppsRecoveringRenderError(t *testing.T) {
argoDBMock := dbmocks.ArgoDB{}
argoObjs := []runtime.Object{&project}

client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appSet).WithIndex(&v1alpha1.Application{}, ".metadata.controller", appControllerIndexer).Build()
client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appSet).WithStatusSubresource(&appSet).WithIndex(&v1alpha1.Application{}, ".metadata.controller", appControllerIndexer).Build()

r := ApplicationSetReconciler{
Client: client,
Expand Down Expand Up @@ -2678,7 +2679,7 @@ func applicationsUpdateSyncPolicyTest(t *testing.T, applicationsSyncPolicy v1alp
argoDBMock := dbmocks.ArgoDB{}
argoObjs := []runtime.Object{&defaultProject}

client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appSet).WithIndex(&v1alpha1.Application{}, ".metadata.controller", appControllerIndexer).Build()
client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appSet).WithStatusSubresource(&appSet).WithIndex(&v1alpha1.Application{}, ".metadata.controller", appControllerIndexer).Build()
goodCluster := v1alpha1.Cluster{Server: "https://good-cluster", Name: "good-cluster"}
argoDBMock.On("GetCluster", mock.Anything, "https://good-cluster").Return(&goodCluster, nil)
argoDBMock.On("ListClusters", mock.Anything).Return(&v1alpha1.ClusterList{Items: []v1alpha1.Cluster{
Expand Down Expand Up @@ -2848,7 +2849,7 @@ func applicationsDeleteSyncPolicyTest(t *testing.T, applicationsSyncPolicy v1alp
argoDBMock := dbmocks.ArgoDB{}
argoObjs := []runtime.Object{&defaultProject}

client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appSet).WithIndex(&v1alpha1.Application{}, ".metadata.controller", appControllerIndexer).Build()
client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appSet).WithStatusSubresource(&appSet).WithIndex(&v1alpha1.Application{}, ".metadata.controller", appControllerIndexer).Build()
goodCluster := v1alpha1.Cluster{Server: "https://good-cluster", Name: "good-cluster"}
argoDBMock.On("GetCluster", mock.Anything, "https://good-cluster").Return(&goodCluster, nil)
argoDBMock.On("ListClusters", mock.Anything).Return(&v1alpha1.ClusterList{Items: []v1alpha1.Cluster{
Expand Down Expand Up @@ -3169,7 +3170,7 @@ func TestPolicies(t *testing.T) {
},
}

client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appSet).WithIndex(&v1alpha1.Application{}, ".metadata.controller", appControllerIndexer).Build()
client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appSet).WithStatusSubresource(&appSet).WithIndex(&v1alpha1.Application{}, ".metadata.controller", appControllerIndexer).Build()

r := ApplicationSetReconciler{
Client: client,
Expand Down Expand Up @@ -3332,7 +3333,7 @@ func TestSetApplicationSetApplicationStatus(t *testing.T) {

t.Run(cc.name, func(t *testing.T) {

client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&cc.appSet).Build()
client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&cc.appSet).WithStatusSubresource(&cc.appSet).Build()

r := ApplicationSetReconciler{
Client: client,
Expand Down Expand Up @@ -5352,7 +5353,7 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
argoDBMock := dbmocks.ArgoDB{}
argoObjs := []runtime.Object{}

client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&cc.appSet).Build()
client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&cc.appSet).WithStatusSubresource(&cc.appSet).Build()

r := ApplicationSetReconciler{
Client: client,
Expand Down Expand Up @@ -6106,7 +6107,7 @@ func TestUpdateApplicationSetApplicationStatusProgress(t *testing.T) {
argoDBMock := dbmocks.ArgoDB{}
argoObjs := []runtime.Object{}

client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&cc.appSet).Build()
client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&cc.appSet).WithStatusSubresource(&cc.appSet).Build()

r := ApplicationSetReconciler{
Client: client,
Expand Down Expand Up @@ -6324,7 +6325,7 @@ func TestUpdateResourceStatus(t *testing.T) {
argoDBMock := dbmocks.ArgoDB{}
argoObjs := []runtime.Object{}

client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&cc.appSet).Build()
client := fake.NewClientBuilder().WithScheme(scheme).WithStatusSubresource(&cc.appSet).WithObjects(&cc.appSet).Build()

r := ApplicationSetReconciler{
Client: client,
Expand Down
20 changes: 10 additions & 10 deletions applicationset/controllers/clustereventhandler.go
Expand Up @@ -24,20 +24,20 @@ type clusterSecretEventHandler struct {
Client client.Client
}

func (h *clusterSecretEventHandler) Create(e event.CreateEvent, q workqueue.RateLimitingInterface) {
h.queueRelatedAppGenerators(q, e.Object)
func (h *clusterSecretEventHandler) Create(ctx context.Context, e event.CreateEvent, q workqueue.RateLimitingInterface) {
h.queueRelatedAppGenerators(ctx, q, e.Object)
}

func (h *clusterSecretEventHandler) Update(e event.UpdateEvent, q workqueue.RateLimitingInterface) {
h.queueRelatedAppGenerators(q, e.ObjectNew)
func (h *clusterSecretEventHandler) Update(ctx context.Context, e event.UpdateEvent, q workqueue.RateLimitingInterface) {
h.queueRelatedAppGenerators(ctx, q, e.ObjectNew)
}

func (h *clusterSecretEventHandler) Delete(e event.DeleteEvent, q workqueue.RateLimitingInterface) {
h.queueRelatedAppGenerators(q, e.Object)
func (h *clusterSecretEventHandler) Delete(ctx context.Context, e event.DeleteEvent, q workqueue.RateLimitingInterface) {
h.queueRelatedAppGenerators(ctx, q, e.Object)
}

func (h *clusterSecretEventHandler) Generic(e event.GenericEvent, q workqueue.RateLimitingInterface) {
h.queueRelatedAppGenerators(q, e.Object)
func (h *clusterSecretEventHandler) Generic(ctx context.Context, e event.GenericEvent, q workqueue.RateLimitingInterface) {
h.queueRelatedAppGenerators(ctx, q, e.Object)
}

// addRateLimitingInterface defines the Add method of workqueue.RateLimitingInterface, allow us to easily mock
Expand All @@ -46,7 +46,7 @@ type addRateLimitingInterface interface {
Add(item interface{})
}

func (h *clusterSecretEventHandler) queueRelatedAppGenerators(q addRateLimitingInterface, object client.Object) {
func (h *clusterSecretEventHandler) queueRelatedAppGenerators(ctx context.Context, q addRateLimitingInterface, object client.Object) {
// Check for label, lookup all ApplicationSets that might match the cluster, queue them all
if object.GetLabels()[generators.ArgoCDSecretTypeLabel] != generators.ArgoCDSecretTypeCluster {
return
Expand All @@ -58,7 +58,7 @@ func (h *clusterSecretEventHandler) queueRelatedAppGenerators(q addRateLimitingI
}).Info("processing event for cluster secret")

appSetList := &argoprojiov1alpha1.ApplicationSetList{}
err := h.Client.List(context.Background(), appSetList)
err := h.Client.List(ctx, appSetList)
if err != nil {
h.Log.WithError(err).Error("unable to list ApplicationSets")
return
Expand Down
3 changes: 2 additions & 1 deletion applicationset/controllers/clustereventhandler_test.go
@@ -1,6 +1,7 @@
package controllers

import (
"context"
"testing"

log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -550,7 +551,7 @@ func TestClusterEventHandler(t *testing.T) {

mockAddRateLimitingInterface := mockAddRateLimitingInterface{}

handler.queueRelatedAppGenerators(&mockAddRateLimitingInterface, &test.secret)
handler.queueRelatedAppGenerators(context.Background(), &mockAddRateLimitingInterface, &test.secret)

assert.False(t, mockAddRateLimitingInterface.errorOccurred)
assert.ElementsMatch(t, mockAddRateLimitingInterface.addedItems, test.expectedRequests)
Expand Down
4 changes: 2 additions & 2 deletions applicationset/services/scm_provider/azure_devops_test.go
Expand Up @@ -8,15 +8,15 @@ import (
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

azureMock "github.com/argoproj/argo-cd/v2/applicationset/services/scm_provider/azure_devops/git/mocks"
"github.com/microsoft/azure-devops-go-api/azuredevops"
azureGit "github.com/microsoft/azure-devops-go-api/azuredevops/git"
)

func s(input string) *string {
return pointer.String(input)
return ptr.To(input)
}

func TestAzureDevopsRepoHasPath(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions applicationset/utils/clusterUtils.go
Expand Up @@ -17,7 +17,7 @@ import (
appv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"

"k8s.io/client-go/kubernetes"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)

// The contents of this file are from
Expand Down Expand Up @@ -180,7 +180,7 @@ func secretToCluster(s *corev1.Secret) (*appv1.Cluster, error) {
if val, err := strconv.Atoi(string(shardStr)); err != nil {
log.Warnf("Error while parsing shard in cluster secret '%s': %v", s.Name, err)
} else {
shard = pointer.Int64(int64(val))
shard = ptr.To(int64(val))
}
}
cluster := appv1.Cluster{
Expand Down
26 changes: 15 additions & 11 deletions assets/swagger.json
Expand Up @@ -384,7 +384,7 @@
"parameters": [
{
"type": "string",
"description": "Name must be unique within a namespace. Is required when creating resources, although\nsome resources may allow a client to request the generation of an appropriate name\nautomatically. Name is primarily intended for creation idempotence and configuration\ndefinition.\nCannot be updated.\nMore info: http://kubernetes.io/docs/user-guide/identifiers#names\n+optional",
"description": "Name must be unique within a namespace. Is required when creating resources, although\nsome resources may allow a client to request the generation of an appropriate name\nautomatically. Name is primarily intended for creation idempotence and configuration\ndefinition.\nCannot be updated.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names\n+optional",
"name": "application.metadata.name",
"in": "path",
"required": true
Expand Down Expand Up @@ -2968,7 +2968,7 @@
"parameters": [
{
"type": "string",
"description": "Name must be unique within a namespace. Is required when creating resources, although\nsome resources may allow a client to request the generation of an appropriate name\nautomatically. Name is primarily intended for creation idempotence and configuration\ndefinition.\nCannot be updated.\nMore info: http://kubernetes.io/docs/user-guide/identifiers#names\n+optional",
"description": "Name must be unique within a namespace. Is required when creating resources, although\nsome resources may allow a client to request the generation of an appropriate name\nautomatically. Name is primarily intended for creation idempotence and configuration\ndefinition.\nCannot be updated.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names\n+optional",
"name": "project.metadata.name",
"in": "path",
"required": true
Expand Down Expand Up @@ -5403,8 +5403,8 @@
"type": "object",
"properties": {
"key": {
"type": "string",
"title": "key is the label key that the selector applies to.\n+patchMergeKey=key\n+patchStrategy=merge"
"description": "key is the label key that the selector applies to.",
"type": "string"
},
"operator": {
"description": "operator represents a key's relationship to a set of values.\nValid operators are In, NotIn, Exists and DoesNotExist.",
Expand Down Expand Up @@ -5454,6 +5454,10 @@
"type": "string",
"title": "IP is set for load-balancer ingress points that are IP based\n(typically GCE or OpenStack load-balancers)\n+optional"
},
"ipMode": {
"type": "string",
"title": "IPMode specifies how the load-balancer IP behaves, and may only be specified when the ip field is specified.\nSetting this to \"VIP\" indicates that traffic is delivered to the node with\nthe destination set to the load-balancer's IP and port.\nSetting this to \"Proxy\" indicates that traffic is delivered to the node or pod with\nthe destination set to the node's IP and node port or the pod's IP and port.\nService implementations may use this information to adjust traffic routing.\n+optional"
},
"ports": {
"type": "array",
"title": "Ports is a list of records of service ports\nIf used, every port defined in the service should have an entry in it\n+listType=atomic\n+optional",
Expand Down Expand Up @@ -5563,7 +5567,7 @@
"properties": {
"annotations": {
"type": "object",
"title": "Annotations is an unstructured key value map stored with a resource that may be\nset by external tools to store and retrieve arbitrary metadata. They are not\nqueryable and should be preserved when modifying objects.\nMore info: http://kubernetes.io/docs/user-guide/annotations\n+optional",
"title": "Annotations is an unstructured key value map stored with a resource that may be\nset by external tools to store and retrieve arbitrary metadata. They are not\nqueryable and should be preserved when modifying objects.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations\n+optional",
"additionalProperties": {
"type": "string"
}
Expand Down Expand Up @@ -5597,7 +5601,7 @@
},
"labels": {
"type": "object",
"title": "Map of string keys and values that can be used to organize and categorize\n(scope and select) objects. May match selectors of replication controllers\nand services.\nMore info: http://kubernetes.io/docs/user-guide/labels\n+optional",
"title": "Map of string keys and values that can be used to organize and categorize\n(scope and select) objects. May match selectors of replication controllers\nand services.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels\n+optional",
"additionalProperties": {
"type": "string"
}
Expand All @@ -5611,10 +5615,10 @@
},
"name": {
"type": "string",
"title": "Name must be unique within a namespace. Is required when creating resources, although\nsome resources may allow a client to request the generation of an appropriate name\nautomatically. Name is primarily intended for creation idempotence and configuration\ndefinition.\nCannot be updated.\nMore info: http://kubernetes.io/docs/user-guide/identifiers#names\n+optional"
"title": "Name must be unique within a namespace. Is required when creating resources, although\nsome resources may allow a client to request the generation of an appropriate name\nautomatically. Name is primarily intended for creation idempotence and configuration\ndefinition.\nCannot be updated.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names\n+optional"
},
"namespace": {
"description": "Namespace defines the space within which each name must be unique. An empty namespace is\nequivalent to the \"default\" namespace, but \"default\" is the canonical representation.\nNot all objects are required to be scoped to a namespace - the value of this field for\nthose objects will be empty.\n\nMust be a DNS_LABEL.\nCannot be updated.\nMore info: http://kubernetes.io/docs/user-guide/namespaces\n+optional",
"description": "Namespace defines the space within which each name must be unique. An empty namespace is\nequivalent to the \"default\" namespace, but \"default\" is the canonical representation.\nNot all objects are required to be scoped to a namespace - the value of this field for\nthose objects will be empty.\n\nMust be a DNS_LABEL.\nCannot be updated.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces\n+optional",
"type": "string"
},
"ownerReferences": {
Expand All @@ -5633,7 +5637,7 @@
"title": "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.\n+optional"
},
"uid": {
"description": "UID is the unique in time and space value for this object. It is typically generated by\nthe server on successful creation of a resource and is not allowed to change on PUT\noperations.\n\nPopulated by the system.\nRead-only.\nMore info: http://kubernetes.io/docs/user-guide/identifiers#uids\n+optional",
"description": "UID is the unique in time and space value for this object. It is typically generated by\nthe server on successful creation of a resource and is not allowed to change on PUT\noperations.\n\nPopulated by the system.\nRead-only.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids\n+optional",
"type": "string"
}
}
Expand Down Expand Up @@ -5694,11 +5698,11 @@
},
"name": {
"type": "string",
"title": "Name of the referent.\nMore info: http://kubernetes.io/docs/user-guide/identifiers#names"
"title": "Name of the referent.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names"
},
"uid": {
"type": "string",
"title": "UID of the referent.\nMore info: http://kubernetes.io/docs/user-guide/identifiers#uids"
"title": "UID of the referent.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids"
}
}
},
Expand Down

0 comments on commit ef96dec

Please sign in to comment.