diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index cb48381..13d1c55 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -18,7 +18,7 @@ jobs: - name: Set up Go uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 with: - go-version: 1.25.5 + go-version: 1.25.6 - name: Build run: make build - name: FMT @@ -37,7 +37,7 @@ jobs: - name: Set up Go uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 with: - go-version: 1.25.5 + go-version: 1.25.6 - name: ut run: make test env: @@ -50,7 +50,7 @@ jobs: - name: Set up Go uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 with: - go-version: 1.25.5 + go-version: 1.25.6 - name: fv run: make create-cluster fv env: @@ -63,7 +63,7 @@ jobs: - name: Set up Go uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 with: - go-version: 1.25.5 + go-version: 1.25.6 - name: fv-sharding run: make create-cluster fv-sharding env: @@ -76,7 +76,7 @@ jobs: - name: Set up Go uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 with: - go-version: 1.25.5 + go-version: 1.25.6 - name: fv-agentless run: make create-cluster fv-agentless env: @@ -89,7 +89,7 @@ jobs: - name: Set up Go uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 with: - go-version: 1.25.5 + go-version: 1.25.6 - name: fv-pullmode run: make create-cluster-pullmode fv-pullmode env: diff --git a/Dockerfile b/Dockerfile index b9e477a..38d603e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.25.5 AS builder +FROM golang:1.25.6 AS builder ARG BUILDOS ARG TARGETARCH diff --git a/README.md b/README.md index ef4b34c..829fc99 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Classifier currently supports the following classification criteria: 1. Kubernetes version 2. Kubernetes resources -For instance, this Classifier instance will match any cluster whose Kubernetes version is greater than or equal to "v1.24.0" and strictly less than "v1.25.5" +For instance, this Classifier instance will match any cluster whose Kubernetes version is greater than or equal to "v1.24.0" and strictly less than "v1.25.6" ``` apiVersion: lib.projectsveltos.io/v1beta1 @@ -31,7 +31,7 @@ spec: - comparison: GreaterThanOrEqualTo version: 1.24.0 - comparison: LessThan - version: 1.25.5 + version: 1.25.6 ``` When a cluster is a match for a Classifier instances, all classifierLabels will be automatically added to the Cluster instance. @@ -45,8 +45,8 @@ Refer to [examples](./examples/) for more complex examples. ## A simple use case: upgrade helm charts automatically when Kubernetes cluster is upgraded Suppose you are managing several Kubernetes clusters with different versions. And you want to deploy: -1. OPA Gatekeeper version 3.10.0 in any Kubernetes cluster whose version is >= v1.25.5 -2. OPA Gatekeeper version 3.9.0 in any Kubernetes cluster whose version is >= v1.24.0 && < v1.25.5 +1. OPA Gatekeeper version 3.10.0 in any Kubernetes cluster whose version is >= v1.25.6 +2. OPA Gatekeeper version 3.9.0 in any Kubernetes cluster whose version is >= v1.24.0 && < v1.25.6 You can create following ClusterProfiles and Classifiers in the management cluster: ``` @@ -102,7 +102,7 @@ spec: value: v3-10 kubernetesVersionConstraints: - comparison: GreaterThanOrEqualTo - version: 1.25.5 + version: 1.25.6 ``` ``` @@ -118,7 +118,7 @@ spec: - comparison: GreaterThanOrEqualTo version: 1.24.0 - comparison: LessThan - version: 1.25.5 + version: 1.25.6 ``` With the above configuration: diff --git a/controllers/classifier_controller.go b/controllers/classifier_controller.go index bb336bf..762164e 100644 --- a/controllers/classifier_controller.go +++ b/controllers/classifier_controller.go @@ -116,6 +116,8 @@ type ClassifierReconciler struct { // List of current existing Classifiers AllClassifierSet libsveltosset.Set + + Logger logr.Logger } //+kubebuilder:rbac:groups=lib.projectsveltos.io,resources=classifiers,verbs=get;list;watch;create;update;patch;delete @@ -480,7 +482,7 @@ func (r *ClassifierReconciler) getMatchingClusters(ctx context.Context, for i := range classifierReportList.Items { report := &classifierReportList.Items[i] - // Only consider reports with ClusterNamespace set (type #2 in your logic) + // Only consider reports with ClusterNamespace set if report.Spec.ClusterNamespace == "" { continue } @@ -591,7 +593,6 @@ func (r *ClassifierReconciler) updateLabelsOnMatchingClusters(ctx context.Contex } clusterLogger := logger.WithValues("cluster", fmt.Sprintf("%s/%s", cluster.GetNamespace(), cluster.GetName())) - // Attempt to update labels on the physical cluster if err := r.updateLabelsOnCluster(ctx, classifierScope, cluster, clusterproxy.GetClusterType(ref), clusterLogger); err != nil { if !apierrors.IsNotFound(err) { diff --git a/controllers/classifier_controller_test.go b/controllers/classifier_controller_test.go index 95653be..ce988aa 100644 --- a/controllers/classifier_controller_test.go +++ b/controllers/classifier_controller_test.go @@ -67,6 +67,7 @@ var _ = Describe("Classifier: Reconciler", func() { ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), ClassifierMap: make(map[corev1.ObjectReference]*libsveltosset.Set), Mux: sync.Mutex{}, + Logger: logger, } classifierName := client.ObjectKey{ @@ -144,6 +145,7 @@ var _ = Describe("Classifier: Reconciler", func() { ClassifierMap: make(map[corev1.ObjectReference]*libsveltosset.Set), Mux: sync.Mutex{}, Deployer: dep, + Logger: logger, } // Because Classifier is currently deployed in a Cluster (Status.ClusterInfo is set @@ -207,6 +209,7 @@ var _ = Describe("Classifier: Reconciler", func() { ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), ClassifierMap: make(map[corev1.ObjectReference]*libsveltosset.Set), Mux: sync.Mutex{}, + Logger: logger, } classifierScope, err := scope.NewClassifierScope(scope.ClassifierScopeParams{ @@ -275,6 +278,7 @@ var _ = Describe("Classifier: Reconciler", func() { ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), ClassifierMap: make(map[corev1.ObjectReference]*libsveltosset.Set), Mux: sync.Mutex{}, + Logger: logger, } classifierScope, err := scope.NewClassifierScope(scope.ClassifierScopeParams{ @@ -340,6 +344,7 @@ var _ = Describe("Classifier: Reconciler", func() { ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), ClassifierMap: make(map[corev1.ObjectReference]*libsveltosset.Set), Mux: sync.Mutex{}, + Logger: logger, } classifierScope, err := scope.NewClassifierScope(scope.ClassifierScopeParams{ @@ -416,6 +421,7 @@ var _ = Describe("Classifier: Reconciler", func() { ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), ClassifierMap: make(map[corev1.ObjectReference]*libsveltosset.Set), Mux: sync.Mutex{}, + Logger: logger, } classifierScope, err := scope.NewClassifierScope(scope.ClassifierScopeParams{ @@ -483,6 +489,7 @@ var _ = Describe("Classifier: Reconciler", func() { ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), ClassifierMap: make(map[corev1.ObjectReference]*libsveltosset.Set), Mux: sync.Mutex{}, + Logger: logger, } oldMatches := map[corev1.ObjectReference]bool{clusterRef: true} @@ -553,6 +560,7 @@ var _ = Describe("Classifier: Reconciler", func() { ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), ClassifierMap: make(map[corev1.ObjectReference]*libsveltosset.Set), Mux: sync.Mutex{}, + Logger: logger, } clusterRef := &corev1.ObjectReference{ diff --git a/controllers/classifier_deployer.go b/controllers/classifier_deployer.go index b65a643..d462cff 100644 --- a/controllers/classifier_deployer.go +++ b/controllers/classifier_deployer.go @@ -1391,6 +1391,12 @@ func deployClassifierInstance(ctx context.Context, remoteClient client.Client, logger.V(logs.LogDebug).Info("deploy classifier instance") if !isPullMode { + if getAgentInMgmtCluster() { + // If sveltos-agent is deployed in the management cluster, Classifier instance + // does not need to be deployed in the managed cluster. So return here + return nil + } + currentClassifier := &libsveltosv1beta1.Classifier{} err := remoteClient.Get(ctx, types.NamespacedName{Name: classifier.Name}, currentClassifier) if err != nil { diff --git a/controllers/classifier_predicates.go b/controllers/classifier_predicates.go index b32377f..3fdc9fc 100644 --- a/controllers/classifier_predicates.go +++ b/controllers/classifier_predicates.go @@ -256,6 +256,14 @@ func ClassifierReportPredicate(logger logr.Logger) predicate.Funcs { return true } + // return true if ClassifierReport.Spec.ClusterNamespace has changed + // This happens in agentless mode as sveltos + if oldReport.Spec.ClusterNamespace != newReport.Spec.ClusterNamespace { + log.V(logs.LogVerbose).Info( + "ClassifierReport Spec.ClusterNamespace changed. Will attempt to reconcile associated Classifiers.") + return true + } + // otherwise, return false log.V(logs.LogVerbose).Info( "ClassifierReport did not match expected conditions. Will not attempt to reconcile associated Classifiers.") diff --git a/controllers/classifier_transformations.go b/controllers/classifier_transformations.go index 9e6731f..a90e583 100644 --- a/controllers/classifier_transformations.go +++ b/controllers/classifier_transformations.go @@ -161,7 +161,7 @@ func (r *ClassifierReconciler) requeueClassifierForClassifierReport( ) []reconcile.Request { report := o.(*libsveltosv1beta1.ClassifierReport) - logger := textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1))).WithValues( + logger := r.Logger.WithValues( "objectMapper", "requeueClassifierForClassifierReport", "namespace", diff --git a/controllers/classifier_transformations_test.go b/controllers/classifier_transformations_test.go index 0c50d85..f6b7e45 100644 --- a/controllers/classifier_transformations_test.go +++ b/controllers/classifier_transformations_test.go @@ -26,6 +26,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/klog/v2/textlogger" clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" @@ -90,11 +91,13 @@ var _ = Describe("ClassifierTransformations map functions", func() { c := fake.NewClientBuilder().WithScheme(scheme).WithStatusSubresource(initObjects...). WithObjects(initObjects...).Build() + logger := textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1))) reconciler := &controllers.ClassifierReconciler{ Client: c, Scheme: scheme, Mux: sync.Mutex{}, ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), + Logger: logger, } set := libsveltosset.Set{} @@ -143,11 +146,13 @@ var _ = Describe("ClassifierTransformations map functions", func() { c := fake.NewClientBuilder().WithScheme(scheme).WithStatusSubresource(initObjects...). WithObjects(initObjects...).Build() + logger := textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1))) reconciler := &controllers.ClassifierReconciler{ Client: c, Scheme: scheme, Mux: sync.Mutex{}, ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), + Logger: logger, } requests := controllers.RequeueClassifierForClassifierReport(reconciler, context.TODO(), report) diff --git a/controllers/controllers_suite_test.go b/controllers/controllers_suite_test.go index ce6630f..6099aef 100644 --- a/controllers/controllers_suite_test.go +++ b/controllers/controllers_suite_test.go @@ -35,6 +35,7 @@ import ( "k8s.io/apimachinery/pkg/util/wait" clientgoscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/klog/v2" + "k8s.io/klog/v2/textlogger" clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/util" ctrl "sigs.k8s.io/controller-runtime" @@ -184,7 +185,7 @@ func getClassifierReport(classifierName, clusterNamespace, clusterName string) * } func getClassifierInstance(name string) *libsveltosv1beta1.Classifier { - classifierLabels := []libsveltosv1beta1.ClassifierLabel{{Key: "version", Value: "v1.25.5"}} + classifierLabels := []libsveltosv1beta1.ClassifierLabel{{Key: "version", Value: "v1.25.6"}} return &libsveltosv1beta1.Classifier{ ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -192,7 +193,7 @@ func getClassifierInstance(name string) *libsveltosv1beta1.Classifier { Spec: libsveltosv1beta1.ClassifierSpec{ KubernetesVersionConstraints: []libsveltosv1beta1.KubernetesVersionConstraint{ { - Version: "1.25.5", + Version: "1.25.6", Comparison: string(libsveltosv1beta1.ComparisonEqual), }, }, @@ -202,6 +203,7 @@ func getClassifierInstance(name string) *libsveltosv1beta1.Classifier { } func getClassifierReconciler(c client.Client, dep deployer.DeployerInterface) *controllers.ClassifierReconciler { + logger := textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1))) return &controllers.ClassifierReconciler{ Client: c, Scheme: scheme, @@ -209,6 +211,7 @@ func getClassifierReconciler(c client.Client, dep deployer.DeployerInterface) *c ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), ClassifierMap: make(map[corev1.ObjectReference]*libsveltosset.Set), Mux: sync.Mutex{}, + Logger: logger, } } diff --git a/examples/kubernetes_version.yaml b/examples/kubernetes_version.yaml index 417c0b6..1bf6156 100644 --- a/examples/kubernetes_version.yaml +++ b/examples/kubernetes_version.yaml @@ -1,5 +1,5 @@ # Following Classifier will match any Cluster whose -# Kubernetes version is >= v1.24.0 and < v1.25.5 +# Kubernetes version is >= v1.24.0 and < v1.25.6 apiVersion: lib.projectsveltos.io/v1beta1 kind: Classifier metadata: @@ -12,4 +12,4 @@ spec: - comparison: GreaterThanOrEqualTo version: 1.24.0 - comparison: LessThan - version: 1.25.5 \ No newline at end of file + version: 1.25.6 \ No newline at end of file diff --git a/examples/multiple_constraints.yaml b/examples/multiple_constraints.yaml index 7dbf4e4..3952e1c 100644 --- a/examples/multiple_constraints.yaml +++ b/examples/multiple_constraints.yaml @@ -1,5 +1,5 @@ # Following Classifier will match any Cluster whose -# Kubernetes version is >= v1.24.0 and < v1.25.5 +# Kubernetes version is >= v1.24.0 and < v1.25.6 apiVersion: lib.projectsveltos.io/v1beta1 kind: Classifier metadata: @@ -10,7 +10,7 @@ spec: value: multiple kubernetesVersionConstraints: - comparison: GreaterThanOrEqualTo - version: 1.25.5 + version: 1.25.6 deployedResourceConstraint: - group: "" version: v1 diff --git a/go.mod b/go.mod index d491f29..bb008be 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,15 @@ module github.com/projectsveltos/classifier -go 1.25.5 +go 1.25.6 require ( github.com/TwiN/go-color v1.4.1 github.com/gdexlab/go-render v1.0.1 github.com/go-logr/logr v1.4.3 - github.com/onsi/ginkgo/v2 v2.27.5 - github.com/onsi/gomega v1.39.0 + github.com/onsi/ginkgo/v2 v2.28.1 + github.com/onsi/gomega v1.39.1 github.com/pkg/errors v0.9.1 - github.com/projectsveltos/libsveltos v1.4.1-0.20260117075726-0c63966fba23 + github.com/projectsveltos/libsveltos v1.4.1-0.20260131124754-dd6ff263bbb9 github.com/prometheus/client_golang v1.23.2 github.com/spf13/pflag v1.0.10 golang.org/x/text v0.33.0 @@ -20,8 +20,8 @@ require ( k8s.io/component-base v0.35.0 k8s.io/klog/v2 v2.130.1 k8s.io/utils v0.0.0-20260108192941-914a6e750570 - sigs.k8s.io/cluster-api v1.12.1 - sigs.k8s.io/controller-runtime v0.22.4 + sigs.k8s.io/cluster-api v1.12.2 + sigs.k8s.io/controller-runtime v0.23.1 sigs.k8s.io/yaml v1.6.0 ) @@ -47,10 +47,10 @@ require ( github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gobuffalo/flect v1.0.3 // indirect github.com/google/btree v1.1.3 // indirect - github.com/google/cel-go v0.26.1 // indirect + github.com/google/cel-go v0.27.0 // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect + github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect @@ -67,7 +67,6 @@ require ( github.com/prometheus/common v0.66.1 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/spf13/cobra v1.10.1 // indirect - github.com/stoewer/go-strcase v1.3.0 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/xlab/treeprint v1.2.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect @@ -82,14 +81,14 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/mod v0.31.0 // indirect - golang.org/x/net v0.48.0 // indirect + golang.org/x/mod v0.32.0 // indirect + golang.org/x/net v0.49.0 // indirect golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.19.0 // indirect - golang.org/x/sys v0.39.0 // indirect - golang.org/x/term v0.38.0 // indirect + golang.org/x/sys v0.40.0 // indirect + golang.org/x/term v0.39.0 // indirect golang.org/x/time v0.9.0 // indirect - golang.org/x/tools v0.40.0 // indirect + golang.org/x/tools v0.41.0 // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect @@ -106,5 +105,5 @@ require ( sigs.k8s.io/kustomize/api v0.21.0 // indirect sigs.k8s.io/kustomize/kyaml v0.21.0 // indirect sigs.k8s.io/randfill v1.0.0 // indirect - sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482 // indirect ) diff --git a/go.sum b/go.sum index bd4edab..14204d5 100644 --- a/go.sum +++ b/go.sum @@ -78,8 +78,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ= -github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= +github.com/google/cel-go v0.27.0 h1:e7ih85+4qVrBuqQWTW4FKSqZYokVuc3HnhH5keboFTo= +github.com/google/cel-go v0.27.0/go.mod h1:tTJ11FWqnhw5KKpnWpvW9CJC3Y9GK4EIS0WXnBbebzw= github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= @@ -87,8 +87,8 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 h1:EEHtgt9IwisQ2AZ4pIsMjahcegHh6rmhqxzIRQIyepY= -github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U= +github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 h1:z2ogiKUYzX5Is6zr/vP9vJGqPwcdqsWjOt+V8J7+bTc= +github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo= @@ -133,18 +133,18 @@ github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/ github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.27.5 h1:ZeVgZMx2PDMdJm/+w5fE/OyG6ILo1Y3e+QX4zSR0zTE= -github.com/onsi/ginkgo/v2 v2.27.5/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= -github.com/onsi/gomega v1.39.0 h1:y2ROC3hKFmQZJNFeGAMeHZKkjBL65mIZcvrLQBF9k6Q= -github.com/onsi/gomega v1.39.0/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4= +github.com/onsi/ginkgo/v2 v2.28.1 h1:S4hj+HbZp40fNKuLUQOYLDgZLwNUVn19N3Atb98NCyI= +github.com/onsi/ginkgo/v2 v2.28.1/go.mod h1:CLtbVInNckU3/+gC8LzkGUb9oF+e8W8TdUsxPwvdOgE= +github.com/onsi/gomega v1.39.1 h1:1IJLAad4zjPn2PsnhH70V4DKRFlrCzGBNrNaru+Vf28= +github.com/onsi/gomega v1.39.1/go.mod h1:hL6yVALoTOxeWudERyfppUcZXjMwIMLnuSfruD2lcfg= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/projectsveltos/libsveltos v1.4.1-0.20260117075726-0c63966fba23 h1:8hlYPnuCbcd/iwdbZGHx3wSJGqr4dUD8FHlb3SUlkHU= -github.com/projectsveltos/libsveltos v1.4.1-0.20260117075726-0c63966fba23/go.mod h1:M3ljA5j0FMQ9V0dGE3OvqhzfUEgzcU4JDGj/VTQMfZg= +github.com/projectsveltos/libsveltos v1.4.1-0.20260131124754-dd6ff263bbb9 h1:5ldqgGt5IAg/HNZlzom6/WCugQfUIRheCdxjwmpq6ds= +github.com/projectsveltos/libsveltos v1.4.1-0.20260131124754-dd6ff263bbb9/go.mod h1:Zr20iLkXujukoB9x1zjmYVULonScKUu1d7XIMU3Z5tU= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= @@ -167,8 +167,6 @@ github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4 github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= -github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -223,28 +221,28 @@ go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= -golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= +golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8= +golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= -golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI= -golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg= -golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= -golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= +golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= +golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= +golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= -golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q= -golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= +golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= +golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/term v0.39.0 h1:RclSuaJf32jOqZz74CkPA9qFuVTX7vhLlpfj/IGWlqY= +golang.org/x/term v0.39.0/go.mod h1:yxzUCTP/U+FzoxfdKmLaA0RV1WgE0VY7hXBwKtY/4ww= golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA= -golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc= +golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= +golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= gomodules.xyz/jsonpatch/v2 v2.5.0 h1:JELs8RLM12qJGXU4u/TO3V25KW8GreMKl9pdkk14RM0= gomodules.xyz/jsonpatch/v2 v2.5.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950= @@ -287,10 +285,10 @@ k8s.io/utils v0.0.0-20260108192941-914a6e750570 h1:JT4W8lsdrGENg9W+YwwdLJxklIuKW k8s.io/utils v0.0.0-20260108192941-914a6e750570/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= -sigs.k8s.io/cluster-api v1.12.1 h1:s3DivSZjXdu2HPyOtV/n6XwSZBaIycZdKNs4y8X+3lY= -sigs.k8s.io/cluster-api v1.12.1/go.mod h1:+S6WJdi8UPdqv5q9nka5al3ed/Qa0zAcSBgzTaa9VKA= -sigs.k8s.io/controller-runtime v0.22.4 h1:GEjV7KV3TY8e+tJ2LCTxUTanW4z/FmNB7l327UfMq9A= -sigs.k8s.io/controller-runtime v0.22.4/go.mod h1:+QX1XUpTXN4mLoblf4tqr5CQcyHPAki2HLXqQMY6vh8= +sigs.k8s.io/cluster-api v1.12.2 h1:+b+M2IygfvFZJq7bsaloNakimMEVNf81zkGR1IiuxXs= +sigs.k8s.io/cluster-api v1.12.2/go.mod h1:2XuF/dmN3c/1VITb6DB44N5+Ecvsvd5KOWqrY9Q53nU= +sigs.k8s.io/controller-runtime v0.23.1 h1:TjJSM80Nf43Mg21+RCy3J70aj/W6KyvDtOlpKf+PupE= +sigs.k8s.io/controller-runtime v0.23.1/go.mod h1:B6COOxKptp+YaUT5q4l6LqUJTRpizbgf9KSRNdQGns0= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/kustomize/api v0.21.0 h1:I7nry5p8iDJbuRdYS7ez8MUvw7XVNPcIP5GkzzuXIIQ= @@ -299,7 +297,7 @@ sigs.k8s.io/kustomize/kyaml v0.21.0 h1:7mQAf3dUwf0wBerWJd8rXhVcnkk5Tvn/q91cGkaP6 sigs.k8s.io/kustomize/kyaml v0.21.0/go.mod h1:hmxADesM3yUN2vbA5z1/YTBnzLJ1dajdqpQonwBL1FQ= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482 h1:2WOzJpHUBVrrkDjU4KBT8n5LDcj824eX0I5UKcgeRUs= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/hack/tools/go.mod b/hack/tools/go.mod index 1b6d5f5..15fd640 100644 --- a/hack/tools/go.mod +++ b/hack/tools/go.mod @@ -1,10 +1,10 @@ module github.com/projectsveltos/classifier/hack/tools -go 1.25.5 +go 1.25.6 require ( github.com/a8m/envsubst v1.4.3 - github.com/onsi/ginkgo/v2 v2.27.5 + github.com/onsi/ginkgo/v2 v2.28.1 golang.org/x/oauth2 v0.34.0 golang.org/x/tools v0.41.0 k8s.io/client-go v0.35.0 @@ -28,7 +28,7 @@ require ( github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gobuffalo/flect v1.0.3 // indirect github.com/google/gnostic-models v0.7.0 // indirect - github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect + github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect diff --git a/hack/tools/go.sum b/hack/tools/go.sum index db6215f..7ed0b14 100644 --- a/hack/tools/go.sum +++ b/hack/tools/go.sum @@ -69,8 +69,8 @@ github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7O github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8= -github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= +github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 h1:z2ogiKUYzX5Is6zr/vP9vJGqPwcdqsWjOt+V8J7+bTc= +github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -115,10 +115,10 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.27.5 h1:ZeVgZMx2PDMdJm/+w5fE/OyG6ILo1Y3e+QX4zSR0zTE= -github.com/onsi/ginkgo/v2 v2.27.5/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= -github.com/onsi/gomega v1.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM= -github.com/onsi/gomega v1.38.3/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4= +github.com/onsi/ginkgo/v2 v2.28.1 h1:S4hj+HbZp40fNKuLUQOYLDgZLwNUVn19N3Atb98NCyI= +github.com/onsi/ginkgo/v2 v2.28.1/go.mod h1:CLtbVInNckU3/+gC8LzkGUb9oF+e8W8TdUsxPwvdOgE= +github.com/onsi/gomega v1.39.0 h1:y2ROC3hKFmQZJNFeGAMeHZKkjBL65mIZcvrLQBF9k6Q= +github.com/onsi/gomega v1.39.0/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/main.go b/main.go index 1392a1c..660bd6f 100644 --- a/main.go +++ b/main.go @@ -345,6 +345,7 @@ func getClassifierReconciler(mgr manager.Manager) *controllers.ClassifierReconci ClassifierReportMode: reportMode, ControlPlaneEndpoint: managementClusterControlPlaneEndpoint, Mux: sync.Mutex{}, + Logger: ctrl.Log.WithName("classifierreconiler"), } } diff --git a/pkg/agent/sveltos-agent-in-mgmt-cluster.go b/pkg/agent/sveltos-agent-in-mgmt-cluster.go index 40ebfb2..6e78809 100644 --- a/pkg/agent/sveltos-agent-in-mgmt-cluster.go +++ b/pkg/agent/sveltos-agent-in-mgmt-cluster.go @@ -56,7 +56,7 @@ spec: valueFrom: resourceFieldRef: resource: limits.cpu - image: docker.io/projectsveltos/sveltos-agent@sha256:79acceb672f25d21f2f998240c71f6881450b94adec51b4e81c2d1adc82087c7 + image: docker.io/projectsveltos/sveltos-agent@sha256:223cbaddaf09396e8f0330060be805ca9639c75418ea798519717c76f8789731 livenessProbe: failureThreshold: 3 httpGet: diff --git a/pkg/agent/sveltos-agent-in-mgmt-cluster.yaml b/pkg/agent/sveltos-agent-in-mgmt-cluster.yaml index 521ce16..a118f7f 100644 --- a/pkg/agent/sveltos-agent-in-mgmt-cluster.yaml +++ b/pkg/agent/sveltos-agent-in-mgmt-cluster.yaml @@ -38,7 +38,7 @@ spec: valueFrom: resourceFieldRef: resource: limits.cpu - image: docker.io/projectsveltos/sveltos-agent@sha256:79acceb672f25d21f2f998240c71f6881450b94adec51b4e81c2d1adc82087c7 + image: docker.io/projectsveltos/sveltos-agent@sha256:223cbaddaf09396e8f0330060be805ca9639c75418ea798519717c76f8789731 livenessProbe: failureThreshold: 3 httpGet: diff --git a/pkg/agent/sveltos-agent.go b/pkg/agent/sveltos-agent.go index e548ec5..c44de19 100644 --- a/pkg/agent/sveltos-agent.go +++ b/pkg/agent/sveltos-agent.go @@ -42,14 +42,6 @@ rules: - list - update - watch -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch - - update - apiGroups: - '*' resources: @@ -79,6 +71,14 @@ rules: - subjectaccessreviews verbs: - create +- apiGroups: + - events.k8s.io + resources: + - events + verbs: + - create + - patch + - update - apiGroups: - lib.projectsveltos.io resources: @@ -215,7 +215,7 @@ spec: valueFrom: resourceFieldRef: resource: limits.cpu - image: docker.io/projectsveltos/sveltos-agent@sha256:79acceb672f25d21f2f998240c71f6881450b94adec51b4e81c2d1adc82087c7 + image: docker.io/projectsveltos/sveltos-agent@sha256:223cbaddaf09396e8f0330060be805ca9639c75418ea798519717c76f8789731 livenessProbe: failureThreshold: 3 httpGet: diff --git a/pkg/agent/sveltos-agent.yaml b/pkg/agent/sveltos-agent.yaml index 5d3b7ea..34a7805 100644 --- a/pkg/agent/sveltos-agent.yaml +++ b/pkg/agent/sveltos-agent.yaml @@ -24,14 +24,6 @@ rules: - list - update - watch -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch - - update - apiGroups: - '*' resources: @@ -61,6 +53,14 @@ rules: - subjectaccessreviews verbs: - create +- apiGroups: + - events.k8s.io + resources: + - events + verbs: + - create + - patch + - update - apiGroups: - lib.projectsveltos.io resources: @@ -197,7 +197,7 @@ spec: valueFrom: resourceFieldRef: resource: limits.cpu - image: docker.io/projectsveltos/sveltos-agent@sha256:79acceb672f25d21f2f998240c71f6881450b94adec51b4e81c2d1adc82087c7 + image: docker.io/projectsveltos/sveltos-agent@sha256:223cbaddaf09396e8f0330060be805ca9639c75418ea798519717c76f8789731 livenessProbe: failureThreshold: 3 httpGet: diff --git a/test/fv/conflict_test.go b/test/fv/conflict_test.go index bc17d79..59d7419 100644 --- a/test/fv/conflict_test.go +++ b/test/fv/conflict_test.go @@ -45,6 +45,8 @@ var _ = Describe("Classifier: update cluster labels", func() { Byf("Creating classifier instance %s in the management cluster", classifier1.Name) Expect(k8sClient.Create(context.TODO(), classifier1)).To(Succeed()) + verifyClassfierIsProvisioned(classifier1) + Byf("Getting client to access the workload cluster") workloadClient, err := getKindWorkloadClusterKubeconfig() Expect(err).To(BeNil()) @@ -83,6 +85,8 @@ var _ = Describe("Classifier: update cluster labels", func() { }, timeout, pollingInterval).Should(BeNil()) } + verifyClassfierIsProvisioned(classifier2) + verifyClassifierReport(classifier2.Name, true) verifyClusterLabels(classifier1) diff --git a/test/fv/labels_test.go b/test/fv/labels_test.go index 35af303..53be85f 100644 --- a/test/fv/labels_test.go +++ b/test/fv/labels_test.go @@ -46,6 +46,12 @@ func verifyFlow(namePrefix string) { Byf("Creating classifier instance %s in the management cluster", classifier.Name) Expect(k8sClient.Create(context.TODO(), classifier)).To(Succeed()) + verifyClassfierIsProvisioned(classifier) + + currentClassifier := &libsveltosv1beta1.Classifier{} + Expect(k8sClient.Get(context.TODO(), types.NamespacedName{Name: classifier.Name}, + currentClassifier)).To(Succeed()) + Byf("Getting client to access the workload cluster") workloadClient, err := getKindWorkloadClusterKubeconfig() Expect(err).To(BeNil()) @@ -68,7 +74,7 @@ func verifyFlow(namePrefix string) { } verifyClassifierReport(classifier.Name, true) - verifyClusterLabels(classifier) + verifyClusterLabels(currentClassifier) Byf("Changing classifier so cluster is not a match anymore") currentClassifer := &libsveltosv1beta1.Classifier{} @@ -94,7 +100,6 @@ func verifyFlow(namePrefix string) { verifyClusterLabels(classifier) Byf("Deleting classifier instance %s in the management cluster", classifier.Name) - currentClassifier := &libsveltosv1beta1.Classifier{} Expect(k8sClient.Get(context.TODO(), types.NamespacedName{Name: classifier.Name}, currentClassifier)).To(Succeed()) Expect(k8sClient.Delete(context.TODO(), currentClassifier)).To(Succeed()) diff --git a/test/fv/report_match_change_test.go b/test/fv/report_match_change_test.go index 0102ffb..2593607 100644 --- a/test/fv/report_match_change_test.go +++ b/test/fv/report_match_change_test.go @@ -31,7 +31,7 @@ import ( var _ = Describe("Classifier: update cluster labels", func() { const ( - namePrefix = "labels-" + namePrefix = "match-" ) It("Cluster labels are updated when classifier starts matching", Label("FV", "PULLMODE"), func() { diff --git a/test/fv/utils_test.go b/test/fv/utils_test.go index 9d24ec2..90fdd12 100644 --- a/test/fv/utils_test.go +++ b/test/fv/utils_test.go @@ -76,6 +76,30 @@ func getClassifier(namePrefix string, clusterLabels map[string]string) *libsvelt return classifier } +func verifyClassfierIsProvisioned(classifier *libsveltosv1beta1.Classifier) { + Byf("Verifying classifier %s is provisioned on cluster", classifier.Name) + currentCuster, err := getCluster() + Expect(err).To(BeNil()) + Eventually(func() bool { + currentClassifier := &libsveltosv1beta1.Classifier{} + err := k8sClient.Get(context.TODO(), + types.NamespacedName{Name: classifier.Name}, currentClassifier) + if err != nil { + return false + } + for i := range currentClassifier.Status.ClusterInfo { + if currentClassifier.Status.ClusterInfo[i].Cluster.Namespace == currentCuster.GetNamespace() && + currentClassifier.Status.ClusterInfo[i].Cluster.Name == currentCuster.GetName() && + currentClassifier.Status.ClusterInfo[i].Status == libsveltosv1beta1.SveltosStatusProvisioned { + + return true + } + } + + return false + }, timeout, pollingInterval).Should(BeTrue()) +} + // getKindWorkloadClusterKubeconfig returns client to access the kind cluster used as workload cluster func getKindWorkloadClusterKubeconfig() (client.Client, error) { kubeconfigPath := "workload_kubeconfig" // this file is created in this directory by Makefile during cluster creation @@ -108,6 +132,7 @@ func verifyClassifierReport(classifierName string, isMatch bool) { func verifyClusterLabels(classifier *libsveltosv1beta1.Classifier) { Byf("Verifying Cluster labels are updated with labels from Classifier %s", classifier.Name) + Byf("Classifier labels: %v", classifier.Spec.ClassifierLabels) Eventually(func() bool { currentCuster, err := getCluster() if err != nil { @@ -116,6 +141,7 @@ func verifyClusterLabels(classifier *libsveltosv1beta1.Classifier) { if currentCuster.GetLabels() == nil { return false } + Byf("Current cluster labels: %v", currentCuster.GetLabels()) for i := range classifier.Spec.ClassifierLabels { cLabel := classifier.Spec.ClassifierLabels[i] v, ok := currentCuster.GetLabels()[cLabel.Key]