diff --git a/Makefile b/Makefile index 1fbb87ce..9d56dd1b 100644 --- a/Makefile +++ b/Makefile @@ -192,10 +192,10 @@ create-cluster: $(KIND) $(CLUSTERCTL) $(KUBECTL) $(ENVSUBST) ## Create a new kin @echo "Create a workload cluster" $(KUBECTL) apply -f $(KIND_CLUSTER_YAML) - + @echo "Start projectsveltos" $(MAKE) deploy-projectsveltos - + @echo "wait for cluster to be provisioned" $(KUBECTL) wait cluster sveltos-management-workload -n default --for=jsonpath='{.status.phase}'=Provisioned --timeout=$(TIMEOUT) diff --git a/api/v1alpha1/clusterprofile_types.go b/api/v1alpha1/clusterprofile_types.go index 9aa8d180..731c1e31 100644 --- a/api/v1alpha1/clusterprofile_types.go +++ b/api/v1alpha1/clusterprofile_types.go @@ -146,7 +146,12 @@ const ( // ClusterProfileSpec defines the desired state of ClusterProfile type ClusterProfileSpec struct { // ClusterSelector identifies clusters to associate to. - ClusterSelector libsveltosv1alpha1.Selector `json:"clusterSelector"` + // +optional + ClusterSelector libsveltosv1alpha1.Selector `json:"clusterSelector,omitempty"` + + // ClusterRefs identifies clusters to associate to. + // +optional + ClusterRefs []corev1.ObjectReference `json:"clusterRefs,omitempty"` // SyncMode specifies how features are synced in a matching workload cluster. // - OneTime means, first time a workload cluster matches the ClusterProfile, diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 3c673f78..d49aa4aa 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -210,6 +210,11 @@ func (in *ClusterProfileResource) DeepCopy() *ClusterProfileResource { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterProfileSpec) DeepCopyInto(out *ClusterProfileSpec) { *out = *in + if in.ClusterRefs != nil { + in, out := &in.ClusterRefs, &out.ClusterRefs + *out = make([]v1.ObjectReference, len(*in)) + copy(*out, *in) + } if in.PolicyRefs != nil { in, out := &in.PolicyRefs, &out.PolicyRefs *out = make([]apiv1alpha1.PolicyRef, len(*in)) diff --git a/config/crd/bases/config.projectsveltos.io_clusterconfigurations.yaml b/config/crd/bases/config.projectsveltos.io_clusterconfigurations.yaml index ebd85783..88652cb8 100644 --- a/config/crd/bases/config.projectsveltos.io_clusterconfigurations.yaml +++ b/config/crd/bases/config.projectsveltos.io_clusterconfigurations.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: clusterconfigurations.config.projectsveltos.io spec: @@ -170,6 +170,7 @@ spec: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic version: description: Version of the resource deployed in the Cluster. @@ -201,9 +202,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/config.projectsveltos.io_clusterprofiles.yaml b/config/crd/bases/config.projectsveltos.io_clusterprofiles.yaml index a3314550..f00ee9cb 100644 --- a/config/crd/bases/config.projectsveltos.io_clusterprofiles.yaml +++ b/config/crd/bases/config.projectsveltos.io_clusterprofiles.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: clusterprofiles.config.projectsveltos.io spec: @@ -35,6 +35,70 @@ spec: spec: description: ClusterProfileSpec defines the desired state of ClusterProfile properties: + clusterRefs: + description: ClusterRefs identifies clusters to associate to. + items: + description: "ObjectReference contains enough information to let + you inspect or modify the referred object. --- New uses of this + type are discouraged because of difficulty describing its usage + when embedded in APIs. 1. Ignored fields. It includes many fields + which are not generally honored. For instance, ResourceVersion + and FieldPath are both very rarely valid in actual usage. 2. Invalid + usage help. It is impossible to add specific help for individual + usage. In most embedded usages, there are particular restrictions + like, \"must refer only to types A and B\" or \"UID not honored\" + or \"name must be restricted\". Those cannot be well described + when embedded. 3. Inconsistent validation. Because the usages + are different, the validation rules are different by usage, which + makes it hard for users to predict what will happen. 4. The fields + are both imprecise and overly precise. Kind is not a precise + mapping to a URL. This can produce ambiguity during interpretation + and require a REST mapping. In most cases, the dependency is + on the group,resource tuple and the version of the actual struct + is irrelevant. 5. We cannot easily change it. Because this type + is embedded in many locations, updates to this type will affect + numerous schemas. Don't make new APIs embed an underspecified + API type they do not control. \n Instead of using this type, create + a locally provided and used type that is well-focused on your + reference. For example, ServiceReferences for admission registration: + https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 + ." + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of + an entire object, this string should contain a valid JSON/Go + field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within + a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" + (container with index 2 in this pod). This syntax is chosen + only to have some well-defined way of referencing a part of + an object. TODO: this design is not final and this field is + subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic + type: array clusterSelector: description: ClusterSelector identifies clusters to associate to. type: string @@ -113,6 +177,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic values: description: 'Values holds the values for this Helm release. Go templating with the values from the referenced CAPI Cluster. @@ -189,8 +254,6 @@ spec: - ContinuousWithDriftDetection - DryRun type: string - required: - - clusterSelector type: object status: description: ClusterProfileStatus defines the observed state of ClusterProfile @@ -258,6 +321,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic type: array type: object type: object @@ -265,9 +329,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/config.projectsveltos.io_clusterreports.yaml b/config/crd/bases/config.projectsveltos.io_clusterreports.yaml index 890c4188..c3da1562 100644 --- a/config/crd/bases/config.projectsveltos.io_clusterreports.yaml +++ b/config/crd/bases/config.projectsveltos.io_clusterreports.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: clusterreports.config.projectsveltos.io spec: @@ -169,6 +169,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic version: description: Version of the resource deployed in the Cluster. minLength: 1 @@ -190,9 +191,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/config.projectsveltos.io_clustersummaries.yaml b/config/crd/bases/config.projectsveltos.io_clustersummaries.yaml index 3b8c2fc8..e462ec2c 100644 --- a/config/crd/bases/config.projectsveltos.io_clustersummaries.yaml +++ b/config/crd/bases/config.projectsveltos.io_clustersummaries.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: clustersummaries.config.projectsveltos.io spec: @@ -47,6 +47,72 @@ spec: description: ClusterProfileSpec represent the configuration that will be applied to the workload cluster. properties: + clusterRefs: + description: ClusterRefs identifies clusters to associate to. + items: + description: "ObjectReference contains enough information to + let you inspect or modify the referred object. --- New uses + of this type are discouraged because of difficulty describing + its usage when embedded in APIs. 1. Ignored fields. It includes + many fields which are not generally honored. For instance, + ResourceVersion and FieldPath are both very rarely valid in + actual usage. 2. Invalid usage help. It is impossible to + add specific help for individual usage. In most embedded + usages, there are particular restrictions like, \"must refer + only to types A and B\" or \"UID not honored\" or \"name must + be restricted\". Those cannot be well described when embedded. + 3. Inconsistent validation. Because the usages are different, + the validation rules are different by usage, which makes it + hard for users to predict what will happen. 4. The fields + are both imprecise and overly precise. Kind is not a precise + mapping to a URL. This can produce ambiguity during interpretation + and require a REST mapping. In most cases, the dependency + is on the group,resource tuple and the version of the actual + struct is irrelevant. 5. We cannot easily change it. Because + this type is embedded in many locations, updates to this type + will affect numerous schemas. Don't make new APIs embed an + underspecified API type they do not control. \n Instead of + using this type, create a locally provided and used type that + is well-focused on your reference. For example, ServiceReferences + for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 + ." + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a valid + JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that + triggered the event) or if no container name is specified + "spec.containers[2]" (container with index 2 in this pod). + This syntax is chosen only to have some well-defined way + of referencing a part of an object. TODO: this design + is not final and this field is subject to change in the + future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic + type: array clusterSelector: description: ClusterSelector identifies clusters to associate to. @@ -127,6 +193,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic values: description: 'Values holds the values for this Helm release. Go templating with the values from the referenced CAPI @@ -204,8 +271,6 @@ spec: - ContinuousWithDriftDetection - DryRun type: string - required: - - clusterSelector type: object clusterType: description: ClusterType is the type of Cluster @@ -310,9 +375,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/controllers/cluster_utils.go b/controllers/cluster_utils.go deleted file mode 100644 index 06894fef..00000000 --- a/controllers/cluster_utils.go +++ /dev/null @@ -1,205 +0,0 @@ -/* -Copyright 2022. projectsveltos.io. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controllers - -import ( - "context" - "os" - - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/rest" - "k8s.io/client-go/tools/clientcmd" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - "sigs.k8s.io/controller-runtime/pkg/client" - - "github.com/go-logr/logr" - "github.com/pkg/errors" - - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" - "github.com/projectsveltos/libsveltos/lib/clusterproxy" - logs "github.com/projectsveltos/libsveltos/lib/logsettings" - "github.com/projectsveltos/libsveltos/lib/roles" -) - -const ( - clusterAdmin = "cluster-admin" -) - -// getSveltosCluster returns SveltosCluster -func getSveltosCluster(ctx context.Context, c client.Client, - clusterNamespace, clusterName string) (*libsveltosv1alpha1.SveltosCluster, error) { - - clusterNamespacedName := types.NamespacedName{ - Namespace: clusterNamespace, - Name: clusterName, - } - - cluster := &libsveltosv1alpha1.SveltosCluster{} - if err := c.Get(ctx, clusterNamespacedName, cluster); err != nil { - return nil, err - } - return cluster, nil -} - -// getCAPICluster returns CAPI Cluster -func getCAPICluster(ctx context.Context, c client.Client, - clusterNamespace, clusterName string) (*clusterv1.Cluster, error) { - - clusterNamespacedNamed := types.NamespacedName{ - Namespace: clusterNamespace, - Name: clusterName, - } - - cluster := &clusterv1.Cluster{} - if err := c.Get(ctx, clusterNamespacedNamed, cluster); err != nil { - return nil, err - } - return cluster, nil -} - -// getCluster returns the cluster associated to ClusterSummary. -// ClusterSummary can be created for either a CAPI Cluster or a Sveltos Cluster. -func getCluster(ctx context.Context, c client.Client, - clusterNamespace, clusterName string, clusterType libsveltosv1alpha1.ClusterType) (client.Object, error) { - - if clusterType == libsveltosv1alpha1.ClusterTypeSveltos { - return getSveltosCluster(ctx, c, clusterNamespace, clusterName) - } - return getCAPICluster(ctx, c, clusterNamespace, clusterName) -} - -// isCAPIClusterPaused returns true if CAPI Cluster is paused -func isCAPIClusterPaused(ctx context.Context, c client.Client, - clusterNamespace, clusterName string) (bool, error) { - - cluster, err := getCAPICluster(ctx, c, clusterNamespace, clusterName) - if err != nil { - return false, err - } - - return cluster.Spec.Paused, nil -} - -// isSveltosClusterPaused returns true if CAPI Cluster is paused -func isSveltosClusterPaused(ctx context.Context, c client.Client, - clusterNamespace, clusterName string) (bool, error) { - - cluster, err := getSveltosCluster(ctx, c, clusterNamespace, clusterName) - if err != nil { - return false, err - } - - return cluster.Spec.Paused, nil -} - -func isClusterPaused(ctx context.Context, c client.Client, - clusterNamespace, clusterName string, clusterType libsveltosv1alpha1.ClusterType) (bool, error) { - - if clusterType == libsveltosv1alpha1.ClusterTypeSveltos { - return isSveltosClusterPaused(ctx, c, clusterNamespace, clusterName) - } - return isCAPIClusterPaused(ctx, c, clusterNamespace, clusterName) -} - -func getKubernetesRestConfigForAdmin(ctx context.Context, c client.Client, clusterNamespace, clusterName, admin string, - clusterType libsveltosv1alpha1.ClusterType, logger logr.Logger) (*rest.Config, error) { - - kubeconfigContent, err := roles.GetKubeconfig(ctx, c, clusterNamespace, clusterName, admin, clusterType) - if err != nil { - return nil, err - } - - kubeconfig, err := clusterproxy.CreateKubeconfig(logger, kubeconfigContent) - if err != nil { - return nil, err - } - defer os.Remove(kubeconfig) - - config, err := clientcmd.BuildConfigFromFlags("", kubeconfig) - if err != nil { - logger.Error(err, "BuildConfigFromFlags") - return nil, errors.Wrap(err, "BuildConfigFromFlags") - } - - return config, nil -} - -func getKubernetesClientForAdmin(ctx context.Context, c client.Client, clusterNamespace, clusterName, admin string, - clusterType libsveltosv1alpha1.ClusterType, logger logr.Logger) (client.Client, error) { - - config, err := getKubernetesRestConfigForAdmin(ctx, c, clusterNamespace, clusterName, admin, clusterType, logger) - if err != nil { - return nil, err - } - logger.V(logs.LogVerbose).Info("return new client") - return client.New(config, client.Options{Scheme: c.Scheme()}) -} - -func getSecretData(ctx context.Context, c client.Client, clusterNamespace, clusterName, admin string, - clusterType libsveltosv1alpha1.ClusterType, logger logr.Logger) ([]byte, error) { - - if admin != "" && admin != clusterAdmin { - return roles.GetKubeconfig(ctx, c, clusterNamespace, clusterName, admin, clusterType) - } - - if clusterType == libsveltosv1alpha1.ClusterTypeSveltos { - return clusterproxy.GetSveltosSecretData(ctx, logger, c, clusterNamespace, clusterName) - } - return clusterproxy.GetCAPISecretData(ctx, logger, c, clusterNamespace, clusterName) -} - -func getKubernetesRestConfig(ctx context.Context, c client.Client, clusterNamespace, clusterName, admin string, - clusterType libsveltosv1alpha1.ClusterType, logger logr.Logger) (*rest.Config, error) { - - if admin != "" && admin != clusterAdmin { - return getKubernetesRestConfigForAdmin(ctx, c, clusterNamespace, clusterName, admin, clusterType, logger) - } - - if clusterType == libsveltosv1alpha1.ClusterTypeSveltos { - return clusterproxy.GetSveltosKubernetesRestConfig(ctx, logger, c, clusterNamespace, clusterName) - } - return clusterproxy.GetCAPIKubernetesRestConfig(ctx, logger, c, clusterNamespace, clusterName) -} - -func getKubernetesClient(ctx context.Context, c client.Client, clusterNamespace, clusterName, admin string, - clusterType libsveltosv1alpha1.ClusterType, logger logr.Logger) (client.Client, error) { - - if admin != "" && admin != clusterAdmin { - return getKubernetesClientForAdmin(ctx, c, clusterNamespace, clusterName, admin, clusterType, logger) - } - - if clusterType == libsveltosv1alpha1.ClusterTypeSveltos { - return clusterproxy.GetSveltosKubernetesClient(ctx, logger, c, c.Scheme(), clusterNamespace, clusterName) - } - return clusterproxy.GetCAPIKubernetesClient(ctx, logger, c, c.Scheme(), clusterNamespace, clusterName) -} - -func getClusterType(cluster *corev1.ObjectReference) libsveltosv1alpha1.ClusterType { - // TODO: remove this - if cluster.APIVersion != libsveltosv1alpha1.GroupVersion.String() && - cluster.APIVersion != clusterv1.GroupVersion.String() { - - panic(1) - } - - clusterType := libsveltosv1alpha1.ClusterTypeCapi - if cluster.APIVersion == libsveltosv1alpha1.GroupVersion.String() { - clusterType = libsveltosv1alpha1.ClusterTypeSveltos - } - return clusterType -} diff --git a/controllers/cluster_utils_test.go b/controllers/cluster_utils_test.go deleted file mode 100644 index 0fcf139e..00000000 --- a/controllers/cluster_utils_test.go +++ /dev/null @@ -1,144 +0,0 @@ -/* -Copyright 2022. projectsveltos.io. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controllers_test - -import ( - "context" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/klog/v2/klogr" - - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" - "github.com/projectsveltos/sveltos-manager/controllers" - - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/client/fake" -) - -var _ = Describe("Cluster utils", func() { - var namespace string - var cluster *clusterv1.Cluster - var sveltosCluster *libsveltosv1alpha1.SveltosCluster - - BeforeEach(func() { - namespace = "cluster-utils" + randomString() - - cluster = &clusterv1.Cluster{ - ObjectMeta: metav1.ObjectMeta{ - Name: randomString(), - Namespace: namespace, - }, - Spec: clusterv1.ClusterSpec{ - Paused: true, - }, - } - - sveltosCluster = &libsveltosv1alpha1.SveltosCluster{ - ObjectMeta: metav1.ObjectMeta{ - Name: randomString(), - Namespace: namespace, - }, - Spec: libsveltosv1alpha1.SveltosClusterSpec{ - Paused: true, - }, - } - }) - - It("isClusterPaused returns true when Spec.Paused is set to true", func() { - initObjects := []client.Object{ - cluster, sveltosCluster, - } - - c := fake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build() - - paused, err := controllers.IsClusterPaused(context.TODO(), c, cluster.Namespace, - cluster.Name, libsveltosv1alpha1.ClusterTypeCapi) - Expect(err).To(BeNil()) - Expect(paused).To(BeTrue()) - - paused, err = controllers.IsClusterPaused(context.TODO(), c, sveltosCluster.Namespace, - sveltosCluster.Name, libsveltosv1alpha1.ClusterTypeSveltos) - Expect(err).To(BeNil()) - Expect(paused).To(BeTrue()) - }) - - It("isClusterPaused returns false when Spec.Paused is set to false", func() { - cluster.Spec.Paused = false - sveltosCluster.Spec.Paused = false - initObjects := []client.Object{ - cluster, sveltosCluster, - } - - c := fake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build() - - paused, err := controllers.IsClusterPaused(context.TODO(), c, cluster.Namespace, - cluster.Name, libsveltosv1alpha1.ClusterTypeCapi) - Expect(err).To(BeNil()) - Expect(paused).To(BeFalse()) - - paused, err = controllers.IsClusterPaused(context.TODO(), c, sveltosCluster.Namespace, - sveltosCluster.Name, libsveltosv1alpha1.ClusterTypeSveltos) - Expect(err).To(BeNil()) - Expect(paused).To(BeFalse()) - }) - - It("getSecretData returns kubeconfig data", func() { - randomData := []byte(randomString()) - sveltosSecret := corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: sveltosCluster.Namespace, - Name: sveltosCluster.Name + "-sveltos-kubeconfig", - }, - Data: map[string][]byte{ - "data": randomData, - }, - } - - capiSecret := corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: cluster.Namespace, - Name: cluster.Name + "-kubeconfig", - }, - Data: map[string][]byte{ - "data": randomData, - }, - } - - initObjects := []client.Object{ - sveltosCluster, - cluster, - &sveltosSecret, - &capiSecret, - } - - c := fake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build() - - data, err := controllers.GetSecretData(context.TODO(), c, cluster.Namespace, cluster.Name, "", - libsveltosv1alpha1.ClusterTypeCapi, klogr.New()) - Expect(err).To(BeNil()) - Expect(data).To(Equal(randomData)) - - data, err = controllers.GetSecretData(context.TODO(), c, sveltosCluster.Namespace, sveltosCluster.Name, "", - libsveltosv1alpha1.ClusterTypeSveltos, klogr.New()) - Expect(err).To(BeNil()) - Expect(data).To(Equal(randomData)) - }) -}) diff --git a/controllers/clusterprofile_controller.go b/controllers/clusterprofile_controller.go index 773cb2cc..747957a9 100644 --- a/controllers/clusterprofile_controller.go +++ b/controllers/clusterprofile_controller.go @@ -22,6 +22,7 @@ import ( "reflect" "sync" + "github.com/go-logr/logr" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -218,7 +219,7 @@ func (r *ClusterProfileReconciler) reconcileNormal( } } - matchingCluster, err := r.getMatchingClusters(ctx, clusterProfileScope) + matchingCluster, err := r.getMatchingClusters(ctx, clusterProfileScope, logger) if err != nil { return reconcile.Result{}, err } @@ -320,97 +321,6 @@ func (r *ClusterProfileReconciler) addFinalizer(ctx context.Context, clusterProf return nil } -// getMatchingClusters returns all Sveltos/CAPI Clusters currently matching ClusterProfile.Spec.ClusterSelector -func (r *ClusterProfileReconciler) getMatchingClusters(ctx context.Context, clusterProfileScope *scope.ClusterProfileScope, -) ([]corev1.ObjectReference, error) { - - matching := make([]corev1.ObjectReference, 0) - - parsedSelector, _ := labels.Parse(clusterProfileScope.GetSelector()) - - tmpMatching, err := r.getMatchingCAPIClusters(ctx, clusterProfileScope, parsedSelector) - if err != nil { - return nil, err - } - - matching = append(matching, tmpMatching...) - - tmpMatching, err = r.getMatchingSveltosClusters(ctx, clusterProfileScope, parsedSelector) - if err != nil { - return nil, err - } - - matching = append(matching, tmpMatching...) - - return matching, nil -} - -func (r *ClusterProfileReconciler) getMatchingCAPIClusters(ctx context.Context, clusterProfileScope *scope.ClusterProfileScope, - parsedSelector labels.Selector) ([]corev1.ObjectReference, error) { - - clusterList := &clusterv1.ClusterList{} - if err := r.List(ctx, clusterList); err != nil { - clusterProfileScope.Logger.Error(err, "failed to list all Cluster") - return nil, err - } - - matching := make([]corev1.ObjectReference, 0) - - for i := range clusterList.Items { - cluster := &clusterList.Items[i] - - if !cluster.DeletionTimestamp.IsZero() { - // Only existing cluster can match - continue - } - - addTypeInformationToObject(r.Scheme, cluster) - if parsedSelector.Matches(labels.Set(cluster.Labels)) { - matching = append(matching, corev1.ObjectReference{ - Kind: cluster.Kind, - Namespace: cluster.Namespace, - Name: cluster.Name, - APIVersion: cluster.APIVersion, - }) - } - } - - return matching, nil -} - -func (r *ClusterProfileReconciler) getMatchingSveltosClusters(ctx context.Context, clusterProfileScope *scope.ClusterProfileScope, - parsedSelector labels.Selector) ([]corev1.ObjectReference, error) { - - clusterList := &libsveltosv1alpha1.SveltosClusterList{} - if err := r.List(ctx, clusterList); err != nil { - clusterProfileScope.Logger.Error(err, "failed to list all Cluster") - return nil, err - } - - matching := make([]corev1.ObjectReference, 0) - - for i := range clusterList.Items { - cluster := &clusterList.Items[i] - - if !cluster.DeletionTimestamp.IsZero() { - // Only existing cluster can match - continue - } - - addTypeInformationToObject(r.Scheme, cluster) - if parsedSelector.Matches(labels.Set(cluster.Labels)) { - matching = append(matching, corev1.ObjectReference{ - Kind: cluster.Kind, - Namespace: cluster.Namespace, - Name: cluster.Name, - APIVersion: cluster.APIVersion, - }) - } - } - - return matching, nil -} - // updateClusterReports for each Sveltos/CAPI Cluster currently matching ClusterProfile: // - if syncMode is DryRun, creates corresponding ClusterReport if one does not exist already; // - if syncMode is DryRun, deletes ClusterReports for any Sveltos/CAPI Cluster not matching anymore; @@ -453,7 +363,7 @@ func (r *ClusterProfileReconciler) createClusterReports(ctx context.Context, clu func (r *ClusterProfileReconciler) createClusterReport(ctx context.Context, clusterProfile *configv1alpha1.ClusterProfile, cluster *corev1.ObjectReference) error { - clusterType := getClusterType(cluster) + clusterType := clusterproxy.GetClusterType(cluster) clusterReport := &configv1alpha1.ClusterReport{ ObjectMeta: metav1.ObjectMeta{ @@ -462,7 +372,7 @@ func (r *ClusterProfileReconciler) createClusterReport(ctx context.Context, clus Labels: map[string]string{ ClusterProfileLabelName: clusterProfile.Name, configv1alpha1.ClusterNameLabel: cluster.Name, - configv1alpha1.ClusterTypeLabel: string(getClusterType(cluster)), + configv1alpha1.ClusterTypeLabel: string(clusterproxy.GetClusterType(cluster)), }, }, Spec: configv1alpha1.ClusterReportSpec{ @@ -529,7 +439,8 @@ func (r *ClusterProfileReconciler) updateClusterSummaries(ctx context.Context, c // If a Cluster exists and it is a match, ClusterSummary is created (and ClusterSummary.Spec kept in sync if mode is // continuous). // ClusterSummary won't program cluster in paused state. - _, err = getClusterSummary(ctx, r.Client, clusterProfileScope.Name(), cluster.Namespace, cluster.Name, getClusterType(&cluster)) + _, err = getClusterSummary(ctx, r.Client, clusterProfileScope.Name(), cluster.Namespace, cluster.Name, + clusterproxy.GetClusterType(&cluster)) if err != nil { if apierrors.IsNotFound(err) { err = r.createClusterSummary(ctx, clusterProfileScope, &cluster) @@ -566,7 +477,7 @@ func (r *ClusterProfileReconciler) cleanClusterSummaries(ctx context.Context, cl for i := range clusterProfileScope.ClusterProfile.Status.MatchingClusterRefs { reference := clusterProfileScope.ClusterProfile.Status.MatchingClusterRefs[i] - clusterName := getClusterInfo(reference.Namespace, reference.Name, getClusterType(&reference)) + clusterName := getClusterInfo(reference.Namespace, reference.Name, clusterproxy.GetClusterType(&reference)) matching[clusterName] = true } @@ -624,7 +535,7 @@ func (r *ClusterProfileReconciler) cleanClusterConfigurations(ctx context.Contex for i := range clusterProfileScope.ClusterProfile.Status.MatchingClusterRefs { ref := &clusterProfileScope.ClusterProfile.Status.MatchingClusterRefs[i] - matchingClusterMap[info(ref.Namespace, getClusterConfigurationName(ref.Name, getClusterType(ref)))] = true + matchingClusterMap[info(ref.Namespace, getClusterConfigurationName(ref.Name, clusterproxy.GetClusterType(ref)))] = true } err := r.List(ctx, clusterConfiguratioList) @@ -752,7 +663,7 @@ func (r *ClusterProfileReconciler) createClusterSummary(ctx context.Context, clu }, } - clusterSummary.Spec.ClusterType = getClusterType(cluster) + clusterSummary.Spec.ClusterType = clusterproxy.GetClusterType(cluster) clusterSummary.Labels = clusterProfileScope.ClusterProfile.Labels r.addClusterSummaryLabels(clusterSummary, clusterProfileScope, cluster) @@ -768,7 +679,8 @@ func (r *ClusterProfileReconciler) updateClusterSummary(ctx context.Context, clu return nil } - clusterSummary, err := getClusterSummary(ctx, r.Client, clusterProfileScope.Name(), cluster.Namespace, cluster.Name, getClusterType(cluster)) + clusterSummary, err := getClusterSummary(ctx, r.Client, clusterProfileScope.Name(), cluster.Namespace, cluster.Name, + clusterproxy.GetClusterType(cluster)) if err != nil { return err } @@ -781,7 +693,7 @@ func (r *ClusterProfileReconciler) updateClusterSummary(ctx context.Context, clu clusterSummary.Annotations = clusterProfileScope.ClusterProfile.Annotations clusterSummary.Spec.ClusterProfileSpec = clusterProfileScope.ClusterProfile.Spec - clusterSummary.Spec.ClusterType = getClusterType(cluster) + clusterSummary.Spec.ClusterType = clusterproxy.GetClusterType(cluster) r.addClusterSummaryLabels(clusterSummary, clusterProfileScope, cluster) return r.Update(ctx, clusterSummary) @@ -853,10 +765,10 @@ func (r *ClusterProfileReconciler) createClusterConfiguration(ctx context.Contex clusterConfiguration := &configv1alpha1.ClusterConfiguration{ ObjectMeta: metav1.ObjectMeta{ Namespace: cluster.Namespace, - Name: getClusterConfigurationName(cluster.Name, getClusterType(cluster)), + Name: getClusterConfigurationName(cluster.Name, clusterproxy.GetClusterType(cluster)), Labels: map[string]string{ configv1alpha1.ClusterNameLabel: cluster.Name, - configv1alpha1.ClusterTypeLabel: string(getClusterType(cluster)), + configv1alpha1.ClusterTypeLabel: string(clusterproxy.GetClusterType(cluster)), }, }, } @@ -879,7 +791,7 @@ func (r *ClusterProfileReconciler) updateClusterConfiguration(ctx context.Contex cluster *corev1.ObjectReference) error { clusterConfiguration, err := getClusterConfiguration(ctx, r.Client, cluster.Namespace, - getClusterConfigurationName(cluster.Name, getClusterType(cluster))) + getClusterConfigurationName(cluster.Name, clusterproxy.GetClusterType(cluster))) if err != nil { return err } @@ -1050,3 +962,23 @@ func (r *ClusterProfileReconciler) allClusterSummariesGone(ctx context.Context, return len(clusterSummaryList.Items) == 0 } + +func (r *ClusterProfileReconciler) getMatchingClusters(ctx context.Context, + clusterProfileScope *scope.ClusterProfileScope, logger logr.Logger) ([]corev1.ObjectReference, error) { + + var matchingCluster []corev1.ObjectReference + var err error + if clusterProfileScope.GetSelector() != "" { + parsedSelector, _ := labels.Parse(clusterProfileScope.GetSelector()) + matchingCluster, err = clusterproxy.GetMatchingClusters(ctx, r.Client, parsedSelector, logger) + if err != nil { + return nil, err + } + } + + for i := range clusterProfileScope.ClusterProfile.Spec.ClusterRefs { + matchingCluster = append(matchingCluster, clusterProfileScope.ClusterProfile.Spec.ClusterRefs[i]) + } + + return matchingCluster, nil +} diff --git a/controllers/clusterprofile_controller_test.go b/controllers/clusterprofile_controller_test.go index 5e406f73..12282b41 100644 --- a/controllers/clusterprofile_controller_test.go +++ b/controllers/clusterprofile_controller_test.go @@ -92,6 +92,54 @@ var _ = Describe("ClusterProfile: Reconciler", func() { } }) + It("getMatchingCluster considers both ClusterSelector and ClusterRefs", func() { + initObjects := []client.Object{ + matchingCluster, + nonMatchingCluster, + clusterProfile, + } + + c := fake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build() + + reconciler := &controllers.ClusterProfileReconciler{ + Client: c, + Scheme: scheme, + ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), + ClusterProfileMap: make(map[corev1.ObjectReference]*libsveltosset.Set), + ClusterProfiles: make(map[corev1.ObjectReference]libsveltosv1alpha1.Selector), + ClusterLabels: make(map[corev1.ObjectReference]map[string]string), + Mux: sync.Mutex{}, + } + + clusterProfileScope, err := scope.NewClusterProfileScope(scope.ClusterProfileScopeParams{ + Client: c, + Logger: logger, + ClusterProfile: clusterProfile, + ControllerName: "clusterprofile", + }) + Expect(err).To(BeNil()) + + // Only clusterSelector is, so only matchingCluster is a match + matching, err := controllers.GetMatchingClusters(reconciler, context.TODO(), clusterProfileScope, klogr.New()) + Expect(err).To(BeNil()) + Expect(len(matching)).To(Equal(1)) + + clusterProfile.Spec.ClusterRefs = []corev1.ObjectReference{ + { + Kind: clusterKind, + APIVersion: clusterv1.GroupVersion.String(), + Name: nonMatchingCluster.Name, + Namespace: nonMatchingCluster.Namespace, + }, + } + + // Both clusterSelector (matchingCluster is a match) and ClusterRefs (nonMatchingCluster is referenced) are set + // So two clusters are now matching + matching, err = controllers.GetMatchingClusters(reconciler, context.TODO(), clusterProfileScope, klogr.New()) + Expect(err).To(BeNil()) + Expect(len(matching)).To(Equal(2)) + }) + It("Adds finalizer", func() { initObjects := []client.Object{ clusterProfile, @@ -344,56 +392,6 @@ var _ = Describe("ClusterProfile: Reconciler", func() { Expect(apierrors.IsNotFound(err)).To(BeTrue()) }) - It("getMatchingClusters returns matchin CAPI Cluster", func() { - sveltosCluster := &libsveltosv1alpha1.SveltosCluster{ - ObjectMeta: metav1.ObjectMeta{ - Name: randomString(), - Namespace: randomString(), - Labels: matchingCluster.Labels, - }, - } - - initObjects := []client.Object{ - clusterProfile, - matchingCluster, - sveltosCluster, - nonMatchingCluster, - } - - Expect(addTypeInformationToObject(scheme, matchingCluster)) - Expect(addTypeInformationToObject(scheme, sveltosCluster)) - - c := fake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build() - - reconciler := &controllers.ClusterProfileReconciler{ - Client: c, - Scheme: scheme, - ClusterMap: make(map[corev1.ObjectReference]*libsveltosset.Set), - ClusterProfileMap: make(map[corev1.ObjectReference]*libsveltosset.Set), - ClusterProfiles: make(map[corev1.ObjectReference]libsveltosv1alpha1.Selector), - ClusterLabels: make(map[corev1.ObjectReference]map[string]string), - Mux: sync.Mutex{}, - } - - clusterProfileScope, err := scope.NewClusterProfileScope(scope.ClusterProfileScopeParams{ - Client: c, - Logger: logger, - ClusterProfile: clusterProfile, - ControllerName: "clusterprofile", - }) - Expect(err).To(BeNil()) - - matches, err := controllers.GetMatchingClusters(reconciler, context.TODO(), clusterProfileScope) - Expect(err).To(BeNil()) - Expect(len(matches)).To(Equal(2)) - Expect(matches).To(ContainElement( - corev1.ObjectReference{Namespace: matchingCluster.Namespace, Name: matchingCluster.Name, - Kind: matchingCluster.Kind, APIVersion: matchingCluster.APIVersion})) - Expect(matches).To(ContainElement( - corev1.ObjectReference{Namespace: sveltosCluster.Namespace, Name: sveltosCluster.Name, - Kind: sveltosCluster.Kind, APIVersion: sveltosCluster.APIVersion})) - }) - It("CreateClusterSummary creates ClusterSummary with proper fields", func() { initObjects := []client.Object{ clusterProfile, diff --git a/controllers/clustersummary_controller.go b/controllers/clustersummary_controller.go index 7cb07969..2da74141 100644 --- a/controllers/clustersummary_controller.go +++ b/controllers/clustersummary_controller.go @@ -41,6 +41,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/source" libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + "github.com/projectsveltos/libsveltos/lib/clusterproxy" "github.com/projectsveltos/libsveltos/lib/deployer" logs "github.com/projectsveltos/libsveltos/lib/logsettings" libsveltosset "github.com/projectsveltos/libsveltos/lib/set" @@ -421,7 +422,7 @@ func (r *ClusterSummaryReconciler) isClusterPresent(ctx context.Context, cluster var err error cs := clusterSummaryScope.ClusterSummary - _, err = getCluster(ctx, r.Client, cs.Spec.ClusterNamespace, cs.Spec.ClusterName, cs.Spec.ClusterType) + _, err = clusterproxy.GetCluster(ctx, r.Client, cs.Spec.ClusterNamespace, cs.Spec.ClusterName, cs.Spec.ClusterType) if err != nil { if apierrors.IsNotFound(err) { @@ -549,7 +550,7 @@ func (r *ClusterSummaryReconciler) updateMaps(ctx context.Context, clusterSummar defer r.PolicyMux.Unlock() cs := clusterSummaryScope.ClusterSummary - clusterObject, err := getCluster(ctx, r.Client, cs.Spec.ClusterNamespace, cs.Spec.ClusterName, cs.Spec.ClusterType) + clusterObject, err := clusterproxy.GetCluster(ctx, r.Client, cs.Spec.ClusterNamespace, cs.Spec.ClusterName, cs.Spec.ClusterType) if err != nil { return err } @@ -674,7 +675,7 @@ func (r *ClusterSummaryReconciler) getReferenceMapForEntry(entry *corev1.ObjectR func (r *ClusterSummaryReconciler) isPaused(ctx context.Context, clusterSummary *configv1alpha1.ClusterSummary) (bool, error) { - isClusterPaused, err := isClusterPaused(ctx, r.Client, clusterSummary.Spec.ClusterNamespace, + isClusterPaused, err := clusterproxy.IsClusterPaused(ctx, r.Client, clusterSummary.Spec.ClusterNamespace, clusterSummary.Spec.ClusterName, clusterSummary.Spec.ClusterType) if err != nil { @@ -704,7 +705,8 @@ func (r *ClusterSummaryReconciler) canRemoveFinalizer(ctx context.Context, return false } - _, err := getCluster(ctx, r.Client, clusterSummary.Spec.ClusterNamespace, clusterSummary.Spec.ClusterName, clusterSummary.Spec.ClusterType) + _, err := clusterproxy.GetCluster(ctx, r.Client, clusterSummary.Spec.ClusterNamespace, + clusterSummary.Spec.ClusterName, clusterSummary.Spec.ClusterType) if err != nil { if apierrors.IsNotFound(err) { logger.V(logs.LogInfo).Info(fmt.Sprintf("cluster %s/%s not found. Nothing to do.", @@ -755,7 +757,7 @@ func (r *ClusterSummaryReconciler) removeResourceSummary(ctx context.Context, // ResourceSummary is a Sveltos resource deployed in managed clusters. // Such resources are always created, removed using cluster-admin roles. cs := clusterSummaryScope.ClusterSummary - remoteClient, err := getKubernetesClient(ctx, r.Client, cs.Spec.ClusterNamespace, + remoteClient, err := clusterproxy.GetKubernetesClient(ctx, r.Client, cs.Spec.ClusterNamespace, cs.Spec.ClusterName, "", cs.Spec.ClusterType, logger) if err != nil { return err diff --git a/controllers/clustersummary_deployer.go b/controllers/clustersummary_deployer.go index 3e8fa2e4..47d2322e 100644 --- a/controllers/clustersummary_deployer.go +++ b/controllers/clustersummary_deployer.go @@ -31,6 +31,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + "github.com/projectsveltos/libsveltos/lib/clusterproxy" "github.com/projectsveltos/libsveltos/lib/deployer" logs "github.com/projectsveltos/libsveltos/lib/logsettings" configv1alpha1 "github.com/projectsveltos/sveltos-manager/api/v1alpha1" @@ -246,7 +247,7 @@ func genericUndeploy(ctx context.Context, c client.Client, // Before any per feature specific code var err error - _, err = getCluster(ctx, c, clusterNamespace, clusterName, clusterType) + _, err = clusterproxy.GetCluster(ctx, c, clusterNamespace, clusterName, clusterType) if err != nil { if apierrors.IsNotFound(err) { diff --git a/controllers/export_test.go b/controllers/export_test.go index 09cad2a4..caee277a 100644 --- a/controllers/export_test.go +++ b/controllers/export_test.go @@ -17,7 +17,6 @@ limitations under the License. package controllers var ( - GetMatchingClusters = (*ClusterProfileReconciler).getMatchingClusters UpdateClusterSummaries = (*ClusterProfileReconciler).updateClusterSummaries CreateClusterSummary = (*ClusterProfileReconciler).createClusterSummary UpdateClusterSummary = (*ClusterProfileReconciler).updateClusterSummary @@ -27,6 +26,7 @@ var ( CleanClusterReports = (*ClusterProfileReconciler).cleanClusterReports UpdateClusterReports = (*ClusterProfileReconciler).updateClusterReports UpdateClusterSummarySyncMode = (*ClusterProfileReconciler).updateClusterSummarySyncMode + GetMatchingClusters = (*ClusterProfileReconciler).getMatchingClusters RequeueClusterProfileForCluster = (*ClusterProfileReconciler).requeueClusterProfileForCluster RequeueClusterProfileForMachine = (*ClusterProfileReconciler).requeueClusterProfileForMachine @@ -101,11 +101,6 @@ var ( GetClusterConfigurationName = getClusterConfigurationName ) -var ( - IsClusterPaused = isClusterPaused - GetSecretData = getSecretData -) - var ( DeployDebuggingConfigurationCRD = deployDebuggingConfigurationCRD DeployResourceSummaryCRD = deployResourceSummaryCRD diff --git a/controllers/handlers_helm.go b/controllers/handlers_helm.go index 3074ce2e..5c483caa 100644 --- a/controllers/handlers_helm.go +++ b/controllers/handlers_helm.go @@ -109,8 +109,8 @@ func deployHelmCharts(ctx context.Context, c client.Client, logger = logger.WithValues("clusterSummary", clusterSummary.Name) logger = logger.WithValues("admin", getClusterSummaryAdmin(clusterSummary)) - kubeconfigContent, err := getSecretData(ctx, c, clusterNamespace, clusterName, getClusterSummaryAdmin(clusterSummary), - clusterSummary.Spec.ClusterType, logger) + kubeconfigContent, err := clusterproxy.GetSecretData(ctx, c, clusterNamespace, clusterName, + getClusterSummaryAdmin(clusterSummary), clusterSummary.Spec.ClusterType, logger) if err != nil { return err } @@ -158,8 +158,8 @@ func undeployHelmCharts(ctx context.Context, c client.Client, logger = logger.WithValues("clusterSummary", clusterSummary.Name) logger = logger.WithValues("admin", getClusterSummaryAdmin(clusterSummary)) - kubeconfigContent, err := getSecretData(ctx, c, clusterNamespace, clusterName, getClusterSummaryAdmin(clusterSummary), - clusterSummary.Spec.ClusterType, logger) + kubeconfigContent, err := clusterproxy.GetSecretData(ctx, c, clusterNamespace, clusterName, + getClusterSummaryAdmin(clusterSummary), clusterSummary.Spec.ClusterType, logger) if err != nil { return err } diff --git a/controllers/handlers_resources.go b/controllers/handlers_resources.go index d36ac351..1b4d411e 100644 --- a/controllers/handlers_resources.go +++ b/controllers/handlers_resources.go @@ -30,6 +30,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + "github.com/projectsveltos/libsveltos/lib/clusterproxy" "github.com/projectsveltos/libsveltos/lib/deployer" logs "github.com/projectsveltos/libsveltos/lib/logsettings" configv1alpha1 "github.com/projectsveltos/sveltos-manager/api/v1alpha1" @@ -62,8 +63,8 @@ func deployResources(ctx context.Context, c client.Client, } } - remoteRestConfig, err := getKubernetesRestConfig(ctx, c, clusterNamespace, clusterName, getClusterSummaryAdmin(clusterSummary), - clusterSummary.Spec.ClusterType, logger) + remoteRestConfig, err := clusterproxy.GetKubernetesRestConfig(ctx, c, clusterNamespace, clusterName, + getClusterSummaryAdmin(clusterSummary), clusterSummary.Spec.ClusterType, logger) if err != nil { return err } @@ -142,14 +143,14 @@ func undeployResources(ctx context.Context, c client.Client, logger = logger.WithValues("clusterSummary", clusterSummary.Name) logger = logger.WithValues("admin", getClusterSummaryAdmin(clusterSummary)) - remoteClient, err := getKubernetesClient(ctx, c, clusterNamespace, clusterName, getClusterSummaryAdmin(clusterSummary), - clusterSummary.Spec.ClusterType, logger) + remoteClient, err := clusterproxy.GetKubernetesClient(ctx, c, clusterNamespace, clusterName, + getClusterSummaryAdmin(clusterSummary), clusterSummary.Spec.ClusterType, logger) if err != nil { return err } - remoteRestConfig, err := getKubernetesRestConfig(ctx, c, clusterNamespace, clusterName, getClusterSummaryAdmin(clusterSummary), - clusterSummary.Spec.ClusterType, logger) + remoteRestConfig, err := clusterproxy.GetKubernetesRestConfig(ctx, c, clusterNamespace, clusterName, + getClusterSummaryAdmin(clusterSummary), clusterSummary.Spec.ClusterType, logger) if err != nil { return err } diff --git a/controllers/handlers_utils.go b/controllers/handlers_utils.go index 3a12668b..8c53425e 100644 --- a/controllers/handlers_utils.go +++ b/controllers/handlers_utils.go @@ -42,6 +42,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + "github.com/projectsveltos/libsveltos/lib/clusterproxy" "github.com/projectsveltos/libsveltos/lib/deployer" logs "github.com/projectsveltos/libsveltos/lib/logsettings" "github.com/projectsveltos/libsveltos/lib/utils" @@ -338,7 +339,8 @@ func getClusterSummaryAndClusterClient(ctx context.Context, clusterNamespace, cl } // Get CAPI Cluster - cluster, err := getCluster(ctx, c, clusterSummary.Spec.ClusterNamespace, clusterSummary.Spec.ClusterName, clusterSummary.Spec.ClusterType) + cluster, err := clusterproxy.GetCluster(ctx, c, clusterSummary.Spec.ClusterNamespace, + clusterSummary.Spec.ClusterName, clusterSummary.Spec.ClusterType) if err != nil { return nil, nil, err } @@ -349,7 +351,7 @@ func getClusterSummaryAndClusterClient(ctx context.Context, clusterNamespace, cl return nil, nil, fmt.Errorf("cluster is marked for deletion") } - clusterClient, err := getKubernetesClient(ctx, c, clusterSummary.Spec.ClusterNamespace, + clusterClient, err := clusterproxy.GetKubernetesClient(ctx, c, clusterSummary.Spec.ClusterNamespace, clusterSummary.Spec.ClusterName, getClusterSummaryAdmin(clusterSummary), clusterSummary.Spec.ClusterType, logger) if err != nil { return nil, nil, err diff --git a/controllers/resourcesummary.go b/controllers/resourcesummary.go index c19bd179..dce08e8b 100644 --- a/controllers/resourcesummary.go +++ b/controllers/resourcesummary.go @@ -25,6 +25,7 @@ import ( "k8s.io/client-go/rest" "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/projectsveltos/libsveltos/lib/clusterproxy" "github.com/projectsveltos/libsveltos/lib/logsettings" "github.com/projectsveltos/libsveltos/lib/utils" @@ -50,7 +51,8 @@ func deployDriftDetectionManagerInCluster(ctx context.Context, c client.Client, logger.V(logs.LogDebug).Info("deploy drift detection manager: do not send updates mode") // Sveltos resources are deployed using cluster-admin role. - remoteRestConfig, err := getKubernetesRestConfig(ctx, c, clusterNamespace, clusterName, "", clusterType, logger) + remoteRestConfig, err := clusterproxy.GetKubernetesRestConfig(ctx, c, clusterNamespace, + clusterName, "", clusterType, logger) if err != nil { logger.V(logs.LogInfo).Error(err, "failed to get cluster rest config") return err @@ -63,7 +65,8 @@ func deployDriftDetectionManagerInCluster(ctx context.Context, c client.Client, logger.V(logs.LogDebug).Info("Deploying classifier agent") // Deploy ClassifierAgent - err = deployDriftDetectionManager(ctx, remoteRestConfig, clusterNamespace, clusterName, "do-not-send-reports", clusterType, logger) + err = deployDriftDetectionManager(ctx, remoteRestConfig, clusterNamespace, + clusterName, "do-not-send-reports", clusterType, logger) if err != nil { return err } @@ -82,7 +85,8 @@ func deployResourceSummaryInCluster(ctx context.Context, c client.Client, // ResourceSummary is a Sveltos resource created in managed clusters. // Sveltos resources are always created using cluster-admin so that admin does not need to be // given such permissions. - remoteClient, err := getKubernetesClient(ctx, c, clusterNamespace, clusterName, "", clusterType, logger) + remoteClient, err := clusterproxy.GetKubernetesClient(ctx, c, clusterNamespace, clusterName, "", + clusterType, logger) if err != nil { return err } diff --git a/controllers/resourcesummary_collection.go b/controllers/resourcesummary_collection.go index 298ce999..a21f7268 100644 --- a/controllers/resourcesummary_collection.go +++ b/controllers/resourcesummary_collection.go @@ -79,7 +79,8 @@ func collectResourceSummariesFromCluster(ctx context.Context, c client.Client, // Use cluster-admin role to collect Sveltos resources from managed clusters var remoteClient client.Client - remoteClient, err = getKubernetesClient(ctx, c, cluster.Namespace, cluster.Name, "", getClusterType(clusterRef), logger) + remoteClient, err = clusterproxy.GetKubernetesClient(ctx, c, cluster.Namespace, cluster.Name, "", + clusterproxy.GetClusterType(clusterRef), logger) if err != nil { return err } diff --git a/controllers/template_instantiation.go b/controllers/template_instantiation.go index e9886011..eeb43940 100644 --- a/controllers/template_instantiation.go +++ b/controllers/template_instantiation.go @@ -34,6 +34,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + "github.com/projectsveltos/libsveltos/lib/clusterproxy" logs "github.com/projectsveltos/libsveltos/lib/logsettings" "github.com/projectsveltos/libsveltos/lib/utils" ) @@ -109,7 +110,7 @@ func fecthClusterObjects(ctx context.Context, config *rest.Config, c client.Clie logger.V(logs.LogInfo).Info(fmt.Sprintf("Fetch %s/%s", clusterNamespace, clusterName)) - genericCluster, err := getCluster(ctx, c, clusterNamespace, clusterName, clusterType) + genericCluster, err := clusterproxy.GetCluster(ctx, c, clusterNamespace, clusterName, clusterType) if err != nil { logger.V(logs.LogInfo).Info(fmt.Sprintf("failed to fetch cluster %v", err)) return nil, err diff --git a/go.mod b/go.mod index 229bab73..5dce2c98 100644 --- a/go.mod +++ b/go.mod @@ -12,10 +12,10 @@ require ( github.com/onsi/ginkgo/v2 v2.6.0 github.com/onsi/gomega v1.24.1 github.com/pkg/errors v0.9.1 - github.com/projectsveltos/libsveltos v0.6.1-0.20230222215826-7e468f534c3c + github.com/projectsveltos/libsveltos v0.7.1-0.20230314175637-cecbf1f2a756 github.com/prometheus/client_golang v1.13.0 github.com/spf13/pflag v1.0.5 - golang.org/x/text v0.5.0 + golang.org/x/text v0.7.0 gopkg.in/yaml.v2 v2.4.0 helm.sh/helm/v3 v3.10.3 k8s.io/api v0.25.3 @@ -25,7 +25,7 @@ require ( k8s.io/component-base v0.25.3 k8s.io/klog/v2 v2.80.1 k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73 - sigs.k8s.io/cluster-api v1.3.3 + sigs.k8s.io/cluster-api v1.3.5 sigs.k8s.io/controller-runtime v0.13.1 sigs.k8s.io/gateway-api v0.5.0 ) @@ -135,11 +135,11 @@ require ( go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect go.uber.org/multierr v1.8.0 // indirect golang.org/x/crypto v0.3.0 // indirect - golang.org/x/net v0.4.0 // indirect + golang.org/x/net v0.7.0 // indirect golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/term v0.3.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/term v0.5.0 // indirect golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 912aed0f..1f6239d6 100644 --- a/go.sum +++ b/go.sum @@ -186,7 +186,7 @@ github.com/containerd/cgroups v1.0.3 h1:ADZftAkglvCiD44c77s5YmMqaP2pzVCFZvBmAlBd github.com/containerd/containerd v1.6.6 h1:xJNPhbrmz8xAMDNoVjHy9YHtWwEQNS+CDkcIRh7t8Y0= github.com/containerd/containerd v1.6.6/go.mod h1:ZoP1geJldzCVY3Tonoz7b1IXk8rIX0Nltt5QE4OMNk0= github.com/coredns/caddy v1.1.0 h1:ezvsPrT/tA/7pYDBZxu0cT0VmWk75AfIaf6GSYCNMf0= -github.com/coredns/corefile-migration v1.0.18 h1:zs5PJm/VGZVje1ESRj6ZqyUuVsVfagExkbLU2QKV5mI= +github.com/coredns/corefile-migration v1.0.20 h1:MdOkT6F3ehju/n9tgxlGct8XAajOX2vN+wG7To4BWSI= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -790,8 +790,8 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/poy/onpar v0.0.0-20190519213022-ee068f8ea4d1 h1:oL4IBbcqwhhNWh31bjOX8C/OCy0zs9906d/VUru+bqg= github.com/poy/onpar v0.0.0-20190519213022-ee068f8ea4d1/go.mod h1:nSbFQvMj97ZyhFRSJYtut+msi4sOY6zJDGCdSc+/rZU= -github.com/projectsveltos/libsveltos v0.6.1-0.20230222215826-7e468f534c3c h1:weaDR48XSFZ1j6iORrLXDfKBTo6R3t/Ci4vKn6iGdMg= -github.com/projectsveltos/libsveltos v0.6.1-0.20230222215826-7e468f534c3c/go.mod h1:7QZOMDZjXklss3RA0IDNJB3ZOAyJBnBiiM+142BFeNc= +github.com/projectsveltos/libsveltos v0.7.1-0.20230314175637-cecbf1f2a756 h1:ejOkhS20o5EZ1j+PmzU2dvATbgKayTp2MUaTffBZ8sg= +github.com/projectsveltos/libsveltos v0.7.1-0.20230314175637-cecbf1f2a756/go.mod h1:K2IJCkj2dz6qgZyv0F7tkZkzJ+7il1qjDyIBaBS2NpQ= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= @@ -1125,8 +1125,8 @@ golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1264,14 +1264,14 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= +golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1282,8 +1282,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1674,8 +1674,8 @@ oras.land/oras-go v1.2.0/go.mod h1:pFNs7oHp2dYsYMSS82HaX5l4mpnGO7hbpPN6EWH2ltc= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/cluster-api v1.3.3 h1:sHRAbuev6+bz3OAySmdmT62md/D/UUIy0EYwvP38H/4= -sigs.k8s.io/cluster-api v1.3.3/go.mod h1:nnXmR51rHshpMEXmB4LZIwdiXWKXV6yaooB1KzrL0Qs= +sigs.k8s.io/cluster-api v1.3.5 h1:Chg56Piv5ip0AFRN83H1I8uIn6qsdk+mr9hdq5Cxkf0= +sigs.k8s.io/cluster-api v1.3.5/go.mod h1:9FNHNItE5c+klfDLNG3+ApSTX0H4yGAumdbFJMnk6Vc= sigs.k8s.io/controller-runtime v0.13.1 h1:tUsRCSJVM1QQOOeViGeX3GMT3dQF1eePPw6sEE3xSlg= sigs.k8s.io/controller-runtime v0.13.1/go.mod h1:Zbz+el8Yg31jubvAEyglRZGdLAjplZl+PgtYNI6WNTI= sigs.k8s.io/gateway-api v0.5.0 h1:ze+k9fJqvmL8s1t3e4q1ST8RnN+f09dEv+gfacahlAE= diff --git a/hack/tools/go.mod b/hack/tools/go.mod index 621b5246..93ef265c 100644 --- a/hack/tools/go.mod +++ b/hack/tools/go.mod @@ -7,10 +7,10 @@ require ( github.com/golangci/golangci-lint v1.50.1 github.com/onsi/ginkgo/v2 v2.6.0 golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 - k8s.io/client-go v0.25.2 - sigs.k8s.io/cluster-api v1.3.3 - sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20211110210527-619e6b92dab9 - sigs.k8s.io/controller-tools v0.8.0 + k8s.io/client-go v0.25.3 + sigs.k8s.io/cluster-api v1.3.5 + sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20230307042619-c304e7ec2ee7 + sigs.k8s.io/controller-tools v0.10.0 sigs.k8s.io/kind v0.17.0 sigs.k8s.io/kustomize/kustomize/v4 v4.5.7 ) @@ -238,11 +238,11 @@ require ( golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 // indirect golang.org/x/mod v0.6.0 // indirect - golang.org/x/net v0.4.0 // indirect + golang.org/x/net v0.7.0 // indirect golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/term v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/term v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect golang.org/x/tools v0.2.0 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect @@ -254,9 +254,9 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.3.3 // indirect - k8s.io/api v0.25.2 // indirect + k8s.io/api v0.25.3 // indirect k8s.io/apiextensions-apiserver v0.25.0 // indirect - k8s.io/apimachinery v0.25.2 // indirect + k8s.io/apimachinery v0.25.3 // indirect k8s.io/apiserver v0.25.0 // indirect k8s.io/cluster-bootstrap v0.25.0 // indirect k8s.io/component-base v0.25.0 // indirect diff --git a/hack/tools/go.sum b/hack/tools/go.sum index 75faedaa..5274631c 100644 --- a/hack/tools/go.sum +++ b/hack/tools/go.sum @@ -175,7 +175,7 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coredns/caddy v1.1.0 h1:ezvsPrT/tA/7pYDBZxu0cT0VmWk75AfIaf6GSYCNMf0= -github.com/coredns/corefile-migration v1.0.18 h1:zs5PJm/VGZVje1ESRj6ZqyUuVsVfagExkbLU2QKV5mI= +github.com/coredns/corefile-migration v1.0.20 h1:MdOkT6F3ehju/n9tgxlGct8XAajOX2vN+wG7To4BWSI= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -226,8 +226,6 @@ github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phm github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= @@ -253,7 +251,6 @@ github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/zapr v1.2.0/go.mod h1:Qa4Bsj2Vb+FAVeAKsLD8RLQ+YRJB8YDmOAKxaBQf7Ro= github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= @@ -454,7 +451,6 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -592,21 +588,12 @@ github.com/nishanths/exhaustive v0.8.3 h1:pw5O09vwg8ZaditDp/nQRqVnrMczSJDxRDJMow github.com/nishanths/exhaustive v0.8.3/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= 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.6.0 h1:9t9b9vRUbFq3C4qKFCGkVuq/fIHji802N1nrtkh1mNc= github.com/onsi/ginkgo/v2 v2.6.0/go.mod h1:63DOGlLAH8+REH8jUGdL3YpCpu7JODesutUjdENfUAc= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E= github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -628,7 +615,6 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -719,7 +705,6 @@ github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0H github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -812,20 +797,17 @@ go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5/go.mod h1:nmDLcffg48OtT/PSW0H go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= @@ -881,7 +863,6 @@ golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -904,7 +885,6 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -918,7 +898,6 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -932,8 +911,8 @@ golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -973,7 +952,6 @@ golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde h1:ejfdSekXMDxDLbRrJMwUk6Kn golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -984,11 +962,8 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1013,7 +988,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1055,13 +1029,13 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= +golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1072,8 +1046,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1147,7 +1121,6 @@ golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201230224404-63754364767c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1361,13 +1334,11 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -1394,16 +1365,16 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.3.3 h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA= honnef.co/go/tools v0.3.3/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= -k8s.io/api v0.25.2 h1:v6G8RyFcwf0HR5jQGIAYlvtRNrxMJQG1xJzaSeVnIS8= -k8s.io/api v0.25.2/go.mod h1:qP1Rn4sCVFwx/xIhe+we2cwBLTXNcheRyYXwajonhy0= +k8s.io/api v0.25.3 h1:Q1v5UFfYe87vi5H7NU0p4RXC26PPMT8KOpr1TLQbCMQ= +k8s.io/api v0.25.3/go.mod h1:o42gKscFrEVjHdQnyRenACrMtbuJsVdP+WVjqejfzmI= k8s.io/apiextensions-apiserver v0.25.0 h1:CJ9zlyXAbq0FIW8CD7HHyozCMBpDSiH7EdrSTCZcZFY= k8s.io/apiextensions-apiserver v0.25.0/go.mod h1:3pAjZiN4zw7R8aZC5gR0y3/vCkGlAjCazcg1me8iB/E= -k8s.io/apimachinery v0.25.2 h1:WbxfAjCx+AeN8Ilp9joWnyJ6xu9OMeS/fsfjK/5zaQs= -k8s.io/apimachinery v0.25.2/go.mod h1:hqqA1X0bsgsxI6dXsJ4HnNTBOmJNxyPp8dw3u2fSHwA= +k8s.io/apimachinery v0.25.3 h1:7o9ium4uyUOM76t6aunP0nZuex7gDf8VGwkR5RcJnQc= +k8s.io/apimachinery v0.25.3/go.mod h1:jaF9C/iPNM1FuLl7Zuy5b9v+n35HGSh6AQ4HYRkCqwo= k8s.io/apiserver v0.25.0 h1:8kl2ifbNffD440MyvHtPaIz1mw4mGKVgWqM0nL+oyu4= k8s.io/apiserver v0.25.0/go.mod h1:BKwsE+PTC+aZK+6OJQDPr0v6uS91/HWxX7evElAH6xo= -k8s.io/client-go v0.25.2 h1:SUPp9p5CwM0yXGQrwYurw9LWz+YtMwhWd0GqOsSiefo= -k8s.io/client-go v0.25.2/go.mod h1:i7cNU7N+yGQmJkewcRD2+Vuj4iz7b30kI8OcL3horQ4= +k8s.io/client-go v0.25.3 h1:oB4Dyl8d6UbfDHD8Bv8evKylzs3BXzzufLiO27xuPs0= +k8s.io/client-go v0.25.3/go.mod h1:t39LPczAIMwycjcXkVc+CB+PZV69jQuNx4um5ORDjQA= k8s.io/cluster-bootstrap v0.25.0 h1:KJ2/r0dV+bLfTK5EBobAVKvjGel3N4Qqh3bvnzh9qPk= k8s.io/cluster-bootstrap v0.25.0/go.mod h1:x/TCtY3EiuR/rODkA3SvVQT3uSssQLf9cXcmSjdDTe0= k8s.io/component-base v0.25.0 h1:haVKlLkPCFZhkcqB6WCvpVxftrg6+FK5x1ZuaIDaQ5Y= @@ -1428,14 +1399,14 @@ mvdan.cc/unparam v0.0.0-20220706161116-678bad134442/go.mod h1:F/Cxw/6mVrNKqrR2Yj rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/cluster-api v1.3.3 h1:sHRAbuev6+bz3OAySmdmT62md/D/UUIy0EYwvP38H/4= -sigs.k8s.io/cluster-api v1.3.3/go.mod h1:nnXmR51rHshpMEXmB4LZIwdiXWKXV6yaooB1KzrL0Qs= +sigs.k8s.io/cluster-api v1.3.5 h1:Chg56Piv5ip0AFRN83H1I8uIn6qsdk+mr9hdq5Cxkf0= +sigs.k8s.io/cluster-api v1.3.5/go.mod h1:9FNHNItE5c+klfDLNG3+ApSTX0H4yGAumdbFJMnk6Vc= sigs.k8s.io/controller-runtime v0.13.1 h1:tUsRCSJVM1QQOOeViGeX3GMT3dQF1eePPw6sEE3xSlg= sigs.k8s.io/controller-runtime v0.13.1/go.mod h1:Zbz+el8Yg31jubvAEyglRZGdLAjplZl+PgtYNI6WNTI= -sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20211110210527-619e6b92dab9 h1:ylYUI5uaq/guUFerFRVG81FHSA5/3+fERCE1RQbQUZ4= -sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20211110210527-619e6b92dab9/go.mod h1:+sJcI1F0QI0Cv+8fp5rH5B2fK1LxzrAQqYnaPx9nY8I= -sigs.k8s.io/controller-tools v0.8.0 h1:uUkfTGEwrguqYYfcI2RRGUnC8mYdCFDqfwPKUcNJh1o= -sigs.k8s.io/controller-tools v0.8.0/go.mod h1:qE2DXhVOiEq5ijmINcFbqi9GZrrUjzB1TuJU0xa6eoY= +sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20230307042619-c304e7ec2ee7 h1:IxfIt+FAgOU9Dzg+SsPPFyHayYcC/OMsQQ6nPILxf5o= +sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20230307042619-c304e7ec2ee7/go.mod h1:Lm5xRgQejdMHAz81exSpqvwEkIdTfoNtUDA6MM4kltw= +sigs.k8s.io/controller-tools v0.10.0 h1:0L5DTDTFB67jm9DkfrONgTGmfc/zYow0ZaHyppizU2U= +sigs.k8s.io/controller-tools v0.10.0/go.mod h1:uvr0EW6IsprfB0jpQq6evtKy+hHyHCXNfdWI5ONPx94= sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k= sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/kind v0.17.0 h1:CScmGz/wX66puA06Gj8OZb76Wmk7JIjgWf5JDvY7msM= diff --git a/manifest/manifest.yaml b/manifest/manifest.yaml index 2c0690f7..66b1707f 100644 --- a/manifest/manifest.yaml +++ b/manifest/manifest.yaml @@ -9,7 +9,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: clusterconfigurations.config.projectsveltos.io spec: @@ -176,6 +176,7 @@ spec: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic version: description: Version of the resource deployed in the Cluster. @@ -207,18 +208,12 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: clusterprofiles.config.projectsveltos.io spec: @@ -250,6 +245,70 @@ spec: spec: description: ClusterProfileSpec defines the desired state of ClusterProfile properties: + clusterRefs: + description: ClusterRefs identifies clusters to associate to. + items: + description: "ObjectReference contains enough information to let + you inspect or modify the referred object. --- New uses of this + type are discouraged because of difficulty describing its usage + when embedded in APIs. 1. Ignored fields. It includes many fields + which are not generally honored. For instance, ResourceVersion + and FieldPath are both very rarely valid in actual usage. 2. Invalid + usage help. It is impossible to add specific help for individual + usage. In most embedded usages, there are particular restrictions + like, \"must refer only to types A and B\" or \"UID not honored\" + or \"name must be restricted\". Those cannot be well described + when embedded. 3. Inconsistent validation. Because the usages + are different, the validation rules are different by usage, which + makes it hard for users to predict what will happen. 4. The fields + are both imprecise and overly precise. Kind is not a precise + mapping to a URL. This can produce ambiguity during interpretation + and require a REST mapping. In most cases, the dependency is + on the group,resource tuple and the version of the actual struct + is irrelevant. 5. We cannot easily change it. Because this type + is embedded in many locations, updates to this type will affect + numerous schemas. Don't make new APIs embed an underspecified + API type they do not control. \n Instead of using this type, create + a locally provided and used type that is well-focused on your + reference. For example, ServiceReferences for admission registration: + https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 + ." + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of + an entire object, this string should contain a valid JSON/Go + field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within + a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" + (container with index 2 in this pod). This syntax is chosen + only to have some well-defined way of referencing a part of + an object. TODO: this design is not final and this field is + subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic + type: array clusterSelector: description: ClusterSelector identifies clusters to associate to. type: string @@ -328,6 +387,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic values: description: 'Values holds the values for this Helm release. Go templating with the values from the referenced CAPI Cluster. @@ -404,8 +464,6 @@ spec: - ContinuousWithDriftDetection - DryRun type: string - required: - - clusterSelector type: object status: description: ClusterProfileStatus defines the observed state of ClusterProfile @@ -473,6 +531,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic type: array type: object type: object @@ -480,18 +539,12 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: clusterreports.config.projectsveltos.io spec: @@ -657,6 +710,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic version: description: Version of the resource deployed in the Cluster. minLength: 1 @@ -678,18 +732,12 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: clustersummaries.config.projectsveltos.io spec: @@ -733,6 +781,72 @@ spec: description: ClusterProfileSpec represent the configuration that will be applied to the workload cluster. properties: + clusterRefs: + description: ClusterRefs identifies clusters to associate to. + items: + description: "ObjectReference contains enough information to + let you inspect or modify the referred object. --- New uses + of this type are discouraged because of difficulty describing + its usage when embedded in APIs. 1. Ignored fields. It includes + many fields which are not generally honored. For instance, + ResourceVersion and FieldPath are both very rarely valid in + actual usage. 2. Invalid usage help. It is impossible to + add specific help for individual usage. In most embedded + usages, there are particular restrictions like, \"must refer + only to types A and B\" or \"UID not honored\" or \"name must + be restricted\". Those cannot be well described when embedded. + 3. Inconsistent validation. Because the usages are different, + the validation rules are different by usage, which makes it + hard for users to predict what will happen. 4. The fields + are both imprecise and overly precise. Kind is not a precise + mapping to a URL. This can produce ambiguity during interpretation + and require a REST mapping. In most cases, the dependency + is on the group,resource tuple and the version of the actual + struct is irrelevant. 5. We cannot easily change it. Because + this type is embedded in many locations, updates to this type + will affect numerous schemas. Don't make new APIs embed an + underspecified API type they do not control. \n Instead of + using this type, create a locally provided and used type that + is well-focused on your reference. For example, ServiceReferences + for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 + ." + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a valid + JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that + triggered the event) or if no container name is specified + "spec.containers[2]" (container with index 2 in this pod). + This syntax is chosen only to have some well-defined way + of referencing a part of an object. TODO: this design + is not final and this field is subject to change in the + future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic + type: array clusterSelector: description: ClusterSelector identifies clusters to associate to. @@ -813,6 +927,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic values: description: 'Values holds the values for this Helm release. Go templating with the values from the referenced CAPI @@ -890,8 +1005,6 @@ spec: - ContinuousWithDriftDetection - DryRun type: string - required: - - clusterSelector type: object clusterType: description: ClusterType is the type of Cluster @@ -996,12 +1109,6 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] --- apiVersion: v1 kind: ServiceAccount