diff --git a/api/v1alpha1/addoncompliance_type.go b/api/v1alpha1/addoncompliance_type.go deleted file mode 100644 index fd61999..0000000 --- a/api/v1alpha1/addoncompliance_type.go +++ /dev/null @@ -1,123 +0,0 @@ -/* -Copyright 2023. 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 v1alpha1 - -import ( - "fmt" - "strings" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -const ( - // AddonComplianceFinalizer finalizer for AddonCompliance instances - AddonComplianceFinalizer = "addoncompliancefinalizer.projectsveltos.io" - - AddonComplianceKind = "AddonCompliance" -) - -// A label with this key is added to AddonCompliance instances for each matching cluster -func GetClusterLabel(clusterNamespace, clusterName string, clusterType *ClusterType) string { - return fmt.Sprintf("%s--%s--%s", - strings.ToLower(string(*clusterType)), clusterNamespace, clusterName) -} - -// GetClusterAnnotation returns the annotation added on each cluster that indicates -// addon compliances for this cluster, if any, are ready -func GetClusterAnnotation() string { - return "addon-compliance-ready" -} - -type LuaValidationRef struct { - // Namespace of the referenced resource. - // +kubebuilder:validation:MinLength=1 - Namespace string `json:"namespace"` - - // Name of the referenced resource. - // +kubebuilder:validation:MinLength=1 - Name string `json:"name"` - - // Kind of the resource. Supported kinds are: - // - flux GitRepository;OCIRepository;Bucket - // - ConfigMap/Secret - // +kubebuilder:validation:Enum=GitRepository;OCIRepository;Bucket;ConfigMap;Secret - Kind string `json:"kind"` - - // Path to the directory containing the lua validations. - // Defaults to 'None', which translates to the root path of the SourceRef. - // Ignored for ConfigMap/Secret. - // +optional - Path string `json:"path,omitempty"` -} - -// AddonComplianceSpec defines the desired state of AddonCompliance -type AddonComplianceSpec struct { - // ClusterSelector identifies clusters to associate to. - // +optional - ClusterSelector Selector `json:"clusterSelector,omitempty"` - - // ClusterRefs identifies clusters to associate to. - // +optional - ClusterRefs []corev1.ObjectReference `json:"clusterRefs,omitempty"` - - // LuaValidationRefs is a list of validations defined in Lua language. In the matching clusters, - // add-ons will be deployed only if all validations pass. - // +omitempty - LuaValidationRefs []LuaValidationRef `json:"luaValidationRefs,omitempty"` -} - -// AddonComplianceStatus defines the observed state of AddonCompliance -type AddonComplianceStatus struct { - // MatchingClusterRefs reference all the clusters currently matching - // ClusterSelector - MatchingClusterRefs []corev1.ObjectReference `json:"matchingClusters,omitempty"` - - // LuaValidations contains all validations collected from all existing - // referenced resources - LuaValidations map[string][]byte `json:"luaValidations,omitempty"` - - // FailureMessage provides more information if an error occurs. - // +optional - FailureMessage *string `json:"failureMessage,omitempty"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:resource:path=addoncompliances,scope=Cluster -//+kubebuilder:subresource:status - -// AddonCompliance is the Schema for the AddonCompliance API -type AddonCompliance struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AddonComplianceSpec `json:"spec,omitempty"` - Status AddonComplianceStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// AddonComplianceList contains a list of AddonCompliances -type AddonComplianceList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AddonCompliance `json:"items"` -} - -func init() { - SchemeBuilder.Register(&AddonCompliance{}, &AddonComplianceList{}) -} diff --git a/api/v1alpha1/debuggingconfiguration_types.go b/api/v1alpha1/debuggingconfiguration_types.go index 32fc51e..f2cd50f 100644 --- a/api/v1alpha1/debuggingconfiguration_types.go +++ b/api/v1alpha1/debuggingconfiguration_types.go @@ -42,7 +42,7 @@ const ( ) //nolint:lll // kubebuilder marker -// +kubebuilder:validation:Enum:=AddonManager;AddonComplianceManager;Classifier;ClassifierAgent;SveltosClusterManager;DriftDetectionManager;AccessManager;HealthCheckManager;EventManager +// +kubebuilder:validation:Enum:=AddonManager;Classifier;ClassifierAgent;SveltosClusterManager;DriftDetectionManager;AccessManager;HealthCheckManager;EventManager type Component string @@ -50,9 +50,6 @@ const ( // ComponentAddonManager is the addon-manager pod ComponentAddonManager = Component("AddonManager") - // AddonComplianceManager is the addon-conmpliance pod - ComponentAddonComplianceManager = Component("AddonComplianceManager") - // Classifier is the classifier pod ComponentClassifier = Component("Classifier") diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index e6b8b48..1c74a06 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -126,130 +126,6 @@ func (in *AccessRequestStatus) DeepCopy() *AccessRequestStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddonCompliance) DeepCopyInto(out *AddonCompliance) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonCompliance. -func (in *AddonCompliance) DeepCopy() *AddonCompliance { - if in == nil { - return nil - } - out := new(AddonCompliance) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AddonCompliance) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddonComplianceList) DeepCopyInto(out *AddonComplianceList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AddonCompliance, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonComplianceList. -func (in *AddonComplianceList) DeepCopy() *AddonComplianceList { - if in == nil { - return nil - } - out := new(AddonComplianceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AddonComplianceList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddonComplianceSpec) DeepCopyInto(out *AddonComplianceSpec) { - *out = *in - if in.ClusterRefs != nil { - in, out := &in.ClusterRefs, &out.ClusterRefs - *out = make([]v1.ObjectReference, len(*in)) - copy(*out, *in) - } - if in.LuaValidationRefs != nil { - in, out := &in.LuaValidationRefs, &out.LuaValidationRefs - *out = make([]LuaValidationRef, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonComplianceSpec. -func (in *AddonComplianceSpec) DeepCopy() *AddonComplianceSpec { - if in == nil { - return nil - } - out := new(AddonComplianceSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddonComplianceStatus) DeepCopyInto(out *AddonComplianceStatus) { - *out = *in - if in.MatchingClusterRefs != nil { - in, out := &in.MatchingClusterRefs, &out.MatchingClusterRefs - *out = make([]v1.ObjectReference, len(*in)) - copy(*out, *in) - } - if in.LuaValidations != nil { - in, out := &in.LuaValidations, &out.LuaValidations - *out = make(map[string][]byte, len(*in)) - for key, val := range *in { - var outVal []byte - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = make([]byte, len(*in)) - copy(*out, *in) - } - (*out)[key] = outVal - } - } - if in.FailureMessage != nil { - in, out := &in.FailureMessage, &out.FailureMessage - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonComplianceStatus. -func (in *AddonComplianceStatus) DeepCopy() *AddonComplianceStatus { - if in == nil { - return nil - } - out := new(AddonComplianceStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Classifier) DeepCopyInto(out *Classifier) { *out = *in @@ -1214,21 +1090,6 @@ func (in *LivenessCheck) DeepCopy() *LivenessCheck { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LuaValidationRef) DeepCopyInto(out *LuaValidationRef) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LuaValidationRef. -func (in *LuaValidationRef) DeepCopy() *LuaValidationRef { - if in == nil { - return nil - } - out := new(LuaValidationRef) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachingClusterStatus) DeepCopyInto(out *MachingClusterStatus) { *out = *in diff --git a/config/crd/bases/lib.projectsveltos.io_addoncompliances.yaml b/config/crd/bases/lib.projectsveltos.io_addoncompliances.yaml deleted file mode 100644 index 8e9cd5b..0000000 --- a/config/crd/bases/lib.projectsveltos.io_addoncompliances.yaml +++ /dev/null @@ -1,224 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.12.0 - name: addoncompliances.lib.projectsveltos.io -spec: - group: lib.projectsveltos.io - names: - kind: AddonCompliance - listKind: AddonComplianceList - plural: addoncompliances - singular: addoncompliance - scope: Cluster - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: AddonCompliance is the Schema for the AddonCompliance API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: AddonComplianceSpec defines the desired state of AddonCompliance - 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 - luaValidationRefs: - description: LuaValidationRefs is a list of validations defined in - Lua language. In the matching clusters, add-ons will be deployed - only if all validations pass. - items: - properties: - kind: - description: 'Kind of the resource. Supported kinds are: - flux - GitRepository;OCIRepository;Bucket - ConfigMap/Secret' - enum: - - GitRepository - - OCIRepository - - Bucket - - ConfigMap - - Secret - type: string - name: - description: Name of the referenced resource. - minLength: 1 - type: string - namespace: - description: Namespace of the referenced resource. - minLength: 1 - type: string - path: - description: Path to the directory containing the lua validations. - Defaults to 'None', which translates to the root path of the - SourceRef. Ignored for ConfigMap/Secret. - type: string - required: - - kind - - name - - namespace - type: object - type: array - type: object - status: - description: AddonComplianceStatus defines the observed state of AddonCompliance - properties: - failureMessage: - description: FailureMessage provides more information if an error - occurs. - type: string - luaValidations: - additionalProperties: - format: byte - type: string - description: LuaValidations contains all validations collected from - all existing referenced resources - type: object - matchingClusters: - description: MatchingClusterRefs reference all the clusters currently - matching ClusterSelector - 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 - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml b/config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml index 579ec19..e6d7f1b 100644 --- a/config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml +++ b/config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml @@ -47,7 +47,6 @@ spec: configuration applies to. enum: - AddonManager - - AddonComplianceManager - Classifier - ClassifierAgent - SveltosClusterManager diff --git a/generator.go b/generator.go index ffa0094..6ee4c4c 100644 --- a/generator.go +++ b/generator.go @@ -125,9 +125,6 @@ func main() { eventReportFile := "../../config/crd/bases/lib.projectsveltos.io_eventreports.yaml" generate(eventReportFile, "eventreports", "EventReport") - addonComplianceFile := "../../config/crd/bases/lib.projectsveltos.io_addoncompliances.yaml" - generate(addonComplianceFile, "addoncompliances", "AddonCompliance") - reloaderFile := "../../config/crd/bases/lib.projectsveltos.io_reloaders.yaml" generate(reloaderFile, "reloaders", "Reloader") diff --git a/lib/crd/addoncompliances.go b/lib/crd/addoncompliances.go deleted file mode 100644 index 42637d3..0000000 --- a/lib/crd/addoncompliances.go +++ /dev/null @@ -1,244 +0,0 @@ -// Generated by *go generate* - DO NOT EDIT -/* -Copyright 2022-23. 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 crd - -var AddonComplianceFile = "../../config/crd/bases/lib.projectsveltos.io_addoncompliances.yaml" -var AddonComplianceCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.12.0 - name: addoncompliances.lib.projectsveltos.io -spec: - group: lib.projectsveltos.io - names: - kind: AddonCompliance - listKind: AddonComplianceList - plural: addoncompliances - singular: addoncompliance - scope: Cluster - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: AddonCompliance is the Schema for the AddonCompliance API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: AddonComplianceSpec defines the desired state of AddonCompliance - 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 - luaValidationRefs: - description: LuaValidationRefs is a list of validations defined in - Lua language. In the matching clusters, add-ons will be deployed - only if all validations pass. - items: - properties: - kind: - description: 'Kind of the resource. Supported kinds are: - flux - GitRepository;OCIRepository;Bucket - ConfigMap/Secret' - enum: - - GitRepository - - OCIRepository - - Bucket - - ConfigMap - - Secret - type: string - name: - description: Name of the referenced resource. - minLength: 1 - type: string - namespace: - description: Namespace of the referenced resource. - minLength: 1 - type: string - path: - description: Path to the directory containing the lua validations. - Defaults to 'None', which translates to the root path of the - SourceRef. Ignored for ConfigMap/Secret. - type: string - required: - - kind - - name - - namespace - type: object - type: array - type: object - status: - description: AddonComplianceStatus defines the observed state of AddonCompliance - properties: - failureMessage: - description: FailureMessage provides more information if an error - occurs. - type: string - luaValidations: - additionalProperties: - format: byte - type: string - description: LuaValidations contains all validations collected from - all existing referenced resources - type: object - matchingClusters: - description: MatchingClusterRefs reference all the clusters currently - matching ClusterSelector - 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 - type: object - type: object - served: true - storage: true - subresources: - status: {} -`) diff --git a/lib/crd/crd.go b/lib/crd/crd.go index 82c9f10..a36141e 100644 --- a/lib/crd/crd.go +++ b/lib/crd/crd.go @@ -66,10 +66,6 @@ func GetEventReportCRDYAML() []byte { return EventReportCRD } -func GetAddonComplianceCRDYAML() []byte { - return AddonComplianceCRD -} - func GetReloaderCRDYAML() []byte { return ReloaderCRD } diff --git a/lib/crd/crd_test.go b/lib/crd/crd_test.go index ea2c3b5..9c8be96 100644 --- a/lib/crd/crd_test.go +++ b/lib/crd/crd_test.go @@ -146,16 +146,6 @@ var _ = Describe("CRD", func() { Expect(string(yaml)).To(Equal(string(currentFile))) }) - It("Gets the AddonCompliance CustomResourceDefinition", func() { - yaml := crd.GetAddonComplianceCRDYAML() - - filename := "../../config/crd/bases/lib.projectsveltos.io_addoncompliances.yaml" - currentFile, err := os.ReadFile(filename) - Expect(err).To(BeNil()) - - Expect(string(yaml)).To(Equal(string(currentFile))) - }) - It("Gets the Reloader CustomResourceDefinition", func() { yaml := crd.GetReloaderCRDYAML() diff --git a/lib/crd/debuggingconfigurations.go b/lib/crd/debuggingconfigurations.go index 4fdc2c6..d154b9a 100644 --- a/lib/crd/debuggingconfigurations.go +++ b/lib/crd/debuggingconfigurations.go @@ -66,7 +66,6 @@ spec: configuration applies to. enum: - AddonManager - - AddonComplianceManager - Classifier - ClassifierAgent - SveltosClusterManager