diff --git a/Makefile b/Makefile index 4fab4b3..cfdb076 100644 --- a/Makefile +++ b/Makefile @@ -85,8 +85,9 @@ help: ## Display this help. ##@ Development .PHONY: manifests -manifests: $(CONTROLLER_GEN) ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. - $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases +manifests: $(CONTROLLER_GEN) $(KUSTOMIZE) ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. + $(CONTROLLER_GEN) rbac:roleName=manager-role crd paths="./..." output:crd:artifacts:config=config/crd/bases + $(KUSTOMIZE) build config/default -o manifests ## Generate go code for library. crds: generate ## Generates go code (crds) for library diff --git a/api/v1alpha1/clusterhealthcheck_conversion.go b/api/v1alpha1/clusterhealthcheck_conversion.go new file mode 100644 index 0000000..eda69d9 --- /dev/null +++ b/api/v1alpha1/clusterhealthcheck_conversion.go @@ -0,0 +1,121 @@ +/* +Copyright 2024. 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 ( + "encoding/json" + "fmt" + + "sigs.k8s.io/controller-runtime/pkg/conversion" + + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" + logs "github.com/projectsveltos/libsveltos/lib/logsettings" +) + +// ConvertTo converts v1alpha1 to the Hub version (v1beta1). +func (src *ClusterHealthCheck) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*libsveltosv1beta1.ClusterHealthCheck) + + configlog.V(logs.LogInfo).Info("convert ClusterHealthCheck from v1alpha1 to v1beta1") + + dst.ObjectMeta = src.ObjectMeta + + jsonData, err := json.Marshal(src.Spec.LivenessChecks) // Marshal the LivenessChecks field + if err != nil { + return fmt.Errorf("error marshaling Spec.LivenessChecks: %w", err) + } + err = json.Unmarshal(jsonData, &dst.Spec.LivenessChecks) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + + jsonData, err = json.Marshal(src.Spec.Notifications) // Marshal the Notifications field + if err != nil { + return fmt.Errorf("error marshaling Spec.Notifications: %w", err) + } + err = json.Unmarshal(jsonData, &dst.Spec.Notifications) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + + selector, err := convertV1Alpha1SelectorToV1Beta1(&src.Spec.ClusterSelector) + if err != nil { + configlog.V(logs.LogInfo).Info(fmt.Sprintf("failed to convert ClusterSelector: %v", err)) + return err + } + + dst.Spec.ClusterSelector = *selector + + jsonData, err = json.Marshal(src.Status) // Marshal the Status field + if err != nil { + return fmt.Errorf("error marshaling Status: %w", err) + } + + err = json.Unmarshal(jsonData, &dst.Status) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + + return nil +} + +// ConvertFrom converts from the Hub version (v1beta1) to this v1alpha1. +func (dst *ClusterHealthCheck) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*libsveltosv1beta1.ClusterHealthCheck) + + configlog.V(logs.LogInfo).Info("convert ClusterHealthCheck from v1beta1 to v1alpha1") + + dst.ObjectMeta = src.ObjectMeta + + jsonData, err := json.Marshal(src.Spec.LivenessChecks) // Marshal the LivenessChecks field + if err != nil { + return fmt.Errorf("error marshaling Spec.LivenessChecks: %w", err) + } + err = json.Unmarshal(jsonData, &dst.Spec.LivenessChecks) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + + jsonData, err = json.Marshal(src.Spec.Notifications) // Marshal the Notifications field + if err != nil { + return fmt.Errorf("error marshaling Spec.Notifications: %w", err) + } + err = json.Unmarshal(jsonData, &dst.Spec.Notifications) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + + selector, err := convertV1Beta1SelectorToV1Alpha1(&src.Spec.ClusterSelector) + if err != nil { + configlog.V(logs.LogInfo).Info(fmt.Sprintf("failed to convert ClusterSelector: %v", err)) + return err + } + + dst.Spec.ClusterSelector = selector + + jsonData, err = json.Marshal(src.Status) // Marshal the Status field + if err != nil { + return fmt.Errorf("error marshaling Status: %w", err) + } + + err = json.Unmarshal(jsonData, &dst.Status) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + + return nil +} diff --git a/api/v1alpha1/clusterhealthcheck_type.go b/api/v1alpha1/clusterhealthcheck_type.go index 153760f..f407b10 100644 --- a/api/v1alpha1/clusterhealthcheck_type.go +++ b/api/v1alpha1/clusterhealthcheck_type.go @@ -220,10 +220,6 @@ type ClusterHealthCheckSpec struct { // ClusterSelector identifies clusters to associate to (Deprecated use selector instead). ClusterSelector Selector `json:"clusterSelector"` - // Selector identifies clusters to associate to. - // +optional - Selector ClusterSelector `json:"selector,omitempty"` - // LivenessChecks is a list of source of liveness checks to evaluate. // Anytime one of those changes, notifications will be sent // +patchMergeKey=name diff --git a/api/v1alpha1/clusterset_conversion.go b/api/v1alpha1/clusterset_conversion.go new file mode 100644 index 0000000..1646516 --- /dev/null +++ b/api/v1alpha1/clusterset_conversion.go @@ -0,0 +1,68 @@ +/* +Copyright 2024. 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" + + "sigs.k8s.io/controller-runtime/pkg/conversion" + + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" + logs "github.com/projectsveltos/libsveltos/lib/logsettings" +) + +// ConvertTo converts v1alpha1 to the Hub version (v1beta1). +func (src *ClusterSet) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*libsveltosv1beta1.ClusterSet) + + configlog.V(logs.LogInfo).Info("convert ClusterSet from v1alpha1 to v1beta1") + + dst.ObjectMeta = src.ObjectMeta + + err := convertV1Alpha1SetSpecToV1Beta1(&src.Spec, &dst.Spec) + if err != nil { + return fmt.Errorf("error converting Spec: %w", err) + } + + err = convertV1Alpha1SetStatusToV1Beta1(&src.Status, &dst.Status) + if err != nil { + return fmt.Errorf("error converting Spec: %w", err) + } + + return nil +} + +// ConvertFrom converts from the Hub version (v1beta1) to this v1alpha1. +func (dst *ClusterSet) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*libsveltosv1beta1.ClusterSet) + + configlog.V(logs.LogInfo).Info("convert ClusterSet from v1beta1 to v1alpha1") + + dst.ObjectMeta = src.ObjectMeta + + err := convertV1Beta1SetSpecToV1Alpha1(&src.Spec, &dst.Spec) + if err != nil { + return fmt.Errorf("error converting Spec: %w", err) + } + + err = convertV1Beta1SetStatusToV1Alpha1(&src.Status, &dst.Status) + if err != nil { + return fmt.Errorf("error converting Status: %w", err) + } + + return nil +} diff --git a/api/v1alpha1/common_types.go b/api/v1alpha1/common_types.go index 1dfc1e6..b1c7e48 100644 --- a/api/v1alpha1/common_types.go +++ b/api/v1alpha1/common_types.go @@ -20,8 +20,6 @@ import ( "errors" corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" ) const ( @@ -73,15 +71,6 @@ var ( type Selector string -type ClusterSelector struct { - metav1.LabelSelector `json:",inline"` -} - -// ToSelector converts ClusterSelector to labels.Selector -func (cs *ClusterSelector) ToSelector() (labels.Selector, error) { - return metav1.LabelSelectorAsSelector(&cs.LabelSelector) -} - // +kubebuilder:validation:Enum:=Provisioning;Provisioned;Failed;Removing;Removed type SveltosFeatureStatus string diff --git a/api/v1alpha1/conversion_test.go b/api/v1alpha1/conversion_test.go new file mode 100644 index 0000000..32397a9 --- /dev/null +++ b/api/v1alpha1/conversion_test.go @@ -0,0 +1,213 @@ +/* +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 v1alpha1_test + +import ( + "fmt" + "reflect" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/cluster-api/util" + + libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" +) + +var _ = Describe("Conversion", func() { + Context("Convert from v1alpha1 to v1beta1 and back", func() { + It("ClusterHealthCheck conversion", func() { + key := randomString() + value := randomString() + + clusterHealthCheck := libsveltosv1alpha1.ClusterHealthCheck{ + ObjectMeta: metav1.ObjectMeta{ + Name: randomString(), + }, + Spec: libsveltosv1alpha1.ClusterHealthCheckSpec{ + ClusterSelector: libsveltosv1alpha1.Selector(fmt.Sprintf("%s=%s", key, value)), + LivenessChecks: []libsveltosv1alpha1.LivenessCheck{ + { + Name: randomString(), + Type: libsveltosv1alpha1.LivenessTypeHealthCheck, + LivenessSourceRef: &corev1.ObjectReference{ + Name: randomString(), + Kind: string(libsveltosv1alpha1.ConfigMapReferencedResourceKind), + Namespace: randomString(), + }, + }, + }, + Notifications: []libsveltosv1alpha1.Notification{ + { + Name: randomString(), + Type: libsveltosv1alpha1.NotificationTypeDiscord, + NotificationRef: &corev1.ObjectReference{ + Namespace: randomString(), + Name: randomString(), + Kind: string(libsveltosv1alpha1.SecretReferencedResourceKind), + }, + }, + }, + }, + } + + dst := &libsveltosv1beta1.ClusterHealthCheck{} + Expect(clusterHealthCheck.ConvertTo(dst)).To(Succeed()) + + Expect(len(dst.Spec.ClusterSelector.LabelSelector.MatchLabels)).To(Equal(1)) + Expect(dst.Spec.ClusterSelector.LabelSelector.MatchLabels[key]).To(Equal(value)) + + final := &libsveltosv1alpha1.ClusterHealthCheck{} + Expect(final.ConvertFrom(dst)).To(Succeed()) + + Expect(reflect.DeepEqual(final.ObjectMeta, clusterHealthCheck.ObjectMeta)).To(BeTrue()) + Expect(reflect.DeepEqual(final.Spec.LivenessChecks, clusterHealthCheck.Spec.LivenessChecks)).To(BeTrue()) + Expect(reflect.DeepEqual(final.Spec.Notifications, clusterHealthCheck.Spec.Notifications)).To(BeTrue()) + Expect(reflect.DeepEqual(final.Status, clusterHealthCheck.Status)).To(BeTrue()) + }) + + It("ClusterSet conversion", func() { + key := randomString() + value := randomString() + + clusterSet := libsveltosv1alpha1.ClusterSet{ + ObjectMeta: metav1.ObjectMeta{ + Name: randomString(), + }, + Spec: libsveltosv1alpha1.Spec{ + ClusterSelector: libsveltosv1alpha1.Selector(fmt.Sprintf("%s=%s", key, value)), + ClusterRefs: []corev1.ObjectReference{ + { + Kind: libsveltosv1alpha1.SveltosClusterKind, + Namespace: randomString(), + Name: randomString(), + }, + }, + MaxReplicas: 1, + }, + } + + dst := &libsveltosv1beta1.ClusterSet{} + Expect(clusterSet.ConvertTo(dst)).To(Succeed()) + + Expect(len(dst.Spec.ClusterSelector.LabelSelector.MatchLabels)).To(Equal(1)) + Expect(dst.Spec.ClusterSelector.LabelSelector.MatchLabels[key]).To(Equal(value)) + + final := &libsveltosv1alpha1.ClusterSet{} + Expect(final.ConvertFrom(dst)).To(Succeed()) + + Expect(reflect.DeepEqual(final.ObjectMeta, clusterSet.ObjectMeta)).To(BeTrue()) + Expect(reflect.DeepEqual(final.Spec.ClusterRefs, clusterSet.Spec.ClusterRefs)).To(BeTrue()) + Expect(final.Spec.MaxReplicas).To(Equal(clusterSet.Spec.MaxReplicas)) + Expect(reflect.DeepEqual(final.Status, clusterSet.Status)).To(BeTrue()) + }) + + It("ClusterSet conversion", func() { + key1 := randomString() + value1 := randomString() + key2 := randomString() + value2 := randomString() + + set := libsveltosv1alpha1.Set{ + ObjectMeta: metav1.ObjectMeta{ + Name: randomString(), + }, + Spec: libsveltosv1alpha1.Spec{ + ClusterSelector: libsveltosv1alpha1.Selector(fmt.Sprintf("%s=%s,%s=%s", key1, value1, key2, value2)), + ClusterRefs: []corev1.ObjectReference{ + { + Kind: libsveltosv1alpha1.SveltosClusterKind, + Namespace: randomString(), + Name: randomString(), + }, + }, + MaxReplicas: 1, + }, + } + + dst := &libsveltosv1beta1.Set{} + Expect(set.ConvertTo(dst)).To(Succeed()) + + Expect(len(dst.Spec.ClusterSelector.LabelSelector.MatchLabels)).To(Equal(2)) + Expect(dst.Spec.ClusterSelector.LabelSelector.MatchLabels[key1]).To(Equal(value1)) + Expect(dst.Spec.ClusterSelector.LabelSelector.MatchLabels[key2]).To(Equal(value2)) + + final := &libsveltosv1alpha1.Set{} + Expect(final.ConvertFrom(dst)).To(Succeed()) + + Expect(reflect.DeepEqual(final.ObjectMeta, set.ObjectMeta)).To(BeTrue()) + Expect(reflect.DeepEqual(final.Spec.ClusterRefs, set.Spec.ClusterRefs)).To(BeTrue()) + Expect(final.Spec.MaxReplicas).To(Equal(set.Spec.MaxReplicas)) + Expect(reflect.DeepEqual(final.Status, set.Status)).To(BeTrue()) + }) + + It("RoleRequest conversion", func() { + key := randomString() + value := randomString() + + expirationSeconds := int64(600) + + roleRequest := libsveltosv1alpha1.RoleRequest{ + ObjectMeta: metav1.ObjectMeta{ + Name: randomString(), + }, + Spec: libsveltosv1alpha1.RoleRequestSpec{ + ClusterSelector: libsveltosv1alpha1.Selector(fmt.Sprintf("%s=%s", key, value)), + RoleRefs: []libsveltosv1alpha1.PolicyRef{ + { + Kind: string(libsveltosv1alpha1.ConfigMapReferencedResourceKind), + Namespace: randomString(), + Name: randomString(), + }, + { + Kind: string(libsveltosv1alpha1.SecretReferencedResourceKind), + Namespace: randomString(), + Name: randomString(), + }, + }, + ExpirationSeconds: &expirationSeconds, + ServiceAccountName: randomString(), + ServiceAccountNamespace: randomString(), + }, + } + + dst := &libsveltosv1beta1.RoleRequest{} + Expect(roleRequest.ConvertTo(dst)).To(Succeed()) + + Expect(len(dst.Spec.ClusterSelector.LabelSelector.MatchLabels)).To(Equal(1)) + Expect(dst.Spec.ClusterSelector.LabelSelector.MatchLabels[key]).To(Equal(value)) + + final := &libsveltosv1alpha1.RoleRequest{} + Expect(final.ConvertFrom(dst)).To(Succeed()) + + Expect(reflect.DeepEqual(final.ObjectMeta, roleRequest.ObjectMeta)).To(BeTrue()) + Expect(reflect.DeepEqual(final.Spec.RoleRefs, roleRequest.Spec.RoleRefs)).To(BeTrue()) + Expect(final.Spec.ExpirationSeconds).To(Equal(roleRequest.Spec.ExpirationSeconds)) + Expect(final.Spec.ServiceAccountName).To(Equal(roleRequest.Spec.ServiceAccountName)) + Expect(final.Spec.ServiceAccountNamespace).To(Equal(roleRequest.Spec.ServiceAccountNamespace)) + Expect(reflect.DeepEqual(final.Status, roleRequest.Status)).To(BeTrue()) + }) + }) +}) + +func randomString() string { + const length = 10 + return util.RandomString(length) +} diff --git a/api/v1alpha1/conversion_utils.go b/api/v1alpha1/conversion_utils.go new file mode 100644 index 0000000..a461b6f --- /dev/null +++ b/api/v1alpha1/conversion_utils.go @@ -0,0 +1,105 @@ +/* +Copyright 2024. 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 ( + "encoding/json" + "fmt" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + logf "sigs.k8s.io/controller-runtime/pkg/log" + + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" + logs "github.com/projectsveltos/libsveltos/lib/logsettings" +) + +var ( + configlog = logf.Log.WithName("conversion") +) + +func convertV1Alpha1SelectorToV1Beta1(clusterSelector *Selector) (*libsveltosv1beta1.Selector, error) { + labelSelector, err := metav1.ParseToLabelSelector(string(*clusterSelector)) + if err != nil { + return nil, fmt.Errorf("error converting labels.Selector to metav1.Selector: %w", err) + } + return &libsveltosv1beta1.Selector{LabelSelector: *labelSelector}, nil +} + +func convertV1Beta1SelectorToV1Alpha1(clusterSelector *libsveltosv1beta1.Selector) (Selector, error) { + labelSelector, err := clusterSelector.ToSelector() + if err != nil { + return "", fmt.Errorf("failed to convert : %w", err) + } + + return Selector(labelSelector.String()), nil +} + +func convertV1Alpha1SetSpecToV1Beta1(srcSpec *Spec, dstSpec *libsveltosv1beta1.Spec) error { + dstSpec.ClusterRefs = srcSpec.ClusterRefs + dstSpec.MaxReplicas = srcSpec.MaxReplicas + + selector, err := convertV1Alpha1SelectorToV1Beta1(&srcSpec.ClusterSelector) + if err != nil { + configlog.V(logs.LogInfo).Info(fmt.Sprintf("failed to convert ClusterSelector: %v", err)) + return err + } + + dstSpec.ClusterSelector = *selector + return nil +} + +func convertV1Beta1SetSpecToV1Alpha1(srcSpec *libsveltosv1beta1.Spec, dstSpec *Spec) error { + dstSpec.ClusterRefs = srcSpec.ClusterRefs + dstSpec.MaxReplicas = srcSpec.MaxReplicas + + selector, err := convertV1Beta1SelectorToV1Alpha1(&srcSpec.ClusterSelector) + if err != nil { + configlog.V(logs.LogInfo).Info(fmt.Sprintf("failed to convert ClusterSelector: %v", err)) + return err + } + + dstSpec.ClusterSelector = selector + + return nil +} + +func convertV1Alpha1SetStatusToV1Beta1(srcStatus *Status, dstStatus *libsveltosv1beta1.Status) error { + jsonData, err := json.Marshal(srcStatus) // Marshal the Status field + if err != nil { + return fmt.Errorf("error marshaling Status: %w", err) + } + + err = json.Unmarshal(jsonData, &dstStatus) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + + return nil +} + +func convertV1Beta1SetStatusToV1Alpha1(srcStatus *libsveltosv1beta1.Status, dstStatus *Status) error { + jsonData, err := json.Marshal(srcStatus) // Marshal the Status field + if err != nil { + return fmt.Errorf("error marshaling Status: %w", err) + } + + err = json.Unmarshal(jsonData, &dstStatus) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + return nil +} diff --git a/api/v1alpha1/rolerequest_conversion.go b/api/v1alpha1/rolerequest_conversion.go new file mode 100644 index 0000000..9f21772 --- /dev/null +++ b/api/v1alpha1/rolerequest_conversion.go @@ -0,0 +1,113 @@ +/* +Copyright 2024. 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 ( + "encoding/json" + "fmt" + + "sigs.k8s.io/controller-runtime/pkg/conversion" + + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" + logs "github.com/projectsveltos/libsveltos/lib/logsettings" +) + +// ConvertTo converts v1alpha1 to the Hub version (v1beta1). +func (src *RoleRequest) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*libsveltosv1beta1.RoleRequest) + + configlog.V(logs.LogInfo).Info("convert RoleRequest from v1alpha1 to v1beta1") + + dst.ObjectMeta = src.ObjectMeta + + dst.Spec.ExpirationSeconds = src.Spec.ExpirationSeconds + + jsonData, err := json.Marshal(src.Spec.RoleRefs) // Marshal the RoleRefs field + if err != nil { + return fmt.Errorf("error marshaling Spec.RoleRefs: %w", err) + } + err = json.Unmarshal(jsonData, &dst.Spec.RoleRefs) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + + dst.Spec.ServiceAccountName = src.Spec.ServiceAccountName + dst.Spec.ServiceAccountNamespace = src.Spec.ServiceAccountNamespace + + selector, err := convertV1Alpha1SelectorToV1Beta1(&src.Spec.ClusterSelector) + if err != nil { + configlog.V(logs.LogInfo).Info(fmt.Sprintf("failed to convert ClusterSelector: %v", err)) + return err + } + + dst.Spec.ClusterSelector = *selector + + jsonData, err = json.Marshal(src.Status) // Marshal the Status field + if err != nil { + return fmt.Errorf("error marshaling Status: %w", err) + } + + err = json.Unmarshal(jsonData, &dst.Status) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + + return nil +} + +// ConvertFrom converts from the Hub version (v1beta1) to this v1alpha1. +func (dst *RoleRequest) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*libsveltosv1beta1.RoleRequest) + + configlog.V(logs.LogInfo).Info("convert RoleRequest from v1beta1 to v1alpha1") + + dst.ObjectMeta = src.ObjectMeta + + dst.Spec.ExpirationSeconds = src.Spec.ExpirationSeconds + + jsonData, err := json.Marshal(src.Spec.RoleRefs) // Marshal the RoleRefs field + if err != nil { + return fmt.Errorf("error marshaling Spec.RoleRefs: %w", err) + } + err = json.Unmarshal(jsonData, &dst.Spec.RoleRefs) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + + dst.Spec.ServiceAccountName = src.Spec.ServiceAccountName + dst.Spec.ServiceAccountNamespace = src.Spec.ServiceAccountNamespace + + selector, err := convertV1Beta1SelectorToV1Alpha1(&src.Spec.ClusterSelector) + if err != nil { + configlog.V(logs.LogInfo).Info(fmt.Sprintf("failed to convert ClusterSelector: %v", err)) + return err + } + + dst.Spec.ClusterSelector = selector + + jsonData, err = json.Marshal(src.Status) // Marshal the Status field + if err != nil { + return fmt.Errorf("error marshaling Status: %w", err) + } + + err = json.Unmarshal(jsonData, &dst.Status) // Unmarshal to v1beta1 type + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %w", err) + } + + return nil +} diff --git a/api/v1alpha1/rolerequest_type.go b/api/v1alpha1/rolerequest_type.go index ff4cf20..791a86c 100644 --- a/api/v1alpha1/rolerequest_type.go +++ b/api/v1alpha1/rolerequest_type.go @@ -39,10 +39,6 @@ type RoleRequestSpec struct { // in this instance will be granted (Deprecated use selector instead) ClusterSelector Selector `json:"clusterSelector"` - // Selector identifies clusters to associate to. - // +optional - Selector ClusterSelector `json:"selector,omitempty"` - // RoleRefs references all the Secret/ConfigMaps containing kubernetes // Roles/ClusterRoles that need to be deployed in the matching clusters. // +optional diff --git a/api/v1alpha1/set_conversion.go b/api/v1alpha1/set_conversion.go new file mode 100644 index 0000000..2706a92 --- /dev/null +++ b/api/v1alpha1/set_conversion.go @@ -0,0 +1,68 @@ +/* +Copyright 2024. 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" + + "sigs.k8s.io/controller-runtime/pkg/conversion" + + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" + logs "github.com/projectsveltos/libsveltos/lib/logsettings" +) + +// ConvertTo converts v1alpha1 to the Hub version (v1beta1). +func (src *Set) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*libsveltosv1beta1.Set) + + configlog.V(logs.LogInfo).Info("convert Set from v1alpha1 to v1beta1") + + dst.ObjectMeta = src.ObjectMeta + + err := convertV1Alpha1SetSpecToV1Beta1(&src.Spec, &dst.Spec) + if err != nil { + return fmt.Errorf("error converting Spec: %w", err) + } + + err = convertV1Alpha1SetStatusToV1Beta1(&src.Status, &dst.Status) + if err != nil { + return fmt.Errorf("error converting Spec: %w", err) + } + + return nil +} + +// ConvertFrom converts from the Hub version (v1beta1) to this v1alpha1. +func (dst *Set) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*libsveltosv1beta1.Set) + + configlog.V(logs.LogInfo).Info("convert Set from v1beta1 to v1alpha1") + + dst.ObjectMeta = src.ObjectMeta + + err := convertV1Beta1SetSpecToV1Alpha1(&src.Spec, &dst.Spec) + if err != nil { + return fmt.Errorf("error converting Spec: %w", err) + } + + err = convertV1Beta1SetStatusToV1Alpha1(&src.Status, &dst.Status) + if err != nil { + return fmt.Errorf("error converting Status: %w", err) + } + + return nil +} diff --git a/api/v1alpha1/spec.go b/api/v1alpha1/spec.go index 9b9d965..bc2bb12 100644 --- a/api/v1alpha1/spec.go +++ b/api/v1alpha1/spec.go @@ -25,10 +25,6 @@ type Spec struct { // +optional ClusterSelector Selector `json:"clusterSelector,omitempty"` - // Selector identifies clusters to associate to. - // +optional - Selector ClusterSelector `json:"selector,omitempty"` - // ClusterRefs identifies clusters to associate to. // +optional ClusterRefs []corev1.ObjectReference `json:"clusterRefs,omitempty"` diff --git a/api/v1alpha1/v1alpha1_suite_test.go b/api/v1alpha1/v1alpha1_suite_test.go new file mode 100644 index 0000000..d42e1d5 --- /dev/null +++ b/api/v1alpha1/v1alpha1_suite_test.go @@ -0,0 +1,29 @@ +/* +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 v1alpha1_test + +import ( + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +func TestControllers(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Controllers Suite") +} diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index d43f8e5..e13367d 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -444,7 +444,6 @@ func (in *ClusterHealthCheckList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterHealthCheckSpec) DeepCopyInto(out *ClusterHealthCheckSpec) { *out = *in - in.Selector.DeepCopyInto(&out.Selector) if in.LivenessChecks != nil { in, out := &in.LivenessChecks, &out.LivenessChecks *out = make([]LivenessCheck, len(*in)) @@ -524,22 +523,6 @@ func (in *ClusterInfo) DeepCopy() *ClusterInfo { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterSelector) DeepCopyInto(out *ClusterSelector) { - *out = *in - in.LabelSelector.DeepCopyInto(&out.LabelSelector) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSelector. -func (in *ClusterSelector) DeepCopy() *ClusterSelector { - if in == nil { - return nil - } - out := new(ClusterSelector) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterSet) DeepCopyInto(out *ClusterSet) { *out = *in @@ -1695,7 +1678,6 @@ func (in *RoleRequestList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RoleRequestSpec) DeepCopyInto(out *RoleRequestSpec) { *out = *in - in.Selector.DeepCopyInto(&out.Selector) if in.RoleRefs != nil { in, out := &in.RoleRefs, &out.RoleRefs *out = make([]PolicyRef, len(*in)) @@ -1812,7 +1794,6 @@ func (in *SetList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Spec) DeepCopyInto(out *Spec) { *out = *in - in.Selector.DeepCopyInto(&out.Selector) if in.ClusterRefs != nil { in, out := &in.ClusterRefs, &out.ClusterRefs *out = make([]v1.ObjectReference, len(*in)) diff --git a/api/v1beta1/accessrequest_type.go b/api/v1beta1/accessrequest_type.go new file mode 100644 index 0000000..ce5b298 --- /dev/null +++ b/api/v1beta1/accessrequest_type.go @@ -0,0 +1,101 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" +) + +const ( + AccessRequestFinalizer = "accessrequestfinalizer.projectsveltos.io" + + AccessRequestKind = "AccessRequest" + + // AccessRequestNameLabel is added to each Secret generated for an AccessRequest + AccessRequestNameLabel = "projectsveltos.io/access-request-name" +) + +// RequestType specifies the type of AccessRequest +// +kubebuilder:validation:Enum:=SveltosAgent;Different +type RequestType string + +const ( + // SveltosAgent is the request type to generate kubeconfig + // for sveltos agent + SveltosAgentRequest = RequestType("SveltosAgent") +) + +// AccessRequestSpec defines the desired state of AccessRequest +type AccessRequestSpec struct { + // Namespace is the namespace of the service account created + // for this AccessRequest + Namespace string `json:"namespace"` + + // Name is the name of the service account created + // for this AccessRequest + Name string `json:"name"` + + // Type represent the type of the request + Type RequestType `json:"type"` + + // ControlPlaneEndpoint represents the endpoint used to communicate with the + // management cluster controlplane endpoint. It will be used when generating the + // kubeconfig. + ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` + + // TODO: Add also necessary information for a secure (mTLS) connection +} + +// AccessRequestStatus defines the status of AccessRequest +type AccessRequestStatus struct { + // SecretRef points to the Secret containing Kubeconfig + // +optional + SecretRef *corev1.ObjectReference `json:"secretRef,omitempty"` + + // FailureMessage provides more information if an error occurs. + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=accessrequests,scope=Namespaced +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// AccessRequest is the Schema for the accessrequest API +type AccessRequest struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AccessRequestSpec `json:"spec,omitempty"` + Status AccessRequestStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// AccessRequestList contains a list of AccessRequest +type AccessRequestList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []AccessRequest `json:"items"` +} + +func init() { + SchemeBuilder.Register(&AccessRequest{}, &AccessRequestList{}) +} diff --git a/api/v1beta1/classifier_types.go b/api/v1beta1/classifier_types.go new file mode 100644 index 0000000..eb96ce3 --- /dev/null +++ b/api/v1beta1/classifier_types.go @@ -0,0 +1,192 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + "fmt" + "strings" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + // ClassifierFinalizer allows ClassifierReconciler to clean up resources associated with + // Classifier before removing it from the apiserver. + ClassifierFinalizer = "classifierfinalizer.projectsveltos.io" + + // ClassifierReportClusterNameLabel is added to each ClassifierReport + ClassifierReportClusterNameLabel = "classifier.projectsveltos.io/cluster-name" + + // ClassifierReportClusterTypeLabel is added to each ClassifierReport + ClassifierReportClusterTypeLabel = "classifier.projectsveltos.io/cluster-type" + + ClassifierKind = "Classifier" + + FeatureClassifier = "Classifier" +) + +func GetClassifierReportName(classifierName, clusterName string, clusterType *ClusterType) string { + // TODO: shorten this + return fmt.Sprintf("%s--%s--%s", + strings.ToLower(string(*clusterType)), classifierName, clusterName) +} + +func GetClassifierReportLabels(classifierName, clusterName string, clusterType *ClusterType) map[string]string { + return map[string]string{ + ClassifierlNameLabel: classifierName, + ClassifierReportClusterNameLabel: clusterName, + ClassifierReportClusterTypeLabel: strings.ToLower(string(*clusterType)), + } +} + +func GetClusterInfo(clusterNamespace, clusterName string) string { + return fmt.Sprintf("%s--%s", clusterNamespace, clusterName) +} + +type ClassifierLabel struct { + // Key is the label key + Key string `json:"key"` + + // Value is the label value + Value string `json:"value"` +} + +type DeployedResourceConstraint struct { + // ResourceSelectors identifies what resources to select + // If no AggregatedClassification is specified, a cluster is + // a match for Classifier instance, if all ResourceSelectors returns at + // least one match. + ResourceSelectors []ResourceSelector `json:"resourceSelectors"` + + // AggregatedClassification is optional and can be used to specify a Lua function + // that will be used to further detect whether the subset of the resources + // selected using the ResourceSelector field are a match for this Classifier. + // The function will receive the array of resources selected by ResourceSelectors. + // If this field is not specified, a cluster is a match for Classifier instance, + // if all ResourceSelectors returns at least one match. + // This field allows to perform more complex evaluation on the resources, looking + // at all resources together. + // This can be useful for more sophisticated tasks, such as identifying resources + // that are related to each other or that have similar properties. + // The Lua function must return a struct with: + // - "matching" field: boolean indicating whether cluster is a match; + // - "message" field: (optional) message. + // +optional + AggregatedClassification string `json:"aggregatedClassification,omitempty"` +} + +type KubernetesComparison string + +// Define the Action constants. +const ( + ComparisonEqual KubernetesComparison = "Equal" + ComparisonNotEqual KubernetesComparison = "NotEqual" + ComparisonGreaterThan KubernetesComparison = "GreaterThan" + ComparisonLessThan KubernetesComparison = "LessThan" + ComparisonGreaterThanOrEqualTo KubernetesComparison = "GreaterThanOrEqualTo" + ComparisonLessThanOrEqualTo KubernetesComparison = "LessThanOrEqualTo" +) + +type KubernetesVersionConstraint struct { + // Version is the kubernetes version + Version string `json:"version"` + + // Comparison indicate how to compare cluster kubernetes version with the specified version + // +kubebuilder:validation:Enum=Equal;NotEqual;GreaterThan;LessThan;GreaterThanOrEqualTo;LessThanOrEqualTo + Comparison string `json:"comparison"` +} + +// ClassifierSpec defines the desired state of Classifier +type ClassifierSpec struct { + // DeployedResourceConstraint allows to classify based on current deployed resources + // +optional + DeployedResourceConstraint *DeployedResourceConstraint `json:"deployedResourceConstraint,omitempty"` + + // KubernetesVersionConstraints allows to classify based on current kubernetes version + // +optional + KubernetesVersionConstraints []KubernetesVersionConstraint `json:"kubernetesVersionConstraints,omitempty"` + + // ClassifierLabels is set of labels, key,value pair, that will be added to each + // cluster matching Classifier instance + ClassifierLabels []ClassifierLabel `json:"classifierLabels"` +} + +type UnManagedLabel struct { + // Key represents a label Classifier would like to manage + // but cannot because currently managed by different instance + Key string `json:"key"` + + // FailureMessage is a human consumable message explaining the + // misconfiguration + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` +} + +type MachingClusterStatus struct { + // ClusterRef references the matching Cluster + ClusterRef corev1.ObjectReference `json:"clusterRef"` + + // ManagedLabels indicates the labels being managed on + // the cluster by this Classifier instance + // +optional + ManagedLabels []string `json:"managedLabels,omitempty"` + + // UnManagedLabel indicates the labels this Classifier instance + // would like to manage but cannot because different instance is + // already managing it + // +optional + UnManagedLabels []UnManagedLabel `json:"unManagedLabels,omitempty"` +} + +// ClassifierStatus defines the observed state of Classifier +type ClassifierStatus struct { + // MatchingClusterRefs reference all the cluster-api Cluster currently matching + // Classifier + MachingClusterStatuses []MachingClusterStatus `json:"machingClusterStatuses,omitempty"` + + // ClusterInfo reference all the cluster-api Cluster where Classifier + // has been/is being deployed + ClusterInfo []ClusterInfo `json:"clusterInfo,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=classifiers,scope=Cluster +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// Classifier is the Schema for the classifiers API +type Classifier struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ClassifierSpec `json:"spec,omitempty"` + Status ClassifierStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// ClassifierList contains a list of Classifier +type ClassifierList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Classifier `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Classifier{}, &ClassifierList{}) +} diff --git a/api/v1beta1/classifierreport_types.go b/api/v1beta1/classifierreport_types.go new file mode 100644 index 0000000..9b6429e --- /dev/null +++ b/api/v1beta1/classifierreport_types.go @@ -0,0 +1,118 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type ClusterType string + +const ( + // ClusterTypeCapi indicates type is CAPI Cluster + ClusterTypeCapi = ClusterType("Capi") + + // ClusterTypeSveltos indicates type is Sveltos Cluster + ClusterTypeSveltos = ClusterType("Sveltos") +) + +const ( + // ClassifierNameLabel is added to each ClassifierReport generated + // for a Classifier instance + ClassifierlNameLabel = "projectsveltos.io/classifier-name" + + ClassifierReportKind = "ClassifierReport" + + // This is the namespace/name of the secret containing the kubeconfig + // to send ClassifierReport to management cluster when classifier agent + // is configured to send ClassifierReports + ClassifierSecretName = "classifier-agent" + ClassifierSecretNamespace = "projectsveltos" +) + +// ReportPhase describes the state of a classifierReport/healthReport/eventReport/reloaderReport. +// +kubebuilder:validation:Enum:=WaitingForDelivery;Delivering;Processed +type ReportPhase string + +const ( + // ReportWaitingForDelivery indicates the report has yet to be sent to the + // management cluster + ReportWaitingForDelivery = ReportPhase("WaitingForDelivery") + + // ReportDelivering indicates the report has been sent to the management + // cluster but not ack-ed yet + ReportDelivering = ReportPhase("Delivering") + + // ReportProcessed indicates the report has been already delivered and acked + // in the management cluster. + ReportProcessed = ReportPhase("Processed") +) + +type ClassifierReportSpec struct { + // ClusterNamespace is the namespace of the Cluster this + // ClusterReport is for. + ClusterNamespace string `json:"clusterNamespace"` + + // ClusterName is the name of the Cluster this ClusterReport + // is for. + ClusterName string `json:"clusterName"` + + // ClusterType is the type of Cluster + ClusterType ClusterType `json:"clusterType"` + + // ClassifierName is the name of the Classifier instance this report + // is for. + ClassifierName string `json:"classifierName"` + + // Match indicates whether Cluster is currently a match for + // the Classifier instance this report is for + Match bool `json:"match"` +} + +// ClassifierReportStatus defines the observed state of ClassifierReport +type ClassifierReportStatus struct { + // Phase represents the current phase of report. + // +optional + Phase *ReportPhase `json:"phase,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=classifierreports,scope=Namespaced +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// ClassifierReport is the Schema for the classifierreports API +type ClassifierReport struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ClassifierReportSpec `json:"spec,omitempty"` + Status ClassifierReportStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// ClassifierReportList contains a list of ClassifierReport +type ClassifierReportList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClassifierReport `json:"items"` +} + +func init() { + SchemeBuilder.Register(&ClassifierReport{}, &ClassifierReportList{}) +} diff --git a/api/v1beta1/clusterhealthcheck_conversion.go b/api/v1beta1/clusterhealthcheck_conversion.go new file mode 100644 index 0000000..a425d40 --- /dev/null +++ b/api/v1beta1/clusterhealthcheck_conversion.go @@ -0,0 +1,19 @@ +/* +Copyright 2024. + +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 v1beta1 + +func (*ClusterHealthCheck) Hub() {} diff --git a/api/v1beta1/clusterhealthcheck_type.go b/api/v1beta1/clusterhealthcheck_type.go new file mode 100644 index 0000000..5b1ea7b --- /dev/null +++ b/api/v1beta1/clusterhealthcheck_type.go @@ -0,0 +1,272 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + // ClusterHealthCheckFinalizer allows ClusterHealthCheckReconciler to clean up resources associated with + // ClusterHealthCheck before removing it from the apiserver. + ClusterHealthCheckFinalizer = "clusterhcfinalizer.projectsveltos.io" + + ClusterHealthCheckKind = "ClusterHealthCheck" + + FeatureClusterHealthCheck = "ClusterHealthCheck" +) + +// Slack constant +// To have Sveltos sends a slack notification, create a Secret of type "addons.projectsveltos.io/cluster-profile" +// In the data section set both slack token and slack channel id +const ( + SlackToken = "SLACK_TOKEN" + SlackChannelID = "SLACK_CHANNEL_ID" +) + +// Webex constant +// To have Sveltos sends a webex notification, create a Secret of type "addons.projectsveltos.io/cluster-profile" +// In the data section set both webex token and webex room ID +const ( + WebexToken = "WEBEX_TOKEN" + WebexRoomID = "WEBEX_ROOM_ID" +) + +// Discord constant +// To have Sveltos sends a Discord notification, create a Secret of type "addons.projectsveltos.io/cluster-profile" +// In the data section set both discord token and discord server ID +const ( + DiscordToken = "DISCORD_TOKEN" + DiscordChannelID = "DISCORD_CHANNEL_ID" +) + +// Teams constant +// To have Sveltos sends a Microsoft Teams notification, create a Secret of type "addons.projectsveltos.io/cluster-profile" +// In the data section set the Webhook URL +const ( + TeamsWebhookURL = "TEAMS_WEBHOOK_URL" +) + +// ConditionSeverity expresses the severity of a Condition Type failing. +type ConditionSeverity string + +const ( + // ConditionSeverityError specifies that a condition with `Status=False` is an error. + ConditionSeverityError ConditionSeverity = "Error" + + // ConditionSeverityWarning specifies that a condition with `Status=False` is a warning. + ConditionSeverityWarning ConditionSeverity = "Warning" + + // ConditionSeverityInfo specifies that a condition with `Status=False` is informative. + ConditionSeverityInfo ConditionSeverity = "Info" + + // ConditionSeverityNone should apply only to conditions with `Status=True`. + ConditionSeverityNone ConditionSeverity = "" +) + +// ConditionType is a valid value for Condition.Type. +type ConditionType string + +// Condition defines an observation of a Cluster API resource operational state. +type Condition struct { + // Condition name + Name string `json:"name"` + + // Type of condition in CamelCase or in foo.example.com/CamelCase. + Type ConditionType `json:"type"` + + // Status of the condition, one of True, False, Unknown. + Status corev1.ConditionStatus `json:"status"` + + // Severity provides an explicit classification of Reason code, so the users or machines can immediately + // understand the current situation and act accordingly. + // The Severity field MUST be set only when Status=False. + // +optional + Severity ConditionSeverity `json:"severity,omitempty"` + + // Last time the condition transitioned from one status to another. + // This should be when the underlying condition changed. If that is not known, then using the time when + // the API field changed is acceptable. + LastTransitionTime metav1.Time `json:"lastTransitionTime"` + + // The reason for the condition's last transition in CamelCase. + // The specific API may choose whether or not this field is considered a guaranteed API. + // This field may not be empty. + // +optional + Reason string `json:"reason,omitempty"` + + // A human readable message indicating details about the transition. + // This field may be empty. + // +optional + Message string `json:"message,omitempty"` +} + +type ClusterCondition struct { + ClusterInfo ClusterInfo `json:"clusterInfo"` + + // Cluster conditions. + // +optional + Conditions []Condition `json:"conditions,omitempty"` + + // NotificationSummaries contains status information on notifications + // +optional + NotificationSummaries []NotificationSummary `json:"notificationSummaries,omitempty"` +} + +// Event specifies different type of liveness checks +// +kubebuilder:validation:Enum:=Addons;HealthCheck +type LivenessType string + +const ( + // LivenessTypeAddons refers to add-ons deployment state. + LivenessTypeAddons = LivenessType("Addons") + + // LivenessTypeHealthCheck refers to HealthCheck state. + LivenessTypeHealthCheck = LivenessType("HealthCheck") +) + +type LivenessCheck struct { + // Name of the liveness check. + // Must be a DNS_LABEL and unique within the ClusterHealthCheck. + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // Type specifies the type of liveness + Type LivenessType `json:"type"` + + // LivenessSourceRef is a reference to a liveness-specific resource that holds + // the details for the liveness check. + // +optional + LivenessSourceRef *corev1.ObjectReference `json:"livenessSourceRef,omitempty"` +} + +// NotificationType specifies different type of notifications +// +kubebuilder:validation:Enum:=KubernetesEvent;Slack;Webex;Discord;Teams +type NotificationType string + +const ( + // NotificationTypeKubernetesEvent refers to generating a Kubernetes event + NotificationTypeKubernetesEvent = NotificationType("KubernetesEvent") + + // NotificationTypeSlack refers to generating a Slack message + NotificationTypeSlack = NotificationType("Slack") + + // NotificationTypeWebex refers to generating a Webex message + NotificationTypeWebex = NotificationType("Webex") + + // NotificationTypeDiscord refers to generating a Discord message + NotificationTypeDiscord = NotificationType("Discord") + + // NotificationTypeDiscord refers to generating a Teams message + NotificationTypeTeams = NotificationType("Teams") +) + +type Notification struct { + // Name of the notification check. + // Must be a DNS_LABEL and unique within the ClusterHealthCheck. + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // NotificationType specifies the type of notification + Type NotificationType `json:"type"` + + // NotificationRef is a reference to a notification-specific resource that holds + // the details for the notification. + // +optional + NotificationRef *corev1.ObjectReference `json:"notificationRef,omitempty"` +} + +// NotificationStatus specifies status of notifications +// +kubebuilder:validation:Enum:=Delivered;FailedToDeliver +type NotificationStatus string + +const ( + // NotificationStatusDelivered indicates notification has been delivered + NotificationStatusDelivered = NotificationStatus("Delivered") + + // NotificationStatusFailedToDeliver indicates notification was not delivered + // due to an error + NotificationStatusFailedToDeliver = NotificationStatus("FailedToDeliver") +) + +type NotificationSummary struct { + // Name of the notification check. + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // NotificationStatus specifies the notification status + Status NotificationStatus `json:"status"` + + // FailureMessage is a human consumable message explaining the + // misconfiguration + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` +} + +// ClusterHealthCheckSpec defines the desired state of ClusterHealthCheck +type ClusterHealthCheckSpec struct { + // Selector identifies clusters to associate to. + // +optional + ClusterSelector Selector `json:"selector,omitempty"` + + // LivenessChecks is a list of source of liveness checks to evaluate. + // Anytime one of those changes, notifications will be sent + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + LivenessChecks []LivenessCheck `json:"livenessChecks"` + + // Notification is a list of source of events to evaluate. + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + Notifications []Notification `json:"notifications"` +} + +type ClusterHealthCheckStatus struct { + // MatchingClusterRefs reference all the clusters currently matching + // ClusterHealthCheck ClusterSelector + MatchingClusterRefs []corev1.ObjectReference `json:"matchingClusters,omitempty"` + + // ClusterConditions contains conditions and notification status for all clusters + // matching ClusterHealthCheck instance + // +optional + ClusterConditions []ClusterCondition `json:"clusterCondition,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=clusterhealthchecks,scope=Cluster +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// ClusterHealthCheck is the Schema for the clusterhealthchecks API +type ClusterHealthCheck struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ClusterHealthCheckSpec `json:"spec,omitempty"` + Status ClusterHealthCheckStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// ClusterHealthCheckList contains a list of ClusterHealthChecks +type ClusterHealthCheckList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterHealthCheck `json:"items"` +} + +func init() { + SchemeBuilder.Register(&ClusterHealthCheck{}, &ClusterHealthCheckList{}) +} diff --git a/api/v1beta1/clusterset_conversion.go b/api/v1beta1/clusterset_conversion.go new file mode 100644 index 0000000..09b900a --- /dev/null +++ b/api/v1beta1/clusterset_conversion.go @@ -0,0 +1,19 @@ +/* +Copyright 2024. + +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 v1beta1 + +func (*ClusterSet) Hub() {} diff --git a/api/v1beta1/clusterset_type.go b/api/v1beta1/clusterset_type.go new file mode 100644 index 0000000..e08f058 --- /dev/null +++ b/api/v1beta1/clusterset_type.go @@ -0,0 +1,56 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + // ClusterSetFinalizer allows ClusterSetReconciler to clean up resources associated with + // ClusterSet before removing it from the apiserver. + ClusterSetFinalizer = "clustersetfinalizer.projectsveltos.io" + + ClusterSetKind = "ClusterSet" +) + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=clustersets,scope=Cluster +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// ClusterSet is the Schema for the clustersets API +type ClusterSet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec Spec `json:"spec,omitempty"` + Status Status `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// ClusterSetList contains a list of ClusterSet +type ClusterSetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterSet `json:"items"` +} + +func init() { + SchemeBuilder.Register(&ClusterSet{}, &ClusterSetList{}) +} diff --git a/api/v1beta1/common_types.go b/api/v1beta1/common_types.go new file mode 100644 index 0000000..49c8718 --- /dev/null +++ b/api/v1beta1/common_types.go @@ -0,0 +1,175 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + "errors" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +const ( + // PolicyTemplateAnnotation is the annotation that must be set on a policy when the + // policy is a template and needs variable sustitution. + PolicyTemplateAnnotation = "projectsveltos.io/template" +) + +const ( + // DeployedBySveltosAnnotation is an annotation Sveltos adds to + // EventSource/HealthCheck/Classifier/ResourceSummary instances deployed + // by sveltos in managed clusters. Those resources, once deployed in a + // managed cluster, are evaluated by sveltos services (sveltos-agent and + // drift-detection-manager) running in the managed cluster + DeployedBySveltosAnnotation = "projectsveltos.io/deployed-by-sveltos" +) + +const ( + // ServiceAccountNameLabel can be set on various Sveltos resources (ClusterProfile/EventSource/...) + // to indicate which admin (represented by a ServiceAccount) is creating it (service account name). + // ServiceAccountNameLabel used along with RoleRequest is Sveltos solution for multi tenancy. + ServiceAccountNameLabel = "projectsveltos.io/serviceaccount-name" + + // ServiceAccountNamespaceLabel can be set on various Sveltos resources (ClusterProfile/EventSource/...) + // to indicate which admin (represented by a ServiceAccount) is creating it (service account namespace). + // ServiceAccountNamespaceLabel used along with RoleRequest is Sveltos solution for multi tenancy. + ServiceAccountNamespaceLabel = "projectsveltos.io/serviceaccount-namespace" +) + +// ReferencedResourceKind is a string representation of allowed kind of resources +// that can be referenced in a ClusterProfile +type ReferencedResourceKind string + +// Define the ReferencedResourceKind constants. +const ( + SecretReferencedResourceKind ReferencedResourceKind = "Secret" + ConfigMapReferencedResourceKind ReferencedResourceKind = "ConfigMap" +) + +const ( + // ClusterProfileSecretType is the only accepted type of secret in resources. + ClusterProfileSecretType corev1.SecretType = "addons.projectsveltos.io/cluster-profile" +) + +var ( + // ErrSecretTypeNotSupported signals that a Secret is not supported. + ErrSecretTypeNotSupported = errors.New("unsupported secret type") +) + +type Selector struct { + metav1.LabelSelector `json:",inline"` +} + +// ToSelector converts ClusterSelector to labels.Selector +func (cs *Selector) ToSelector() (labels.Selector, error) { + return metav1.LabelSelectorAsSelector(&cs.LabelSelector) +} + +// +kubebuilder:validation:Enum:=Provisioning;Provisioned;Failed;Removing;Removed +type SveltosFeatureStatus string + +const ( + // SveltosStatusProvisioning indicates that sveltos feature is being + // provisioned in the workload cluster + SveltosStatusProvisioning = SveltosFeatureStatus("Provisioning") + + // SveltosStatusProvisioned indicates that sveltos has been + // provisioned in the workload cluster + SveltosStatusProvisioned = SveltosFeatureStatus("Provisioned") + + // SveltosStatusFailed indicates that configuring sveltos feature + // in the workload cluster failed + SveltosStatusFailed = SveltosFeatureStatus("Failed") + + // SveltosStatusRemoving indicates that sveltos feature is being + // removed + SveltosStatusRemoving = SveltosFeatureStatus("Removing") + + // SveltosStatusRemoved indicates that sveltos feature is removed + SveltosStatusRemoved = SveltosFeatureStatus("Removed") +) + +type ClusterInfo struct { + // Cluster references the Cluster + Cluster corev1.ObjectReference `json:"cluster"` + + // Hash represents the hash of the Classifier currently deployed + // in the Cluster + Hash []byte `json:"hash"` + + // Status represents the state of the feature in the workload cluster + // +optional + Status SveltosFeatureStatus `json:"status,omitempty"` + + // FailureMessage provides more information about the error. + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` +} + +// Operation specifies +// +kubebuilder:validation:Enum:=Equal;Different +type Operation string + +const ( + // OperationEqual will verify equality. Corresponds to == + OperationEqual = Operation("Equal") + + // OperationDifferent will verify difference. Corresponds to != + OperationDifferent = Operation("Different") +) + +type LabelFilter struct { + // Key is the label key + Key string `json:"key"` + + // Operation is the comparison operation + Operation Operation `json:"operation"` + + // Value is the label value + Value string `json:"value"` +} + +// ResourceSelector defines what resources are a match +type ResourceSelector struct { + // Group of the resource deployed in the Cluster. + Group string `json:"group"` + + // Version of the resource deployed in the Cluster. + Version string `json:"version"` + + // Kind of the resource deployed in the Cluster. + // +kubebuilder:validation:MinLength=1 + Kind string `json:"kind"` + + // LabelFilters allows to filter resources based on current labels. + // +optional + LabelFilters []LabelFilter `json:"labelFilters,omitempty"` + + // Namespace of the resource deployed in the Cluster. + // Empty for resources scoped at cluster level. + // +optional + Namespace string `json:"namespace,omitempty"` + + // Evaluate contains a function "evaluate" in lua language. + // The function will be passed one of the object selected based on + // above criteria. + // Must return struct with field "matching" representing whether + // object is a match and an optional "message" field. + // +optional + Evaluate string `json:"evaluate,omitempty"` +} diff --git a/api/v1beta1/debuggingconfiguration_types.go b/api/v1beta1/debuggingconfiguration_types.go new file mode 100644 index 0000000..248f941 --- /dev/null +++ b/api/v1beta1/debuggingconfiguration_types.go @@ -0,0 +1,121 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + DebuggingConfigurationKind = "DebuggingConfiguration" +) + +// +kubebuilder:validation:Enum:=LogLevelNotSet;LogLevelInfo;LogLevelDebug;LogLevelVerbose +type LogLevel string + +const ( + // LogLevelNotSet indicates log severity is not set. Default configuration will apply. + LogLevelNotSet = LogLevel("LogLevelNotSet") + + // LogLevelInfo indicates log severity info (V(0)) is set + LogLevelInfo = LogLevel("LogLevelInfo") + + // LogLevelDebug indicates log severity debug (V(5)) is set + LogLevelDebug = LogLevel("LogLevelDebug") + + // LogLevelVerbose indicates log severity debug (V(10)) is set + LogLevelVerbose = LogLevel("LogLevelVerbose") +) + +//nolint:lll // kubebuilder marker +// +kubebuilder:validation:Enum:=AddonManager;Classifier;ClassifierAgent;SveltosClusterManager;DriftDetectionManager;AccessManager;HealthCheckManager;EventManager;ShardController;UIBackend + +type Component string + +const ( + // ComponentAddonManager is the addon-manager pod + ComponentAddonManager = Component("AddonManager") + + // Classifier is the classifier pod + ComponentClassifier = Component("Classifier") + + // ClassifierAgent is the classifier agent pod + ComponentClassifierAgent = Component("ClassifierAgent") + + // ComponentSveltosClusterManager is the sveltoscluster-manager pod + ComponentSveltosClusterManager = Component("SveltosClusterManager") + + // ComponentDriftDetectionManager is the drift-detection-manager pod + ComponentDriftDetectionManager = Component("DriftDetectionManager") + + // ComponentAccessManager is the access-manager pod + ComponentAccessManager = Component("AccessManager") + + // ComponentHealthCheckManager is the healthcheck-manager pod + ComponentHealthCheckManager = Component("HealthCheckManager") + + // ComponentEventManager is the event-manager pod + ComponentEventManager = Component("EventManager") + + // ComponentShardController is the shard-controller pod + ComponentShardController = Component("ShardController") + + // ComponentUIBackend is the ui backend pod + ComponentUIBackend = Component("UIBaeckend") +) + +// ComponentConfiguration is the debugging configuration to be applied to a Sveltos component. +type ComponentConfiguration struct { + // Component indicates which Sveltos component the configuration applies to. + Component Component `json:"component"` + + // LogLevel is the log severity above which logs are sent to the stdout. [Default: Info] + LogLevel LogLevel `json:"logLevel,omitempty"` +} + +// DebuggingConfigurationSpec defines the desired state of DebuggingConfiguration +type DebuggingConfigurationSpec struct { + // Configuration contains debugging configuration as granular as per component. + // +listType=atomic + // +optional + Configuration []ComponentConfiguration `json:"configuration,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=debuggingconfigurations,scope=Cluster +//+kubebuilder:storageversion + +// DebuggingConfiguration is the Schema for the debuggingconfigurations API +type DebuggingConfiguration struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DebuggingConfigurationSpec `json:"spec,omitempty"` +} + +//+kubebuilder:object:root=true + +// DebuggingConfigurationList contains a list of DebuggingConfiguration +type DebuggingConfigurationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DebuggingConfiguration `json:"items"` +} + +func init() { + SchemeBuilder.Register(&DebuggingConfiguration{}, &DebuggingConfigurationList{}) +} diff --git a/api/v1beta1/eventreport_type.go b/api/v1beta1/eventreport_type.go new file mode 100644 index 0000000..bd44838 --- /dev/null +++ b/api/v1beta1/eventreport_type.go @@ -0,0 +1,118 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + "fmt" + "strings" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + EventReportKind = "EventReport" + + // EventReportFinalizer allows EventReportReconciler to clean up resources associated with + // EventReport before removing it from the apiserver. + EventReportFinalizer = "eventreport.finalizer.projectsveltos.io" + + // EventSourceNameLabel is added to each EventReport generated + // for a EventSource instance + EventSourceNameLabel = "projectsveltos.io/eventsource-name" + + // EventReportClusterNameLabel is added to each EventReport + EventReportClusterNameLabel = "eventreport.projectsveltos.io/cluster-name" + + // EventReportClusterTypeLabel is added to each EventReport + EventReportClusterTypeLabel = "eventreport.projectsveltos.io/cluster-type" +) + +func GetEventReportName(healthName, clusterName string, clusterType *ClusterType) string { + // TODO: shorten this + return fmt.Sprintf("%s--%s--%s", + strings.ToLower(string(*clusterType)), healthName, clusterName) +} + +func GetEventReportLabels(eventSourceName, clusterName string, clusterType *ClusterType) map[string]string { + return map[string]string{ + EventSourceNameLabel: eventSourceName, + EventReportClusterNameLabel: clusterName, + EventReportClusterTypeLabel: strings.ToLower(string(*clusterType)), + } +} + +type EventReportSpec struct { + // ClusterNamespace is the namespace of the Cluster this + // EventReport is for. + ClusterNamespace string `json:"clusterNamespace"` + + // ClusterName is the name of the Cluster this EventReport + // is for. + ClusterName string `json:"clusterName"` + + // ClusterType is the type of Cluster this EventReport + // is for. + ClusterType ClusterType `json:"clusterType"` + + // EventSourceName is the name of the EventSource instance this report + // is for. + EventSourceName string `json:"eventSourceName"` + + // MatchingResources contains a list of resources matching an event + // +optional + MatchingResources []corev1.ObjectReference `json:"matchingResources,omitempty"` + + // If EventSource Spec.CollectResources is set to true, all matching resources + // will be collected and contained in the Resources field. + // +optional + Resources []byte `json:"resources,omitempty"` +} + +// EventReportStatus defines the observed state of EventReport +type EventReportStatus struct { + // Phase represents the current phase of report. + // +optional + Phase *ReportPhase `json:"phase,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=eventreports,scope=Namespaced +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// EventReport is the Schema for the EventReport API +type EventReport struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec EventReportSpec `json:"spec,omitempty"` + Status EventReportStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// EventReportList contains a list of EventReport +type EventReportList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []EventReport `json:"items"` +} + +func init() { + SchemeBuilder.Register(&EventReport{}, &EventReportList{}) +} diff --git a/api/v1beta1/eventsource_type.go b/api/v1beta1/eventsource_type.go new file mode 100644 index 0000000..fff4eef --- /dev/null +++ b/api/v1beta1/eventsource_type.go @@ -0,0 +1,81 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + // EventSourceFinalizer allows EventSourceReconciler to clean up resources associated with + // EventSource before removing it from the apiserver. + EventSourceFinalizer = "eventsource.finalizer.projectsveltos.io" + + EventSourceKind = "EventSource" +) + +// EventSourceSpec defines the desired state of EventSource +type EventSourceSpec struct { + // ResourceSelectors identifies what resources to select + ResourceSelectors []ResourceSelector `json:"resourceSelectors"` + + // This field is optional and can be used to specify a Lua function + // that will be used to further select a subset of the resources that + // have already been selected using the ResourceSelector field. + // The function will receive the array of resources selected by ResourceSelectors. + // If this field is not specified, all resources selected by the ResourceSelector + // field will be considered. + // This field allows to perform more complex filtering or selection operations + // on the resources, looking at all resources together. + // This can be useful for more sophisticated tasks, such as identifying resources + // that are related to each other or that have similar properties. + // The Lua function must return a struct with: + // - "resources" field: slice of matching resorces; + // - "message" field: (optional) message. + AggregatedSelection string `json:"aggregatedSelection,omitempty"` + + // CollectResources indicates whether matching resources need + // to be collected and added to EventReport. + // +kubebuilder:default:=false + // +optional + CollectResources bool `json:"collectResources,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=eventsources,scope=Cluster +//+kubebuilder:storageversion + +// EventSource is the Schema for the EventSource API +type EventSource struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec EventSourceSpec `json:"spec,omitempty"` +} + +//+kubebuilder:object:root=true + +// EventSourceList contains a list of EventSource +type EventSourceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []EventSource `json:"items"` +} + +func init() { + SchemeBuilder.Register(&EventSource{}, &EventSourceList{}) +} diff --git a/api/v1beta1/groupversion_info.go b/api/v1beta1/groupversion_info.go new file mode 100644 index 0000000..99f0148 --- /dev/null +++ b/api/v1beta1/groupversion_info.go @@ -0,0 +1,36 @@ +/* +Copyright 2024. 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 contains API Schema definitions for the lib v1alpha1 API group +// +kubebuilder:object:generate=true +// +groupName=lib.projectsveltos.io +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "lib.projectsveltos.io", Version: "v1beta1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/api/v1beta1/healthcheck_type.go b/api/v1beta1/healthcheck_type.go new file mode 100644 index 0000000..35dc973 --- /dev/null +++ b/api/v1beta1/healthcheck_type.go @@ -0,0 +1,77 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + // HealthCheckFinalizer allows HealthReconciler to clean up resources associated with + // HealthCheck before removing it from the apiserver. + HealthCheckFinalizer = "healthcheck.finalizer.projectsveltos.io" + + HealthCheckKind = "HealthCheck" +) + +// HealthCheckSpec defines the desired state of HealthCheck +type HealthCheckSpec struct { + // ResourceSelectors identifies what resources to select to evaluate health + ResourceSelectors []ResourceSelector `json:"resourceSelectors"` + + // The EvaluateHealth field specifies a Lua function responsible for evaluating the + // health of the resources selected by resourceSelectors. + // This function can assess the health of each resource independently or consider inter-resource relationships. + // The function must be named *evaluate* and can access all objects identified by resourceSelectors using + // the *resources* variable. It should return an array of structured instances, each containing the following fields: + // - resource: The resource being evaluated + // - healthStatus: The health status of the resource, which can be one of "Healthy", "Progressing", "Degraded", or "Suspended" + // - message: An optional message providing additional information about the health status + // +kubebuilder:validation:MinLength=1 + EvaluateHealth string `json:"evaluateHealth"` + + // CollectResources indicates whether matching resources need + // to be collected and added to HealthReport. + // +kubebuilder:default:=false + // +optional + CollectResources bool `json:"collectResources,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=healthchecks,scope=Cluster +//+kubebuilder:storageversion + +// HealthCheck is the Schema for the HealthCheck API +type HealthCheck struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec HealthCheckSpec `json:"spec,omitempty"` +} + +//+kubebuilder:object:root=true + +// HealthCheckList contains a list of Event +type HealthCheckList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []HealthCheck `json:"items"` +} + +func init() { + SchemeBuilder.Register(&HealthCheck{}, &HealthCheckList{}) +} diff --git a/api/v1beta1/healthcheckreport_type.go b/api/v1beta1/healthcheckreport_type.go new file mode 100644 index 0000000..8b23e9f --- /dev/null +++ b/api/v1beta1/healthcheckreport_type.go @@ -0,0 +1,148 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + "fmt" + "strings" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + HealthCheckReportKind = "HealthCheckReport" + + // HealthCheckReportFinalizer allows HealthReconciler to clean up resources associated with + // HealthCheckReport before removing it from the apiserver. + HealthCheckReportFinalizer = "healthcheckreport.finalizer.projectsveltos.io" + + // HealthCheckNameLabel is added to each HealthCheckReport generated + // for a HealthCheck instance + HealthCheckNameLabel = "projectsveltos.io/healthcheck-name" + + // HealthCheckReportClusterNameLabel is added to each HealthCheckReport + HealthCheckReportClusterNameLabel = "healthcheckreport.projectsveltos.io/cluster-name" + + // HealthCheckReportClusterTypeLabel is added to each HealthCheckReport + HealthCheckReportClusterTypeLabel = "healthcheckreport.projectsveltos.io/cluster-type" +) + +func GetHealthCheckReportName(healthCheckName, clusterName string, clusterType *ClusterType) string { + // TODO: shorten this + return fmt.Sprintf("%s--%s--%s", + strings.ToLower(string(*clusterType)), healthCheckName, clusterName) +} + +func GetHealthCheckReportLabels(healthCheckName, clusterName string, clusterType *ClusterType) map[string]string { + return map[string]string{ + HealthCheckNameLabel: healthCheckName, + HealthCheckReportClusterNameLabel: clusterName, + HealthCheckReportClusterTypeLabel: strings.ToLower(string(*clusterType)), + } +} + +// +kubebuilder:validation:Enum:=Healthy;Progressing;Degraded;Suspended +type HealthStatus string + +const ( + // HealthStatusHealthy indicates healthy status + HealthStatusHealthy = HealthStatus("Healthy") + + // HealthStatusProgressing indicates resource is not healthy yet but + // it is progressing + HealthStatusProgressing = HealthStatus("Progressing") + + // HealthStatusDegraded indicates resource is degraded + HealthStatusDegraded = HealthStatus("Degraded") + + // HealthStatusSuspended indicates resource is suspended + HealthStatusSuspended = HealthStatus("Suspended") +) + +type ResourceStatus struct { + // ObjectRef for which status is reported + ObjectRef corev1.ObjectReference `json:"objectRef"` + + // If HealthCheck Spec.CollectResources is set to true, resource + // will be collected and contained in the Resource field. + // +optional + Resource []byte `json:"resource,omitempty"` + + // HealthStatus is the health status of the object + HealthStatus HealthStatus `json:"healthStatus"` + + // Message is an extra message for human consumption + // +optional + Message string `json:"message,omitempty"` +} + +type HealthCheckReportSpec struct { + // ClusterNamespace is the namespace of the Cluster this + // HealthCheckReport is for. + ClusterNamespace string `json:"clusterNamespace"` + + // ClusterName is the name of the Cluster this HealthCheckReport + // is for. + ClusterName string `json:"clusterName"` + + // ClusterType is the type of Cluster this HealthCheckReport + // is for. + ClusterType ClusterType `json:"clusterType"` + + // HealthName is the name of the HealthCheck instance this report + // is for. + HealthCheckName string `json:"healthCheckName"` + + // ResourceStatuses contains a list of resources with their status + // +optional + ResourceStatuses []ResourceStatus `json:"resourceStatuses,omitempty"` +} + +// HealthCheckReportStatus defines the observed state of HealthCheckReport +type HealthCheckReportStatus struct { + // Phase represents the current phase of report. + // +optional + Phase *ReportPhase `json:"phase,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=healthcheckreports,scope=Namespaced +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// HealthCheckReport is the Schema for the HealthCheckReport API +type HealthCheckReport struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec HealthCheckReportSpec `json:"spec,omitempty"` + Status HealthCheckReportStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// HealthCheckReportList contains a list of HealthCheckReport +type HealthCheckReportList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []HealthCheckReport `json:"items"` +} + +func init() { + SchemeBuilder.Register(&HealthCheckReport{}, &HealthCheckReportList{}) +} diff --git a/api/v1beta1/policyref.go b/api/v1beta1/policyref.go new file mode 100644 index 0000000..b52a68d --- /dev/null +++ b/api/v1beta1/policyref.go @@ -0,0 +1,38 @@ +/* +Copyright 2024. 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 v1beta1 + +// PolicyRef specifies a resource containing one or more policy +// to deploy in matching Clusters. +type PolicyRef struct { + // Namespace of the referenced resource. + // Namespace can be left empty. In such a case, namespace will + // be implicit set to cluster's namespace. + Namespace string `json:"namespace"` + + // Name of the referenced resource. + // +kubebuilder:validation:MinLength=1 + Name string `json:"name"` + + // Kind of the resource. Supported kinds are: Secrets and ConfigMaps. + // +kubebuilder:validation:Enum=Secret;ConfigMap + Kind string `json:"kind"` +} + +func (r PolicyRef) String() string { + return r.Kind + "-" + r.Namespace + "-" + r.Name +} diff --git a/api/v1beta1/reloader_type.go b/api/v1beta1/reloader_type.go new file mode 100644 index 0000000..465ac8a --- /dev/null +++ b/api/v1beta1/reloader_type.go @@ -0,0 +1,78 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + // ReloaderFinalizer finalizer + ReloaderFinalizer = "reloader.finalizer.projectsveltos.io" + + ReloaderKind = "Reloader" +) + +// ReloaderInfo represents a resource that need to be reloaded +// if any mounted ConfigMap/Secret changes. +type ReloaderInfo 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: Deployment StatefulSet DaemonSet. + // +kubebuilder:validation:Enum=Deployment;StatefulSet;DaemonSet + Kind string `json:"kind"` + + // +optional + Value string `json:"value,omitempty"` +} + +// ReloaderSpec defines the desired state of Reloader +type ReloaderSpec struct { + // +optional + ReloaderInfo []ReloaderInfo `json:"reloaderInfo,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=reloaders,scope=Cluster +//+kubebuilder:storageversion + +// Reloader is the Schema for the Reloader API +type Reloader struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ReloaderSpec `json:"spec,omitempty"` +} + +//+kubebuilder:object:root=true + +// ReloaderList contains a list of Reloader +type ReloaderList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Reloader `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Reloader{}, &ReloaderList{}) +} diff --git a/api/v1beta1/reloaderreport_type.go b/api/v1beta1/reloaderreport_type.go new file mode 100644 index 0000000..95b793d --- /dev/null +++ b/api/v1beta1/reloaderreport_type.go @@ -0,0 +1,132 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + "crypto/sha256" + "fmt" + "strings" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + ReloaderReportKind = "ReloaderReport" + + // ReloaderReportFinalizer allows ReloaderReportReconciler to clean up resources associated with + // ReloaderReport before removing it from the apiserver. + ReloaderReportFinalizer = "reloaderreport.finalizer.projectsveltos.io" + + // ReloaderReportClusterNameLabel is added to each ReloaderReport + ReloaderReportClusterNameLabel = "reloaderreport.projectsveltos.io/cluster-name" + + // ReloaderReportClusterTypeLabel is added to each ReloaderReport + ReloaderReportClusterTypeLabel = "reloaderreport.projectsveltos.io/cluster-type" + + // ReloaderReportResourceKindAnnotation is added to each ReloaderReport + ReloaderReportResourceKindAnnotation = "reloaderreport.projectsveltos.io/resource-kind" + + // ReloaderReportResourceNamespaceAnnotation is added to each ReloaderReport + ReloaderReportResourceNamespaceAnnotation = "reloaderreport.projectsveltos.io/resource-namespace" + + // ReloaderReportResourceNameAnnotation is added to each ReloaderReport + ReloaderReportResourceNameAnnotation = "reloaderreport.projectsveltos.io/resource-name" +) + +// mountedResourcekind is the kind of the resource being mounted as volume (either ConfigMap or Secret) +// mountedResourceNamespace/mountedResourceName is the namespace/name of the resource being mounted as volume +// clusterName and clusterType identify the managed cluster +func GetReloaderReportName(mountedResourcekind, mountedResourceNamespace, mountedResourceName, clusterName string, + clusterType *ClusterType) string { + + h := sha256.New() + fmt.Fprintf(h, "%s--%s--%s--%s--%s", mountedResourcekind, mountedResourceNamespace, mountedResourceName, + clusterName, string(*clusterType)) + hash := h.Sum(nil) + return fmt.Sprintf("%x", hash) +} + +func GetReloaderReportLabels(clusterName string, clusterType *ClusterType) map[string]string { + return map[string]string{ + ReloaderReportClusterNameLabel: clusterName, + ReloaderReportClusterTypeLabel: strings.ToLower(string(*clusterType)), + } +} + +// GetReloaderReportAnnotations returns the annotation to add to ReloaderReport +// kind, namespace, name identify mounted resource (ConfigMap or Secret) which was modified +// causing a reload +func GetReloaderReportAnnotations(kind, namespace, name string) map[string]string { + return map[string]string{ + ReloaderReportResourceKindAnnotation: strings.ToLower(kind), + ReloaderReportResourceNamespaceAnnotation: namespace, + ReloaderReportResourceNameAnnotation: name, + } +} + +type ReloaderReportSpec struct { + // ClusterNamespace is the namespace of the Cluster this + // ReloaderReport is for. + ClusterNamespace string `json:"clusterNamespace"` + + // ClusterName is the name of the Cluster this ReloaderReport + // is for. + ClusterName string `json:"clusterName"` + + // ClusterType is the type of Cluster this ReloaderReport + // is for. + ClusterType ClusterType `json:"clusterType"` + + // ResourcesToReload contains a list of resources that requires + // rolling upgrade + // +optional + ResourcesToReload []ReloaderInfo `json:"resourcesToReload,omitempty"` +} + +// ReloaderReportStatus defines the observed state of ReloaderReport +type ReloaderReportStatus struct { + // Phase represents the current phase of report. + // +optional + Phase *ReportPhase `json:"phase,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=reloaderreports,scope=Namespaced +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// ReloaderReport is the Schema for the ReloaderReport API +type ReloaderReport struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ReloaderReportSpec `json:"spec,omitempty"` + Status ReloaderReportStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// ReloaderReportList contains a list of ReloaderReport +type ReloaderReportList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ReloaderReport `json:"items"` +} + +func init() { + SchemeBuilder.Register(&ReloaderReport{}, &ReloaderReportList{}) +} diff --git a/api/v1beta1/resourcesummary_type.go b/api/v1beta1/resourcesummary_type.go new file mode 100644 index 0000000..c2d6ae3 --- /dev/null +++ b/api/v1beta1/resourcesummary_type.go @@ -0,0 +1,151 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + // ResourceSummaryFinalizer is finalizer added to ResourceSummary + ResourceSummaryFinalizer = "resourcesummaryfinalizer.projectsveltos.io" + + ResourceSummaryKind = "ResourceSummary" + + // ClusterSummaryNameLabel is added to all ResourceSummary instances + ClusterSummaryNameLabel = "projectsveltos.io/cluster-summary-name" + + // ClusterSummaryNamespaceLabel is added to all ResourceSummary instances + ClusterSummaryNamespaceLabel = "projectsveltos.io/cluster-summary-namespace" + + // ClusterSummaryTypeLabel is added to all ResourceSummary instances + ClusterSummaryTypeLabel = "projectsveltos.io/cluster-summary-type" +) + +type Resource struct { + // Name of the resource deployed in the Cluster. + // +kubebuilder:validation:MinLength=1 + Name string `json:"name"` + + // Namespace of the resource deployed in the Cluster. + // Empty for resources scoped at cluster level. + // +optional + Namespace string `json:"namespace,omitempty"` + + // Group of the resource deployed in the Cluster. + Group string `json:"group"` + + // Kind of the resource deployed in the Cluster. + // +kubebuilder:validation:MinLength=1 + Kind string `json:"kind"` + + // Version of the resource deployed in the Cluster. + Version string `json:"version"` +} + +type HelmResources struct { + // ChartName is the chart name + // +kubebuilder:validation:MinLength=1 + ChartName string `json:"chartName"` + + // ReleaseName is the chart release + // +kubebuilder:validation:MinLength=1 + ReleaseName string `json:"releaseName"` + + // ReleaseNamespace is the namespace release will be installed + // +kubebuilder:validation:MinLength=1 + ReleaseNamespace string `json:"releaseNamespace"` + + // Resources deployed by ClusterSummary because of helm charts + // +optional + Resources []Resource `json:"group,omitempty"` +} + +type ResourceHash struct { + // Resource specifies a resource. + Resource `json:",inline"` + + // Hash is the hash of a resource's data. + Hash string `json:"hash,omitempty"` +} + +// ResourceSummarySpec defines the desired state of ResourceSummary +type ResourceSummarySpec struct { + // Resources deployed by ClusterSummary because of referenced ConfigMaps/Secrets + // +optional + Resources []Resource `json:"resources,omitempty"` + + // KustomizeResources deployed by ClusterSummary because of referenced + // KustomizationRef + // +optional + KustomizeResources []Resource `json:"kustomizeResources,omitempty"` + + // Resources deployed by ClusterSummary because of referenced Helm charts + // +optional + ChartResources []HelmResources `json:"chartResources,omitempty"` +} + +// ResourceSummaryStatus defines the status of ResourceSummary +type ResourceSummaryStatus struct { + // Resources changed. + // +optional + ResourcesChanged bool `json:"resourcesChanged,omitempty"` + + // KustomizeResources changed. + // +optional + KustomizeResourcesChanged bool `json:"kustomizeResourcesChanged,omitempty"` + + // Helm Resources changed. + // +optional + HelmResourcesChanged bool `json:"helmResourcesChanged,omitempty"` + + // ResourceHashes specifies a list of resource plus hash + ResourceHashes []ResourceHash `json:"resourceHashes,omitempty"` + + // KustomizeResourceHashes specifies a list of resource plus hash + KustomizeResourceHashes []ResourceHash `json:"kustomizeResourceHashes,omitempty"` + + // HelmResourceHashes specifies list of resource plus hash. + HelmResourceHashes []ResourceHash `json:"helmResourceHashes,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=resourcesummaries,scope=Namespaced +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// ResourceSummary is the Schema for the ResourceSummary API +type ResourceSummary struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ResourceSummarySpec `json:"spec,omitempty"` + Status ResourceSummaryStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// ResourceSummaryList contains a list of ResourceSummary +type ResourceSummaryList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ResourceSummary `json:"items"` +} + +func init() { + SchemeBuilder.Register(&ResourceSummary{}, &ResourceSummaryList{}) +} diff --git a/api/v1beta1/rolerequest_conversion.go b/api/v1beta1/rolerequest_conversion.go new file mode 100644 index 0000000..2d2cdbf --- /dev/null +++ b/api/v1beta1/rolerequest_conversion.go @@ -0,0 +1,19 @@ +/* +Copyright 2024. + +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 v1beta1 + +func (*RoleRequest) Hub() {} diff --git a/api/v1beta1/rolerequest_type.go b/api/v1beta1/rolerequest_type.go new file mode 100644 index 0000000..6b3426f --- /dev/null +++ b/api/v1beta1/rolerequest_type.go @@ -0,0 +1,102 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + RoleRequestFinalizer = "rolerequestfinalizer.projectsveltos.io" + + RoleRequestKind = "RoleRequest" + + // RoleRequestLabel is added to each object generated for a RoleRequest + // in both management and managed clusters + RoleRequestLabel = "projectsveltos.io/role-request" + + FeatureRoleRequest = "RoleRequest" +) + +// RoleRequestSpec defines the desired state of RoleRequest +type RoleRequestSpec struct { + // Selector identifies clusters to associate to. + // +optional + ClusterSelector Selector `json:"selector,omitempty"` + + // RoleRefs references all the Secret/ConfigMaps containing kubernetes + // Roles/ClusterRoles that need to be deployed in the matching clusters. + // +optional + RoleRefs []PolicyRef `json:"roleRefs,omitempty"` + + // ExpirationSeconds is the requested duration of validity of the TokenRequest + // associated to ServiceAccount. If not specified, default value is used + // +optional + ExpirationSeconds *int64 `json:"expirationSeconds,omitempty"` + + // ServiceAccountName is the name of the ServiceAccount representing a tenant admin for which + // those permissions are requested + ServiceAccountName string `json:"serviceAccountName"` + + // ServiceAccountNamespace is the name of the ServiceAccount representing a tenant admin + // for which those permissions are requested + ServiceAccountNamespace string `json:"serviceAccountNamespace"` +} + +// RoleRequestStatus defines the status of RoleRequest +type RoleRequestStatus struct { + // MatchingClusterRefs reference all the cluster currently matching + // RoleRequest ClusterSelector + MatchingClusterRefs []corev1.ObjectReference `json:"matchingClusters,omitempty"` + + // ClusterInfo represents the hash of the ClusterRoles/Roles deployed in + // a matching cluster for the admin. + // +optional + ClusterInfo []ClusterInfo `json:"clusterInfo,omitempty"` + + // FailureMessage provides more information if an error occurs. + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=rolerequests,scope=Cluster +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// RoleRequest is the Schema for the rolerequest API +type RoleRequest struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec RoleRequestSpec `json:"spec,omitempty"` + Status RoleRequestStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// RoleRequestList contains a list of RoleRequest +type RoleRequestList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []RoleRequest `json:"items"` +} + +func init() { + SchemeBuilder.Register(&RoleRequest{}, &RoleRequestList{}) +} diff --git a/api/v1beta1/set_conversion.go b/api/v1beta1/set_conversion.go new file mode 100644 index 0000000..6a99540 --- /dev/null +++ b/api/v1beta1/set_conversion.go @@ -0,0 +1,19 @@ +/* +Copyright 2024. + +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 v1beta1 + +func (*Set) Hub() {} diff --git a/api/v1beta1/set_type.go b/api/v1beta1/set_type.go new file mode 100644 index 0000000..548299c --- /dev/null +++ b/api/v1beta1/set_type.go @@ -0,0 +1,56 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + // SetFinalizer allows SetReconciler to clean up resources associated with + // Set before removing it from the apiserver. + SetFinalizer = "setfinalizer.projectsveltos.io" + + SetKind = "Set" +) + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=sets,scope=Namespaced +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// Set is the Schema for the sets API +type Set struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec Spec `json:"spec,omitempty"` + Status Status `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// SetList contains a list of Set +type SetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Set `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Set{}, &SetList{}) +} diff --git a/api/v1beta1/spec.go b/api/v1beta1/spec.go new file mode 100644 index 0000000..b8dc0cb --- /dev/null +++ b/api/v1beta1/spec.go @@ -0,0 +1,35 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + corev1 "k8s.io/api/core/v1" +) + +type Spec 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"` + + // MaxReplicas specifies the maximum number of clusters to be selected + // from the pool matching the clusterSelector. + MaxReplicas int `json:"maxReplicas,omitempty"` +} diff --git a/api/v1beta1/status.go b/api/v1beta1/status.go new file mode 100644 index 0000000..ae706ad --- /dev/null +++ b/api/v1beta1/status.go @@ -0,0 +1,32 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + corev1 "k8s.io/api/core/v1" +) + +// Status defines the observed state of ClusterSet/Set +type Status struct { + // MatchingClusterRefs reference all the clusters currently matching + // ClusterSet/Set ClusterSelector + MatchingClusterRefs []corev1.ObjectReference `json:"matchingClusterRefs,omitempty"` + + // SelectedClusters reference all the cluster currently selected among + // all the ones matching + SelectedClusterRefs []corev1.ObjectReference `json:"selectedClusterRefs,omitempty"` +} diff --git a/api/v1beta1/sveltoscluster_type.go b/api/v1beta1/sveltoscluster_type.go new file mode 100644 index 0000000..12a23b1 --- /dev/null +++ b/api/v1beta1/sveltoscluster_type.go @@ -0,0 +1,103 @@ +/* +Copyright 2024. 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 v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + SveltosClusterKind = "SveltosCluster" +) + +type TokenRequestRenewalOption struct { + // RenewTokenRequestInterval is the interval at which to renew the TokenRequest + RenewTokenRequestInterval metav1.Duration `json:"renewTokenRequestInterval"` +} + +// SveltosClusterSpec defines the desired state of SveltosCluster +type SveltosClusterSpec struct { + // KubeconfigName allows overriding the default Sveltos convention which expected a valid kubeconfig + // to be hosted in a secret with the pattern ${sveltosClusterName}-sveltos-kubeconfig. + // + // When a value is specified, the referenced Kubernetes Secret object must exist, + // and will be used to connect to the Kubernetes cluster. + // +optional + KubeconfigName string `json:"kubeconfigName,omitempty"` + // Paused can be used to prevent controllers from processing the + // SveltosCluster and all its associated objects. + // +optional + Paused bool `json:"paused,omitempty"` + + // TokenRequestRenewalOption contains options describing how to renew TokenRequest + // +optional + TokenRequestRenewalOption *TokenRequestRenewalOption `json:"tokenRequestRenewalOption,omitempty"` + + // ArbitraryData allows for arbitrary nested structures + // +optional + ArbitraryData map[string]string `json:"data,omitempty"` +} + +// SveltosClusterStatus defines the status of SveltosCluster +type SveltosClusterStatus struct { + // The Kubernetes version of the cluster. + // +optional + Version string `json:"version,omitempty"` + + // Ready is the state of the cluster. + // +optional + Ready bool `json:"ready,omitempty"` + + // FailureMessage is a human consumable message explaining the + // misconfiguration + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` + + // LastReconciledTokenRequestAt is the last time the TokenRequest + // was renewed. + // +optional + LastReconciledTokenRequestAt string `json:"lastReconciledTokenRequestAt,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:resource:path=sveltosclusters,scope=Namespaced +//+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Ready",type="boolean",JSONPath=".status.ready",description="Indicates whether cluster is ready to be managed by sveltos" +//+kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.version",description="Kubernetes version associated with this Cluster" +//+kubebuilder:storageversion + +// SveltosCluster is the Schema for the SveltosCluster API +type SveltosCluster struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec SveltosClusterSpec `json:"spec,omitempty"` + Status SveltosClusterStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// SveltosClusterList contains a list of SveltosCluster +type SveltosClusterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []SveltosCluster `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SveltosCluster{}, &SveltosClusterList{}) +} diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 0000000..6c014f4 --- /dev/null +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,1998 @@ +//go:build !ignore_autogenerated + +/* +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. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AccessRequest) DeepCopyInto(out *AccessRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessRequest. +func (in *AccessRequest) DeepCopy() *AccessRequest { + if in == nil { + return nil + } + out := new(AccessRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AccessRequest) 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 *AccessRequestList) DeepCopyInto(out *AccessRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AccessRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessRequestList. +func (in *AccessRequestList) DeepCopy() *AccessRequestList { + if in == nil { + return nil + } + out := new(AccessRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AccessRequestList) 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 *AccessRequestSpec) DeepCopyInto(out *AccessRequestSpec) { + *out = *in + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessRequestSpec. +func (in *AccessRequestSpec) DeepCopy() *AccessRequestSpec { + if in == nil { + return nil + } + out := new(AccessRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AccessRequestStatus) DeepCopyInto(out *AccessRequestStatus) { + *out = *in + if in.SecretRef != nil { + in, out := &in.SecretRef, &out.SecretRef + *out = new(v1.ObjectReference) + **out = **in + } + 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 AccessRequestStatus. +func (in *AccessRequestStatus) DeepCopy() *AccessRequestStatus { + if in == nil { + return nil + } + out := new(AccessRequestStatus) + 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 + 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 Classifier. +func (in *Classifier) DeepCopy() *Classifier { + if in == nil { + return nil + } + out := new(Classifier) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Classifier) 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 *ClassifierLabel) DeepCopyInto(out *ClassifierLabel) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassifierLabel. +func (in *ClassifierLabel) DeepCopy() *ClassifierLabel { + if in == nil { + return nil + } + out := new(ClassifierLabel) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClassifierList) DeepCopyInto(out *ClassifierList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Classifier, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassifierList. +func (in *ClassifierList) DeepCopy() *ClassifierList { + if in == nil { + return nil + } + out := new(ClassifierList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClassifierList) 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 *ClassifierReport) DeepCopyInto(out *ClassifierReport) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassifierReport. +func (in *ClassifierReport) DeepCopy() *ClassifierReport { + if in == nil { + return nil + } + out := new(ClassifierReport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClassifierReport) 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 *ClassifierReportList) DeepCopyInto(out *ClassifierReportList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClassifierReport, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassifierReportList. +func (in *ClassifierReportList) DeepCopy() *ClassifierReportList { + if in == nil { + return nil + } + out := new(ClassifierReportList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClassifierReportList) 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 *ClassifierReportSpec) DeepCopyInto(out *ClassifierReportSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassifierReportSpec. +func (in *ClassifierReportSpec) DeepCopy() *ClassifierReportSpec { + if in == nil { + return nil + } + out := new(ClassifierReportSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClassifierReportStatus) DeepCopyInto(out *ClassifierReportStatus) { + *out = *in + if in.Phase != nil { + in, out := &in.Phase, &out.Phase + *out = new(ReportPhase) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassifierReportStatus. +func (in *ClassifierReportStatus) DeepCopy() *ClassifierReportStatus { + if in == nil { + return nil + } + out := new(ClassifierReportStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClassifierSpec) DeepCopyInto(out *ClassifierSpec) { + *out = *in + if in.DeployedResourceConstraint != nil { + in, out := &in.DeployedResourceConstraint, &out.DeployedResourceConstraint + *out = new(DeployedResourceConstraint) + (*in).DeepCopyInto(*out) + } + if in.KubernetesVersionConstraints != nil { + in, out := &in.KubernetesVersionConstraints, &out.KubernetesVersionConstraints + *out = make([]KubernetesVersionConstraint, len(*in)) + copy(*out, *in) + } + if in.ClassifierLabels != nil { + in, out := &in.ClassifierLabels, &out.ClassifierLabels + *out = make([]ClassifierLabel, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassifierSpec. +func (in *ClassifierSpec) DeepCopy() *ClassifierSpec { + if in == nil { + return nil + } + out := new(ClassifierSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClassifierStatus) DeepCopyInto(out *ClassifierStatus) { + *out = *in + if in.MachingClusterStatuses != nil { + in, out := &in.MachingClusterStatuses, &out.MachingClusterStatuses + *out = make([]MachingClusterStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ClusterInfo != nil { + in, out := &in.ClusterInfo, &out.ClusterInfo + *out = make([]ClusterInfo, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassifierStatus. +func (in *ClassifierStatus) DeepCopy() *ClassifierStatus { + if in == nil { + return nil + } + out := new(ClassifierStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterCondition) DeepCopyInto(out *ClusterCondition) { + *out = *in + in.ClusterInfo.DeepCopyInto(&out.ClusterInfo) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.NotificationSummaries != nil { + in, out := &in.NotificationSummaries, &out.NotificationSummaries + *out = make([]NotificationSummary, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCondition. +func (in *ClusterCondition) DeepCopy() *ClusterCondition { + if in == nil { + return nil + } + out := new(ClusterCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterHealthCheck) DeepCopyInto(out *ClusterHealthCheck) { + *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 ClusterHealthCheck. +func (in *ClusterHealthCheck) DeepCopy() *ClusterHealthCheck { + if in == nil { + return nil + } + out := new(ClusterHealthCheck) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterHealthCheck) 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 *ClusterHealthCheckList) DeepCopyInto(out *ClusterHealthCheckList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterHealthCheck, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterHealthCheckList. +func (in *ClusterHealthCheckList) DeepCopy() *ClusterHealthCheckList { + if in == nil { + return nil + } + out := new(ClusterHealthCheckList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterHealthCheckList) 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 *ClusterHealthCheckSpec) DeepCopyInto(out *ClusterHealthCheckSpec) { + *out = *in + in.ClusterSelector.DeepCopyInto(&out.ClusterSelector) + if in.LivenessChecks != nil { + in, out := &in.LivenessChecks, &out.LivenessChecks + *out = make([]LivenessCheck, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Notifications != nil { + in, out := &in.Notifications, &out.Notifications + *out = make([]Notification, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterHealthCheckSpec. +func (in *ClusterHealthCheckSpec) DeepCopy() *ClusterHealthCheckSpec { + if in == nil { + return nil + } + out := new(ClusterHealthCheckSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterHealthCheckStatus) DeepCopyInto(out *ClusterHealthCheckStatus) { + *out = *in + if in.MatchingClusterRefs != nil { + in, out := &in.MatchingClusterRefs, &out.MatchingClusterRefs + *out = make([]v1.ObjectReference, len(*in)) + copy(*out, *in) + } + if in.ClusterConditions != nil { + in, out := &in.ClusterConditions, &out.ClusterConditions + *out = make([]ClusterCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterHealthCheckStatus. +func (in *ClusterHealthCheckStatus) DeepCopy() *ClusterHealthCheckStatus { + if in == nil { + return nil + } + out := new(ClusterHealthCheckStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterInfo) DeepCopyInto(out *ClusterInfo) { + *out = *in + out.Cluster = in.Cluster + if in.Hash != nil { + in, out := &in.Hash, &out.Hash + *out = make([]byte, len(*in)) + copy(*out, *in) + } + 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 ClusterInfo. +func (in *ClusterInfo) DeepCopy() *ClusterInfo { + if in == nil { + return nil + } + out := new(ClusterInfo) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterSet) DeepCopyInto(out *ClusterSet) { + *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 ClusterSet. +func (in *ClusterSet) DeepCopy() *ClusterSet { + if in == nil { + return nil + } + out := new(ClusterSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterSet) 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 *ClusterSetList) DeepCopyInto(out *ClusterSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSetList. +func (in *ClusterSetList) DeepCopy() *ClusterSetList { + if in == nil { + return nil + } + out := new(ClusterSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterSetList) 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 *ComponentConfiguration) DeepCopyInto(out *ComponentConfiguration) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentConfiguration. +func (in *ComponentConfiguration) DeepCopy() *ComponentConfiguration { + if in == nil { + return nil + } + out := new(ComponentConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition) DeepCopyInto(out *Condition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { + if in == nil { + return nil + } + out := new(Condition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DebuggingConfiguration) DeepCopyInto(out *DebuggingConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DebuggingConfiguration. +func (in *DebuggingConfiguration) DeepCopy() *DebuggingConfiguration { + if in == nil { + return nil + } + out := new(DebuggingConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DebuggingConfiguration) 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 *DebuggingConfigurationList) DeepCopyInto(out *DebuggingConfigurationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DebuggingConfiguration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DebuggingConfigurationList. +func (in *DebuggingConfigurationList) DeepCopy() *DebuggingConfigurationList { + if in == nil { + return nil + } + out := new(DebuggingConfigurationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DebuggingConfigurationList) 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 *DebuggingConfigurationSpec) DeepCopyInto(out *DebuggingConfigurationSpec) { + *out = *in + if in.Configuration != nil { + in, out := &in.Configuration, &out.Configuration + *out = make([]ComponentConfiguration, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DebuggingConfigurationSpec. +func (in *DebuggingConfigurationSpec) DeepCopy() *DebuggingConfigurationSpec { + if in == nil { + return nil + } + out := new(DebuggingConfigurationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeployedResourceConstraint) DeepCopyInto(out *DeployedResourceConstraint) { + *out = *in + if in.ResourceSelectors != nil { + in, out := &in.ResourceSelectors, &out.ResourceSelectors + *out = make([]ResourceSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeployedResourceConstraint. +func (in *DeployedResourceConstraint) DeepCopy() *DeployedResourceConstraint { + if in == nil { + return nil + } + out := new(DeployedResourceConstraint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EventReport) DeepCopyInto(out *EventReport) { + *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 EventReport. +func (in *EventReport) DeepCopy() *EventReport { + if in == nil { + return nil + } + out := new(EventReport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EventReport) 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 *EventReportList) DeepCopyInto(out *EventReportList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EventReport, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventReportList. +func (in *EventReportList) DeepCopy() *EventReportList { + if in == nil { + return nil + } + out := new(EventReportList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EventReportList) 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 *EventReportSpec) DeepCopyInto(out *EventReportSpec) { + *out = *in + if in.MatchingResources != nil { + in, out := &in.MatchingResources, &out.MatchingResources + *out = make([]v1.ObjectReference, len(*in)) + copy(*out, *in) + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]byte, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventReportSpec. +func (in *EventReportSpec) DeepCopy() *EventReportSpec { + if in == nil { + return nil + } + out := new(EventReportSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EventReportStatus) DeepCopyInto(out *EventReportStatus) { + *out = *in + if in.Phase != nil { + in, out := &in.Phase, &out.Phase + *out = new(ReportPhase) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventReportStatus. +func (in *EventReportStatus) DeepCopy() *EventReportStatus { + if in == nil { + return nil + } + out := new(EventReportStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EventSource) DeepCopyInto(out *EventSource) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventSource. +func (in *EventSource) DeepCopy() *EventSource { + if in == nil { + return nil + } + out := new(EventSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EventSource) 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 *EventSourceList) DeepCopyInto(out *EventSourceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EventSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventSourceList. +func (in *EventSourceList) DeepCopy() *EventSourceList { + if in == nil { + return nil + } + out := new(EventSourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EventSourceList) 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 *EventSourceSpec) DeepCopyInto(out *EventSourceSpec) { + *out = *in + if in.ResourceSelectors != nil { + in, out := &in.ResourceSelectors, &out.ResourceSelectors + *out = make([]ResourceSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventSourceSpec. +func (in *EventSourceSpec) DeepCopy() *EventSourceSpec { + if in == nil { + return nil + } + out := new(EventSourceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HealthCheck) DeepCopyInto(out *HealthCheck) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheck. +func (in *HealthCheck) DeepCopy() *HealthCheck { + if in == nil { + return nil + } + out := new(HealthCheck) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HealthCheck) 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 *HealthCheckList) DeepCopyInto(out *HealthCheckList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HealthCheck, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckList. +func (in *HealthCheckList) DeepCopy() *HealthCheckList { + if in == nil { + return nil + } + out := new(HealthCheckList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HealthCheckList) 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 *HealthCheckReport) DeepCopyInto(out *HealthCheckReport) { + *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 HealthCheckReport. +func (in *HealthCheckReport) DeepCopy() *HealthCheckReport { + if in == nil { + return nil + } + out := new(HealthCheckReport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HealthCheckReport) 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 *HealthCheckReportList) DeepCopyInto(out *HealthCheckReportList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HealthCheckReport, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckReportList. +func (in *HealthCheckReportList) DeepCopy() *HealthCheckReportList { + if in == nil { + return nil + } + out := new(HealthCheckReportList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HealthCheckReportList) 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 *HealthCheckReportSpec) DeepCopyInto(out *HealthCheckReportSpec) { + *out = *in + if in.ResourceStatuses != nil { + in, out := &in.ResourceStatuses, &out.ResourceStatuses + *out = make([]ResourceStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckReportSpec. +func (in *HealthCheckReportSpec) DeepCopy() *HealthCheckReportSpec { + if in == nil { + return nil + } + out := new(HealthCheckReportSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HealthCheckReportStatus) DeepCopyInto(out *HealthCheckReportStatus) { + *out = *in + if in.Phase != nil { + in, out := &in.Phase, &out.Phase + *out = new(ReportPhase) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckReportStatus. +func (in *HealthCheckReportStatus) DeepCopy() *HealthCheckReportStatus { + if in == nil { + return nil + } + out := new(HealthCheckReportStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HealthCheckSpec) DeepCopyInto(out *HealthCheckSpec) { + *out = *in + if in.ResourceSelectors != nil { + in, out := &in.ResourceSelectors, &out.ResourceSelectors + *out = make([]ResourceSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckSpec. +func (in *HealthCheckSpec) DeepCopy() *HealthCheckSpec { + if in == nil { + return nil + } + out := new(HealthCheckSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmResources) DeepCopyInto(out *HelmResources) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]Resource, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmResources. +func (in *HelmResources) DeepCopy() *HelmResources { + if in == nil { + return nil + } + out := new(HelmResources) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubernetesVersionConstraint) DeepCopyInto(out *KubernetesVersionConstraint) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesVersionConstraint. +func (in *KubernetesVersionConstraint) DeepCopy() *KubernetesVersionConstraint { + if in == nil { + return nil + } + out := new(KubernetesVersionConstraint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LabelFilter) DeepCopyInto(out *LabelFilter) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LabelFilter. +func (in *LabelFilter) DeepCopy() *LabelFilter { + if in == nil { + return nil + } + out := new(LabelFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LivenessCheck) DeepCopyInto(out *LivenessCheck) { + *out = *in + if in.LivenessSourceRef != nil { + in, out := &in.LivenessSourceRef, &out.LivenessSourceRef + *out = new(v1.ObjectReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LivenessCheck. +func (in *LivenessCheck) DeepCopy() *LivenessCheck { + if in == nil { + return nil + } + out := new(LivenessCheck) + 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 + out.ClusterRef = in.ClusterRef + if in.ManagedLabels != nil { + in, out := &in.ManagedLabels, &out.ManagedLabels + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.UnManagedLabels != nil { + in, out := &in.UnManagedLabels, &out.UnManagedLabels + *out = make([]UnManagedLabel, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachingClusterStatus. +func (in *MachingClusterStatus) DeepCopy() *MachingClusterStatus { + if in == nil { + return nil + } + out := new(MachingClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Notification) DeepCopyInto(out *Notification) { + *out = *in + if in.NotificationRef != nil { + in, out := &in.NotificationRef, &out.NotificationRef + *out = new(v1.ObjectReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Notification. +func (in *Notification) DeepCopy() *Notification { + if in == nil { + return nil + } + out := new(Notification) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NotificationSummary) DeepCopyInto(out *NotificationSummary) { + *out = *in + 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 NotificationSummary. +func (in *NotificationSummary) DeepCopy() *NotificationSummary { + if in == nil { + return nil + } + out := new(NotificationSummary) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PolicyRef) DeepCopyInto(out *PolicyRef) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyRef. +func (in *PolicyRef) DeepCopy() *PolicyRef { + if in == nil { + return nil + } + out := new(PolicyRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Reloader) DeepCopyInto(out *Reloader) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Reloader. +func (in *Reloader) DeepCopy() *Reloader { + if in == nil { + return nil + } + out := new(Reloader) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Reloader) 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 *ReloaderInfo) DeepCopyInto(out *ReloaderInfo) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReloaderInfo. +func (in *ReloaderInfo) DeepCopy() *ReloaderInfo { + if in == nil { + return nil + } + out := new(ReloaderInfo) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReloaderList) DeepCopyInto(out *ReloaderList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Reloader, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReloaderList. +func (in *ReloaderList) DeepCopy() *ReloaderList { + if in == nil { + return nil + } + out := new(ReloaderList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ReloaderList) 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 *ReloaderReport) DeepCopyInto(out *ReloaderReport) { + *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 ReloaderReport. +func (in *ReloaderReport) DeepCopy() *ReloaderReport { + if in == nil { + return nil + } + out := new(ReloaderReport) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ReloaderReport) 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 *ReloaderReportList) DeepCopyInto(out *ReloaderReportList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ReloaderReport, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReloaderReportList. +func (in *ReloaderReportList) DeepCopy() *ReloaderReportList { + if in == nil { + return nil + } + out := new(ReloaderReportList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ReloaderReportList) 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 *ReloaderReportSpec) DeepCopyInto(out *ReloaderReportSpec) { + *out = *in + if in.ResourcesToReload != nil { + in, out := &in.ResourcesToReload, &out.ResourcesToReload + *out = make([]ReloaderInfo, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReloaderReportSpec. +func (in *ReloaderReportSpec) DeepCopy() *ReloaderReportSpec { + if in == nil { + return nil + } + out := new(ReloaderReportSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReloaderReportStatus) DeepCopyInto(out *ReloaderReportStatus) { + *out = *in + if in.Phase != nil { + in, out := &in.Phase, &out.Phase + *out = new(ReportPhase) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReloaderReportStatus. +func (in *ReloaderReportStatus) DeepCopy() *ReloaderReportStatus { + if in == nil { + return nil + } + out := new(ReloaderReportStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReloaderSpec) DeepCopyInto(out *ReloaderSpec) { + *out = *in + if in.ReloaderInfo != nil { + in, out := &in.ReloaderInfo, &out.ReloaderInfo + *out = make([]ReloaderInfo, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReloaderSpec. +func (in *ReloaderSpec) DeepCopy() *ReloaderSpec { + if in == nil { + return nil + } + out := new(ReloaderSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Resource) DeepCopyInto(out *Resource) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resource. +func (in *Resource) DeepCopy() *Resource { + if in == nil { + return nil + } + out := new(Resource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceHash) DeepCopyInto(out *ResourceHash) { + *out = *in + out.Resource = in.Resource +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceHash. +func (in *ResourceHash) DeepCopy() *ResourceHash { + if in == nil { + return nil + } + out := new(ResourceHash) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceSelector) DeepCopyInto(out *ResourceSelector) { + *out = *in + if in.LabelFilters != nil { + in, out := &in.LabelFilters, &out.LabelFilters + *out = make([]LabelFilter, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSelector. +func (in *ResourceSelector) DeepCopy() *ResourceSelector { + if in == nil { + return nil + } + out := new(ResourceSelector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceStatus) DeepCopyInto(out *ResourceStatus) { + *out = *in + out.ObjectRef = in.ObjectRef + if in.Resource != nil { + in, out := &in.Resource, &out.Resource + *out = make([]byte, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceStatus. +func (in *ResourceStatus) DeepCopy() *ResourceStatus { + if in == nil { + return nil + } + out := new(ResourceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceSummary) DeepCopyInto(out *ResourceSummary) { + *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 ResourceSummary. +func (in *ResourceSummary) DeepCopy() *ResourceSummary { + if in == nil { + return nil + } + out := new(ResourceSummary) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceSummary) 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 *ResourceSummaryList) DeepCopyInto(out *ResourceSummaryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ResourceSummary, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSummaryList. +func (in *ResourceSummaryList) DeepCopy() *ResourceSummaryList { + if in == nil { + return nil + } + out := new(ResourceSummaryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceSummaryList) 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 *ResourceSummarySpec) DeepCopyInto(out *ResourceSummarySpec) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]Resource, len(*in)) + copy(*out, *in) + } + if in.KustomizeResources != nil { + in, out := &in.KustomizeResources, &out.KustomizeResources + *out = make([]Resource, len(*in)) + copy(*out, *in) + } + if in.ChartResources != nil { + in, out := &in.ChartResources, &out.ChartResources + *out = make([]HelmResources, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSummarySpec. +func (in *ResourceSummarySpec) DeepCopy() *ResourceSummarySpec { + if in == nil { + return nil + } + out := new(ResourceSummarySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceSummaryStatus) DeepCopyInto(out *ResourceSummaryStatus) { + *out = *in + if in.ResourceHashes != nil { + in, out := &in.ResourceHashes, &out.ResourceHashes + *out = make([]ResourceHash, len(*in)) + copy(*out, *in) + } + if in.KustomizeResourceHashes != nil { + in, out := &in.KustomizeResourceHashes, &out.KustomizeResourceHashes + *out = make([]ResourceHash, len(*in)) + copy(*out, *in) + } + if in.HelmResourceHashes != nil { + in, out := &in.HelmResourceHashes, &out.HelmResourceHashes + *out = make([]ResourceHash, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSummaryStatus. +func (in *ResourceSummaryStatus) DeepCopy() *ResourceSummaryStatus { + if in == nil { + return nil + } + out := new(ResourceSummaryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RoleRequest) DeepCopyInto(out *RoleRequest) { + *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 RoleRequest. +func (in *RoleRequest) DeepCopy() *RoleRequest { + if in == nil { + return nil + } + out := new(RoleRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RoleRequest) 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 *RoleRequestList) DeepCopyInto(out *RoleRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RoleRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleRequestList. +func (in *RoleRequestList) DeepCopy() *RoleRequestList { + if in == nil { + return nil + } + out := new(RoleRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RoleRequestList) 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 *RoleRequestSpec) DeepCopyInto(out *RoleRequestSpec) { + *out = *in + in.ClusterSelector.DeepCopyInto(&out.ClusterSelector) + if in.RoleRefs != nil { + in, out := &in.RoleRefs, &out.RoleRefs + *out = make([]PolicyRef, len(*in)) + copy(*out, *in) + } + if in.ExpirationSeconds != nil { + in, out := &in.ExpirationSeconds, &out.ExpirationSeconds + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleRequestSpec. +func (in *RoleRequestSpec) DeepCopy() *RoleRequestSpec { + if in == nil { + return nil + } + out := new(RoleRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RoleRequestStatus) DeepCopyInto(out *RoleRequestStatus) { + *out = *in + if in.MatchingClusterRefs != nil { + in, out := &in.MatchingClusterRefs, &out.MatchingClusterRefs + *out = make([]v1.ObjectReference, len(*in)) + copy(*out, *in) + } + if in.ClusterInfo != nil { + in, out := &in.ClusterInfo, &out.ClusterInfo + *out = make([]ClusterInfo, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + 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 RoleRequestStatus. +func (in *RoleRequestStatus) DeepCopy() *RoleRequestStatus { + if in == nil { + return nil + } + out := new(RoleRequestStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Selector) DeepCopyInto(out *Selector) { + *out = *in + in.LabelSelector.DeepCopyInto(&out.LabelSelector) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Selector. +func (in *Selector) DeepCopy() *Selector { + if in == nil { + return nil + } + out := new(Selector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Set) DeepCopyInto(out *Set) { + *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 Set. +func (in *Set) DeepCopy() *Set { + if in == nil { + return nil + } + out := new(Set) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Set) 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 *SetList) DeepCopyInto(out *SetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Set, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SetList. +func (in *SetList) DeepCopy() *SetList { + if in == nil { + return nil + } + out := new(SetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SetList) 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 *Spec) DeepCopyInto(out *Spec) { + *out = *in + in.ClusterSelector.DeepCopyInto(&out.ClusterSelector) + if in.ClusterRefs != nil { + in, out := &in.ClusterRefs, &out.ClusterRefs + *out = make([]v1.ObjectReference, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Spec. +func (in *Spec) DeepCopy() *Spec { + if in == nil { + return nil + } + out := new(Spec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Status) DeepCopyInto(out *Status) { + *out = *in + if in.MatchingClusterRefs != nil { + in, out := &in.MatchingClusterRefs, &out.MatchingClusterRefs + *out = make([]v1.ObjectReference, len(*in)) + copy(*out, *in) + } + if in.SelectedClusterRefs != nil { + in, out := &in.SelectedClusterRefs, &out.SelectedClusterRefs + *out = make([]v1.ObjectReference, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Status. +func (in *Status) DeepCopy() *Status { + if in == nil { + return nil + } + out := new(Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SveltosCluster) DeepCopyInto(out *SveltosCluster) { + *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 SveltosCluster. +func (in *SveltosCluster) DeepCopy() *SveltosCluster { + if in == nil { + return nil + } + out := new(SveltosCluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SveltosCluster) 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 *SveltosClusterList) DeepCopyInto(out *SveltosClusterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SveltosCluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SveltosClusterList. +func (in *SveltosClusterList) DeepCopy() *SveltosClusterList { + if in == nil { + return nil + } + out := new(SveltosClusterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SveltosClusterList) 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 *SveltosClusterSpec) DeepCopyInto(out *SveltosClusterSpec) { + *out = *in + if in.TokenRequestRenewalOption != nil { + in, out := &in.TokenRequestRenewalOption, &out.TokenRequestRenewalOption + *out = new(TokenRequestRenewalOption) + **out = **in + } + if in.ArbitraryData != nil { + in, out := &in.ArbitraryData, &out.ArbitraryData + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SveltosClusterSpec. +func (in *SveltosClusterSpec) DeepCopy() *SveltosClusterSpec { + if in == nil { + return nil + } + out := new(SveltosClusterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SveltosClusterStatus) DeepCopyInto(out *SveltosClusterStatus) { + *out = *in + 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 SveltosClusterStatus. +func (in *SveltosClusterStatus) DeepCopy() *SveltosClusterStatus { + if in == nil { + return nil + } + out := new(SveltosClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TokenRequestRenewalOption) DeepCopyInto(out *TokenRequestRenewalOption) { + *out = *in + out.RenewTokenRequestInterval = in.RenewTokenRequestInterval +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokenRequestRenewalOption. +func (in *TokenRequestRenewalOption) DeepCopy() *TokenRequestRenewalOption { + if in == nil { + return nil + } + out := new(TokenRequestRenewalOption) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UnManagedLabel) DeepCopyInto(out *UnManagedLabel) { + *out = *in + 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 UnManagedLabel. +func (in *UnManagedLabel) DeepCopy() *UnManagedLabel { + if in == nil { + return nil + } + out := new(UnManagedLabel) + in.DeepCopyInto(out) + return out +} diff --git a/config/crd/bases/lib.projectsveltos.io_accessrequests.yaml b/config/crd/bases/lib.projectsveltos.io_accessrequests.yaml index 6439001..a21d601 100644 --- a/config/crd/bases/lib.projectsveltos.io_accessrequests.yaml +++ b/config/crd/bases/lib.projectsveltos.io_accessrequests.yaml @@ -132,6 +132,127 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: AccessRequest is the Schema for the accessrequest 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: AccessRequestSpec defines the desired state of AccessRequest + properties: + controlPlaneEndpoint: + description: |- + ControlPlaneEndpoint represents the endpoint used to communicate with the + management cluster controlplane endpoint. It will be used when generating the + kubeconfig. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + name: + description: |- + Name is the name of the service account created + for this AccessRequest + type: string + namespace: + description: |- + Namespace is the namespace of the service account created + for this AccessRequest + type: string + type: + description: Type represent the type of the request + enum: + - SveltosAgent + - Different + type: string + required: + - controlPlaneEndpoint + - name + - namespace + - type + type: object + status: + description: AccessRequestStatus defines the status of AccessRequest + properties: + failureMessage: + description: FailureMessage provides more information if an error + occurs. + type: string + secretRef: + description: SecretRef points to the Secret containing Kubeconfig + 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: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/crd/bases/lib.projectsveltos.io_classifierreports.yaml b/config/crd/bases/lib.projectsveltos.io_classifierreports.yaml index 053ace5..419e642 100644 --- a/config/crd/bases/lib.projectsveltos.io_classifierreports.yaml +++ b/config/crd/bases/lib.projectsveltos.io_classifierreports.yaml @@ -15,6 +15,76 @@ spec: scope: Namespaced versions: - name: v1alpha1 + schema: + openAPIV3Schema: + description: ClassifierReport is the Schema for the classifierreports 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: + properties: + classifierName: + description: |- + ClassifierName is the name of the Classifier instance this report + is for. + type: string + clusterName: + description: |- + ClusterName is the name of the Cluster this ClusterReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + ClusterReport is for. + type: string + clusterType: + description: ClusterType is the type of Cluster + type: string + match: + description: |- + Match indicates whether Cluster is currently a match for + the Classifier instance this report is for + type: boolean + required: + - classifierName + - clusterName + - clusterNamespace + - clusterType + - match + type: object + status: + description: ClassifierReportStatus defines the observed state of ClassifierReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 schema: openAPIV3Schema: description: ClassifierReport is the Schema for the classifierreports API diff --git a/config/crd/bases/lib.projectsveltos.io_classifiers.yaml b/config/crd/bases/lib.projectsveltos.io_classifiers.yaml index c0a477a..fa0a801 100644 --- a/config/crd/bases/lib.projectsveltos.io_classifiers.yaml +++ b/config/crd/bases/lib.projectsveltos.io_classifiers.yaml @@ -330,6 +330,325 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: Classifier is the Schema for the classifiers 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: ClassifierSpec defines the desired state of Classifier + properties: + classifierLabels: + description: |- + ClassifierLabels is set of labels, key,value pair, that will be added to each + cluster matching Classifier instance + items: + properties: + key: + description: Key is the label key + type: string + value: + description: Value is the label value + type: string + required: + - key + - value + type: object + type: array + deployedResourceConstraint: + description: DeployedResourceConstraint allows to classify based on + current deployed resources + properties: + aggregatedClassification: + description: |- + AggregatedClassification is optional and can be used to specify a Lua function + that will be used to further detect whether the subset of the resources + selected using the ResourceSelector field are a match for this Classifier. + The function will receive the array of resources selected by ResourceSelectors. + If this field is not specified, a cluster is a match for Classifier instance, + if all ResourceSelectors returns at least one match. + This field allows to perform more complex evaluation on the resources, looking + at all resources together. + This can be useful for more sophisticated tasks, such as identifying resources + that are related to each other or that have similar properties. + The Lua function must return a struct with: + - "matching" field: boolean indicating whether cluster is a match; + - "message" field: (optional) message. + type: string + resourceSelectors: + description: |- + ResourceSelectors identifies what resources to select + If no AggregatedClassification is specified, a cluster is + a match for Classifier instance, if all ResourceSelectors returns at + least one match. + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based + on current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - resourceSelectors + type: object + kubernetesVersionConstraints: + description: KubernetesVersionConstraints allows to classify based + on current kubernetes version + items: + properties: + comparison: + description: Comparison indicate how to compare cluster kubernetes + version with the specified version + enum: + - Equal + - NotEqual + - GreaterThan + - LessThan + - GreaterThanOrEqualTo + - LessThanOrEqualTo + type: string + version: + description: Version is the kubernetes version + type: string + required: + - comparison + - version + type: object + type: array + required: + - classifierLabels + type: object + status: + description: ClassifierStatus defines the observed state of Classifier + properties: + clusterInfo: + description: |- + ClusterInfo reference all the cluster-api Cluster where Classifier + has been/is being deployed + items: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature in the + workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + type: array + machingClusterStatuses: + description: |- + MatchingClusterRefs reference all the cluster-api Cluster currently matching + Classifier + items: + properties: + clusterRef: + description: ClusterRef references the matching Cluster + 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 + managedLabels: + description: |- + ManagedLabels indicates the labels being managed on + the cluster by this Classifier instance + items: + type: string + type: array + unManagedLabels: + description: |- + UnManagedLabel indicates the labels this Classifier instance + would like to manage but cannot because different instance is + already managing it + items: + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + key: + description: |- + Key represents a label Classifier would like to manage + but cannot because currently managed by different instance + type: string + required: + - key + type: object + type: array + required: + - clusterRef + type: object + type: array + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml b/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml index 3d15cc6..0082367 100644 --- a/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml +++ b/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml @@ -181,6 +181,400 @@ spec: - type type: object type: array + required: + - clusterSelector + - livenessChecks + - notifications + type: object + status: + properties: + clusterCondition: + description: |- + ClusterConditions contains conditions and notification status for all clusters + matching ClusterHealthCheck instance + items: + properties: + clusterInfo: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature + in the workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + conditions: + description: Cluster conditions. + items: + description: Condition defines an observation of a Cluster + API resource operational state. + properties: + lastTransitionTime: + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + A human readable message indicating details about the transition. + This field may be empty. + type: string + name: + description: Condition name + type: string + reason: + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. + type: string + severity: + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, + Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + type: string + required: + - lastTransitionTime + - name + - status + - type + type: object + type: array + notificationSummaries: + description: NotificationSummaries contains status information + on notifications + items: + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + name: + description: Name of the notification check. + type: string + status: + description: NotificationStatus specifies the notification + status + enum: + - Delivered + - FailedToDeliver + type: string + required: + - name + - status + type: object + type: array + required: + - clusterInfo + type: object + type: array + matchingClusters: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterHealthCheck 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: ClusterHealthCheck is the Schema for the clusterhealthchecks + 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: ClusterHealthCheckSpec defines the desired state of ClusterHealthCheck + properties: + livenessChecks: + description: |- + LivenessChecks is a list of source of liveness checks to evaluate. + Anytime one of those changes, notifications will be sent + items: + properties: + livenessSourceRef: + description: |- + LivenessSourceRef is a reference to a liveness-specific resource that holds + the details for the liveness check. + 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 + name: + description: |- + Name of the liveness check. + Must be a DNS_LABEL and unique within the ClusterHealthCheck. + type: string + type: + description: Type specifies the type of liveness + enum: + - Addons + - HealthCheck + type: string + required: + - name + - type + type: object + type: array + notifications: + description: Notification is a list of source of events to evaluate. + items: + properties: + name: + description: |- + Name of the notification check. + Must be a DNS_LABEL and unique within the ClusterHealthCheck. + type: string + notificationRef: + description: |- + NotificationRef is a reference to a notification-specific resource that holds + the details for the notification. + 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: + description: NotificationType specifies the type of notification + enum: + - KubernetesEvent + - Slack + - Webex + - Discord + - Teams + type: string + required: + - name + - type + type: object + type: array selector: description: Selector identifies clusters to associate to. properties: @@ -228,7 +622,6 @@ spec: type: object x-kubernetes-map-type: atomic required: - - clusterSelector - livenessChecks - notifications type: object diff --git a/config/crd/bases/lib.projectsveltos.io_clustersets.yaml b/config/crd/bases/lib.projectsveltos.io_clustersets.yaml index 78fb086..60da336 100644 --- a/config/crd/bases/lib.projectsveltos.io_clustersets.yaml +++ b/config/crd/bases/lib.projectsveltos.io_clustersets.yaml @@ -111,8 +111,238 @@ spec: MaxReplicas specifies the maximum number of clusters to be selected from the pool matching the clusterSelector. type: integer - selector: - description: Selector identifies clusters to associate to. + type: object + status: + description: Status defines the observed state of ClusterSet/Set + properties: + matchingClusterRefs: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterSet/Set 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. + + + 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 + selectedClusterRefs: + description: |- + SelectedClusters reference all the cluster currently selected among + all the ones matching + 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: ClusterSet is the Schema for the clustersets 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: + 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. + + + 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 properties: matchExpressions: description: matchExpressions is a list of label selector requirements. @@ -157,6 +387,11 @@ spec: type: object type: object x-kubernetes-map-type: atomic + maxReplicas: + description: |- + MaxReplicas specifies the maximum number of clusters to be selected + from the pool matching the clusterSelector. + type: integer type: object status: description: Status defines the observed state of ClusterSet/Set diff --git a/config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml b/config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml index 33a1bbc..1ceb112 100644 --- a/config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml +++ b/config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml @@ -15,6 +15,72 @@ spec: scope: Cluster versions: - name: v1alpha1 + schema: + openAPIV3Schema: + description: DebuggingConfiguration is the Schema for the debuggingconfigurations + 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: DebuggingConfigurationSpec defines the desired state of DebuggingConfiguration + properties: + configuration: + description: Configuration contains debugging configuration as granular + as per component. + items: + description: ComponentConfiguration is the debugging configuration + to be applied to a Sveltos component. + properties: + component: + description: Component indicates which Sveltos component the + configuration applies to. + enum: + - AddonManager + - Classifier + - ClassifierAgent + - SveltosClusterManager + - DriftDetectionManager + - AccessManager + - HealthCheckManager + - EventManager + - ShardController + - UIBackend + type: string + logLevel: + description: 'LogLevel is the log severity above which logs + are sent to the stdout. [Default: Info]' + enum: + - LogLevelNotSet + - LogLevelInfo + - LogLevelDebug + - LogLevelVerbose + type: string + required: + - component + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: object + served: true + storage: false + - name: v1beta1 schema: openAPIV3Schema: description: DebuggingConfiguration is the Schema for the debuggingconfigurations diff --git a/config/crd/bases/lib.projectsveltos.io_eventreports.yaml b/config/crd/bases/lib.projectsveltos.io_eventreports.yaml index 2cfe94a..16a68ce 100644 --- a/config/crd/bases/lib.projectsveltos.io_eventreports.yaml +++ b/config/crd/bases/lib.projectsveltos.io_eventreports.yaml @@ -78,6 +78,143 @@ spec: will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control. + 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 + resources: + description: |- + If EventSource Spec.CollectResources is set to true, all matching resources + will be collected and contained in the Resources field. + format: byte + type: string + required: + - clusterName + - clusterNamespace + - clusterType + - eventSourceName + type: object + status: + description: EventReportStatus defines the observed state of EventReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: EventReport is the Schema for the EventReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this EventReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + EventReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this EventReport + is for. + type: string + eventSourceName: + description: |- + EventSourceName is the name of the EventSource instance this report + is for. + type: string + matchingResources: + description: MatchingResources contains a list of resources matching + an event + 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. + + 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: diff --git a/config/crd/bases/lib.projectsveltos.io_eventsources.yaml b/config/crd/bases/lib.projectsveltos.io_eventsources.yaml index 4740a70..657b9be 100644 --- a/config/crd/bases/lib.projectsveltos.io_eventsources.yaml +++ b/config/crd/bases/lib.projectsveltos.io_eventsources.yaml @@ -123,4 +123,114 @@ spec: type: object type: object served: true + storage: false + - name: v1beta1 + schema: + openAPIV3Schema: + description: EventSource is the Schema for the EventSource 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: EventSourceSpec defines the desired state of EventSource + properties: + aggregatedSelection: + description: |- + This field is optional and can be used to specify a Lua function + that will be used to further select a subset of the resources that + have already been selected using the ResourceSelector field. + The function will receive the array of resources selected by ResourceSelectors. + If this field is not specified, all resources selected by the ResourceSelector + field will be considered. + This field allows to perform more complex filtering or selection operations + on the resources, looking at all resources together. + This can be useful for more sophisticated tasks, such as identifying resources + that are related to each other or that have similar properties. + The Lua function must return a struct with: + - "resources" field: slice of matching resorces; + - "message" field: (optional) message. + type: string + collectResources: + default: false + description: |- + CollectResources indicates whether matching resources need + to be collected and added to EventReport. + type: boolean + resourceSelectors: + description: ResourceSelectors identifies what resources to select + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based on + current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - resourceSelectors + type: object + type: object + served: true storage: true diff --git a/config/crd/bases/lib.projectsveltos.io_healthcheckreports.yaml b/config/crd/bases/lib.projectsveltos.io_healthcheckreports.yaml index 7cea9c4..67bc39d 100644 --- a/config/crd/bases/lib.projectsveltos.io_healthcheckreports.yaml +++ b/config/crd/bases/lib.projectsveltos.io_healthcheckreports.yaml @@ -148,6 +148,143 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: HealthCheckReport is the Schema for the HealthCheckReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this HealthCheckReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + HealthCheckReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this HealthCheckReport + is for. + type: string + healthCheckName: + description: |- + HealthName is the name of the HealthCheck instance this report + is for. + type: string + resourceStatuses: + description: ResourceStatuses contains a list of resources with their + status + items: + properties: + healthStatus: + description: HealthStatus is the health status of the object + enum: + - Healthy + - Progressing + - Degraded + - Suspended + type: string + message: + description: Message is an extra message for human consumption + type: string + objectRef: + description: ObjectRef for which status is reported + 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 + resource: + description: |- + If HealthCheck Spec.CollectResources is set to true, resource + will be collected and contained in the Resource field. + format: byte + type: string + required: + - healthStatus + - objectRef + type: object + type: array + required: + - clusterName + - clusterNamespace + - clusterType + - healthCheckName + type: object + status: + description: HealthCheckReportStatus defines the observed state of HealthCheckReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/crd/bases/lib.projectsveltos.io_healthchecks.yaml b/config/crd/bases/lib.projectsveltos.io_healthchecks.yaml index 92a15ff..8500ca0 100644 --- a/config/crd/bases/lib.projectsveltos.io_healthchecks.yaml +++ b/config/crd/bases/lib.projectsveltos.io_healthchecks.yaml @@ -121,4 +121,112 @@ spec: type: object type: object served: true + storage: false + - name: v1beta1 + schema: + openAPIV3Schema: + description: HealthCheck is the Schema for the HealthCheck 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: HealthCheckSpec defines the desired state of HealthCheck + properties: + collectResources: + default: false + description: |- + CollectResources indicates whether matching resources need + to be collected and added to HealthReport. + type: boolean + evaluateHealth: + description: |- + The EvaluateHealth field specifies a Lua function responsible for evaluating the + health of the resources selected by resourceSelectors. + This function can assess the health of each resource independently or consider inter-resource relationships. + The function must be named *evaluate* and can access all objects identified by resourceSelectors using + the *resources* variable. It should return an array of structured instances, each containing the following fields: + - resource: The resource being evaluated + - healthStatus: The health status of the resource, which can be one of "Healthy", "Progressing", "Degraded", or "Suspended" + - message: An optional message providing additional information about the health status + minLength: 1 + type: string + resourceSelectors: + description: ResourceSelectors identifies what resources to select + to evaluate health + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based on + current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - evaluateHealth + - resourceSelectors + type: object + type: object + served: true storage: true diff --git a/config/crd/bases/lib.projectsveltos.io_reloaderreports.yaml b/config/crd/bases/lib.projectsveltos.io_reloaderreports.yaml index 66f9f6d..61738d1 100644 --- a/config/crd/bases/lib.projectsveltos.io_reloaderreports.yaml +++ b/config/crd/bases/lib.projectsveltos.io_reloaderreports.yaml @@ -15,6 +15,99 @@ spec: scope: Namespaced versions: - name: v1alpha1 + schema: + openAPIV3Schema: + description: ReloaderReport is the Schema for the ReloaderReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this ReloaderReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + ReloaderReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this ReloaderReport + is for. + type: string + resourcesToReload: + description: |- + ResourcesToReload contains a list of resources that requires + rolling upgrade + items: + description: |- + ReloaderInfo represents a resource that need to be reloaded + if any mounted ConfigMap/Secret changes. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Deployment + StatefulSet DaemonSet.' + enum: + - Deployment + - StatefulSet + - DaemonSet + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: Namespace of the referenced resource. + minLength: 1 + type: string + value: + type: string + required: + - kind + - name + - namespace + type: object + type: array + required: + - clusterName + - clusterNamespace + - clusterType + type: object + status: + description: ReloaderReportStatus defines the observed state of ReloaderReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 schema: openAPIV3Schema: description: ReloaderReport is the Schema for the ReloaderReport API diff --git a/config/crd/bases/lib.projectsveltos.io_reloaders.yaml b/config/crd/bases/lib.projectsveltos.io_reloaders.yaml index 7bd617e..93609c1 100644 --- a/config/crd/bases/lib.projectsveltos.io_reloaders.yaml +++ b/config/crd/bases/lib.projectsveltos.io_reloaders.yaml @@ -15,6 +15,65 @@ spec: scope: Cluster versions: - name: v1alpha1 + schema: + openAPIV3Schema: + description: Reloader is the Schema for the Reloader 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: ReloaderSpec defines the desired state of Reloader + properties: + reloaderInfo: + items: + description: |- + ReloaderInfo represents a resource that need to be reloaded + if any mounted ConfigMap/Secret changes. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Deployment + StatefulSet DaemonSet.' + enum: + - Deployment + - StatefulSet + - DaemonSet + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: Namespace of the referenced resource. + minLength: 1 + type: string + value: + type: string + required: + - kind + - name + - namespace + type: object + type: array + type: object + type: object + served: true + storage: false + - name: v1beta1 schema: openAPIV3Schema: description: Reloader is the Schema for the Reloader API diff --git a/config/crd/bases/lib.projectsveltos.io_resourcesummaries.yaml b/config/crd/bases/lib.projectsveltos.io_resourcesummaries.yaml index 89cf147..5657253 100644 --- a/config/crd/bases/lib.projectsveltos.io_resourcesummaries.yaml +++ b/config/crd/bases/lib.projectsveltos.io_resourcesummaries.yaml @@ -273,6 +273,268 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: ResourceSummary is the Schema for the ResourceSummary 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: ResourceSummarySpec defines the desired state of ResourceSummary + properties: + chartResources: + description: Resources deployed by ClusterSummary because of referenced + Helm charts + items: + properties: + chartName: + description: ChartName is the chart name + minLength: 1 + type: string + group: + description: Resources deployed by ClusterSummary because of + helm charts + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + releaseName: + description: ReleaseName is the chart release + minLength: 1 + type: string + releaseNamespace: + description: ReleaseNamespace is the namespace release will + be installed + minLength: 1 + type: string + required: + - chartName + - releaseName + - releaseNamespace + type: object + type: array + kustomizeResources: + description: |- + KustomizeResources deployed by ClusterSummary because of referenced + KustomizationRef + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + resources: + description: Resources deployed by ClusterSummary because of referenced + ConfigMaps/Secrets + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + type: object + status: + description: ResourceSummaryStatus defines the status of ResourceSummary + properties: + helmResourceHashes: + description: HelmResourceHashes specifies list of resource plus hash. + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + helmResourcesChanged: + description: Helm Resources changed. + type: boolean + kustomizeResourceHashes: + description: KustomizeResourceHashes specifies a list of resource + plus hash + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + kustomizeResourcesChanged: + description: KustomizeResources changed. + type: boolean + resourceHashes: + description: ResourceHashes specifies a list of resource plus hash + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + resourcesChanged: + description: Resources changed. + type: boolean + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/crd/bases/lib.projectsveltos.io_rolerequests.yaml b/config/crd/bases/lib.projectsveltos.io_rolerequests.yaml index 67afc2d..14ff55d 100644 --- a/config/crd/bases/lib.projectsveltos.io_rolerequests.yaml +++ b/config/crd/bases/lib.projectsveltos.io_rolerequests.yaml @@ -44,6 +44,238 @@ spec: ClusterSelector identifies clusters where permissions requestes in this instance will be granted (Deprecated use selector instead) type: string + expirationSeconds: + description: |- + ExpirationSeconds is the requested duration of validity of the TokenRequest + associated to ServiceAccount. If not specified, default value is used + format: int64 + type: integer + roleRefs: + description: |- + RoleRefs references all the Secret/ConfigMaps containing kubernetes + Roles/ClusterRoles that need to be deployed in the matching clusters. + items: + description: |- + PolicyRef specifies a resource containing one or more policy + to deploy in matching Clusters. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Secrets + and ConfigMaps.' + enum: + - Secret + - ConfigMap + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the referenced resource. + Namespace can be left empty. In such a case, namespace will + be implicit set to cluster's namespace. + type: string + required: + - kind + - name + - namespace + type: object + type: array + serviceAccountName: + description: |- + ServiceAccountName is the name of the ServiceAccount representing a tenant admin for which + those permissions are requested + type: string + serviceAccountNamespace: + description: |- + ServiceAccountNamespace is the name of the ServiceAccount representing a tenant admin + for which those permissions are requested + type: string + required: + - clusterSelector + - serviceAccountName + - serviceAccountNamespace + type: object + status: + description: RoleRequestStatus defines the status of RoleRequest + properties: + clusterInfo: + description: |- + ClusterInfo represents the hash of the ClusterRoles/Roles deployed in + a matching cluster for the admin. + items: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature in the + workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + type: array + failureMessage: + description: FailureMessage provides more information if an error + occurs. + type: string + matchingClusters: + description: |- + MatchingClusterRefs reference all the cluster currently matching + RoleRequest 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: RoleRequest is the Schema for the rolerequest 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: RoleRequestSpec defines the desired state of RoleRequest + properties: expirationSeconds: description: |- ExpirationSeconds is the requested duration of validity of the TokenRequest @@ -139,7 +371,6 @@ spec: for which those permissions are requested type: string required: - - clusterSelector - serviceAccountName - serviceAccountNamespace type: object diff --git a/config/crd/bases/lib.projectsveltos.io_sets.yaml b/config/crd/bases/lib.projectsveltos.io_sets.yaml index 1a430c2..f69134c 100644 --- a/config/crd/bases/lib.projectsveltos.io_sets.yaml +++ b/config/crd/bases/lib.projectsveltos.io_sets.yaml @@ -111,8 +111,238 @@ spec: MaxReplicas specifies the maximum number of clusters to be selected from the pool matching the clusterSelector. type: integer - selector: - description: Selector identifies clusters to associate to. + type: object + status: + description: Status defines the observed state of ClusterSet/Set + properties: + matchingClusterRefs: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterSet/Set 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. + + + 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 + selectedClusterRefs: + description: |- + SelectedClusters reference all the cluster currently selected among + all the ones matching + 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: Set is the Schema for the sets 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: + 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. + + + 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 properties: matchExpressions: description: matchExpressions is a list of label selector requirements. @@ -157,6 +387,11 @@ spec: type: object type: object x-kubernetes-map-type: atomic + maxReplicas: + description: |- + MaxReplicas specifies the maximum number of clusters to be selected + from the pool matching the clusterSelector. + type: integer type: object status: description: Status defines the observed state of ClusterSet/Set diff --git a/config/crd/bases/lib.projectsveltos.io_sveltosclusters.yaml b/config/crd/bases/lib.projectsveltos.io_sveltosclusters.yaml index 0e89c39..6cae34f 100644 --- a/config/crd/bases/lib.projectsveltos.io_sveltosclusters.yaml +++ b/config/crd/bases/lib.projectsveltos.io_sveltosclusters.yaml @@ -59,6 +59,96 @@ spec: to be hosted in a secret with the pattern ${sveltosClusterName}-sveltos-kubeconfig. + When a value is specified, the referenced Kubernetes Secret object must exist, + and will be used to connect to the Kubernetes cluster. + type: string + paused: + description: |- + Paused can be used to prevent controllers from processing the + SveltosCluster and all its associated objects. + type: boolean + tokenRequestRenewalOption: + description: TokenRequestRenewalOption contains options describing + how to renew TokenRequest + properties: + renewTokenRequestInterval: + description: RenewTokenRequestInterval is the interval at which + to renew the TokenRequest + type: string + required: + - renewTokenRequestInterval + type: object + type: object + status: + description: SveltosClusterStatus defines the status of SveltosCluster + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + lastReconciledTokenRequestAt: + description: |- + LastReconciledTokenRequestAt is the last time the TokenRequest + was renewed. + type: string + ready: + description: Ready is the state of the cluster. + type: boolean + version: + description: The Kubernetes version of the cluster. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - description: Indicates whether cluster is ready to be managed by sveltos + jsonPath: .status.ready + name: Ready + type: boolean + - description: Kubernetes version associated with this Cluster + jsonPath: .status.version + name: Version + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: SveltosCluster is the Schema for the SveltosCluster 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: SveltosClusterSpec defines the desired state of SveltosCluster + properties: + data: + additionalProperties: + type: string + description: ArbitraryData allows for arbitrary nested structures + type: object + kubeconfigName: + description: |- + KubeconfigName allows overriding the default Sveltos convention which expected a valid kubeconfig + to be hosted in a secret with the pattern ${sveltosClusterName}-sveltos-kubeconfig. + + When a value is specified, the referenced Kubernetes Secret object must exist, and will be used to connect to the Kubernetes cluster. type: string diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml new file mode 100644 index 0000000..2fec301 --- /dev/null +++ b/config/crd/kustomization.yaml @@ -0,0 +1,41 @@ +# This kustomization.yaml is not intended to be run by itself, +# since it depends on service name and namespace that are out of this kustomize package. +# It should be run by config/default +resources: +- bases/lib.projectsveltos.io_accessrequests.yaml +- bases/lib.projectsveltos.io_classifiers.yaml +- bases/lib.projectsveltos.io_classifierreports.yaml +- bases/lib.projectsveltos.io_clusterhealthchecks.yaml +- bases/lib.projectsveltos.io_clustersets.yaml +- bases/lib.projectsveltos.io_debuggingconfigurations.yaml +- bases/lib.projectsveltos.io_eventreports.yaml +- bases/lib.projectsveltos.io_eventsources.yaml +- bases/lib.projectsveltos.io_healthcheckreports.yaml +- bases/lib.projectsveltos.io_healthchecks.yaml +- bases/lib.projectsveltos.io_reloaders.yaml +- bases/lib.projectsveltos.io_reloaderreports.yaml +- bases/lib.projectsveltos.io_resourcesummaries.yaml +- bases/lib.projectsveltos.io_rolerequests.yaml +- bases/lib.projectsveltos.io_sets.yaml +- bases/lib.projectsveltos.io_sveltosclusters.yaml + +patches: +# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. +# patches here are for enabling the conversion webhook for each CRD +- path: patches/webhook_in_clusterhealthchecks.yaml +- path: patches/webhook_in_clustersets.yaml +- path: patches/webhook_in_rolerequests.yaml +- path: patches/webhook_in_sets.yaml +#+kubebuilder:scaffold:crdkustomizewebhookpatch + +# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. +# patches here are for enabling the CA injection for each CRD +- path: patches/cainjection_in_clusterhealthchecks.yaml +- path: patches/cainjection_in_clustersets.yaml +- path: patches/cainjection_in_rolerequests.yaml +- path: patches/cainjection_in_sets.yaml +#+kubebuilder:scaffold:crdkustomizecainjectionpatch + +# the following config is for teaching kustomize how to do kustomization for CRDs. +configurations: +- kustomizeconfig.yaml diff --git a/config/crd/kustomizeconfig.yaml b/config/crd/kustomizeconfig.yaml new file mode 100644 index 0000000..ec5c150 --- /dev/null +++ b/config/crd/kustomizeconfig.yaml @@ -0,0 +1,19 @@ +# This file is for teaching kustomize how to substitute name and namespace reference in CRD +nameReference: +- kind: Service + version: v1 + fieldSpecs: + - kind: CustomResourceDefinition + version: v1 + group: apiextensions.k8s.io + path: spec/conversion/webhook/clientConfig/service/name + +namespace: +- kind: CustomResourceDefinition + version: v1 + group: apiextensions.k8s.io + path: spec/conversion/webhook/clientConfig/service/namespace + create: false + +varReference: +- path: metadata/annotations diff --git a/config/crd/patches/cainjection_in_clusterhealthchecks.yaml b/config/crd/patches/cainjection_in_clusterhealthchecks.yaml new file mode 100644 index 0000000..9883a30 --- /dev/null +++ b/config/crd/patches/cainjection_in_clusterhealthchecks.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert # this is hardcoded with conversion-webhook repo + name: clusterhealthchecks.lib.projectsveltos.io diff --git a/config/crd/patches/cainjection_in_clustersets.yaml b/config/crd/patches/cainjection_in_clustersets.yaml new file mode 100644 index 0000000..bf594f2 --- /dev/null +++ b/config/crd/patches/cainjection_in_clustersets.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert # this is hardcoded with conversion-webhook repo + name: clustersets.lib.projectsveltos.io diff --git a/config/crd/patches/cainjection_in_rolerequests.yaml b/config/crd/patches/cainjection_in_rolerequests.yaml new file mode 100644 index 0000000..e807dce --- /dev/null +++ b/config/crd/patches/cainjection_in_rolerequests.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert # this is hardcoded with conversion-webhook repo + name: rolerequests.lib.projectsveltos.io diff --git a/config/crd/patches/cainjection_in_sets.yaml b/config/crd/patches/cainjection_in_sets.yaml new file mode 100644 index 0000000..4eb2218 --- /dev/null +++ b/config/crd/patches/cainjection_in_sets.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert # this is hardcoded with conversion-webhook repo + name: sets.lib.projectsveltos.io diff --git a/config/crd/patches/webhook_in_clusterhealthchecks.yaml b/config/crd/patches/webhook_in_clusterhealthchecks.yaml new file mode 100644 index 0000000..357514a --- /dev/null +++ b/config/crd/patches/webhook_in_clusterhealthchecks.yaml @@ -0,0 +1,16 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: clusterhealthchecks.lib.projectsveltos.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: projectsveltos + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 \ No newline at end of file diff --git a/config/crd/patches/webhook_in_clustersets.yaml b/config/crd/patches/webhook_in_clustersets.yaml new file mode 100644 index 0000000..cb66db7 --- /dev/null +++ b/config/crd/patches/webhook_in_clustersets.yaml @@ -0,0 +1,16 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: clustersets.lib.projectsveltos.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: projectsveltos + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 \ No newline at end of file diff --git a/config/crd/patches/webhook_in_rolerequests.yaml b/config/crd/patches/webhook_in_rolerequests.yaml new file mode 100644 index 0000000..121e38d --- /dev/null +++ b/config/crd/patches/webhook_in_rolerequests.yaml @@ -0,0 +1,16 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: rolerequests.lib.projectsveltos.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: projectsveltos + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 \ No newline at end of file diff --git a/config/crd/patches/webhook_in_sets.yaml b/config/crd/patches/webhook_in_sets.yaml new file mode 100644 index 0000000..2935a67 --- /dev/null +++ b/config/crd/patches/webhook_in_sets.yaml @@ -0,0 +1,16 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: sets.lib.projectsveltos.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: projectsveltos + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml new file mode 100644 index 0000000..3e4ad64 --- /dev/null +++ b/config/default/kustomization.yaml @@ -0,0 +1,20 @@ +resources: +- ../crd +# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in +# crd/kustomization.yaml +#- ../webhook +# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required. +#- ../certmanager +# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. +#- ../prometheus + + +# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in +# crd/kustomization.yaml +#- manager_webhook_patch.yaml + +# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. +# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks. +# 'CERTMANAGER' needs to be enabled to use ca injection +#- webhookcainjection_patch.yaml + diff --git a/generator.go b/generator.go index fedbd75..433907c 100644 --- a/generator.go +++ b/generator.go @@ -89,51 +89,51 @@ func generate(filename, outputFilename, crdName string) { } func main() { - classifierFile := "../../config/crd/bases/lib.projectsveltos.io_classifiers.yaml" + classifierFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifiers.lib.projectsveltos.io.yaml" generate(classifierFile, "classifiers", "Classifier") - classifierReportFile := "../../config/crd/bases/lib.projectsveltos.io_classifierreports.yaml" + classifierReportFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifierreports.lib.projectsveltos.io.yaml" generate(classifierReportFile, "classifierreports", "ClassifierReport") - debuggingConfigurationFile := "../../config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml" + debuggingConfigurationFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_debuggingconfigurations.lib.projectsveltos.io.yaml" generate(debuggingConfigurationFile, "debuggingconfigurations", "DebuggingConfiguration") - accessRequestFile := "../../config/crd/bases/lib.projectsveltos.io_accessrequests.yaml" + accessRequestFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_accessrequests.lib.projectsveltos.io.yaml" generate(accessRequestFile, "accessrequests", "AccessRequest") - sveltosClusterFile := "../../config/crd/bases/lib.projectsveltos.io_sveltosclusters.yaml" + sveltosClusterFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_sveltosclusters.lib.projectsveltos.io.yaml" generate(sveltosClusterFile, "sveltosclusters", "SveltosCluster") - resourceSummaryFile := "../../config/crd/bases/lib.projectsveltos.io_resourcesummaries.yaml" + resourceSummaryFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_resourcesummaries.lib.projectsveltos.io.yaml" generate(resourceSummaryFile, "resourcesummaries", "ResourceSummary") - roleRequestFile := "../../config/crd/bases/lib.projectsveltos.io_rolerequests.yaml" + roleRequestFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_rolerequests.lib.projectsveltos.io.yaml" generate(roleRequestFile, "rolerequests", "RoleRequest") - clusterHealthCheckFile := "../../config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml" + clusterHealthCheckFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_clusterhealthchecks.lib.projectsveltos.io.yaml" generate(clusterHealthCheckFile, "clusterhealthchecks", "ClusterHealthCheck") - healthCheckFile := "../../config/crd/bases/lib.projectsveltos.io_healthchecks.yaml" + healthCheckFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthchecks.lib.projectsveltos.io.yaml" generate(healthCheckFile, "healthchecks", "HealthCheck") - healthCheckReportFile := "../../config/crd/bases/lib.projectsveltos.io_healthcheckreports.yaml" + healthCheckReportFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthcheckreports.lib.projectsveltos.io.yaml" generate(healthCheckReportFile, "healthcheckreports", "HealthCheckReport") - eventSourceFile := "../../config/crd/bases/lib.projectsveltos.io_eventsources.yaml" + eventSourceFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventsources.lib.projectsveltos.io.yaml" generate(eventSourceFile, "eventsources", "EventSource") - eventReportFile := "../../config/crd/bases/lib.projectsveltos.io_eventreports.yaml" + eventReportFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventreports.lib.projectsveltos.io.yaml" generate(eventReportFile, "eventreports", "EventReport") - reloaderFile := "../../config/crd/bases/lib.projectsveltos.io_reloaders.yaml" + reloaderFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaders.lib.projectsveltos.io.yaml" generate(reloaderFile, "reloaders", "Reloader") - reloaderReportFile := "../../config/crd/bases/lib.projectsveltos.io_reloaderreports.yaml" + reloaderReportFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaderreports.lib.projectsveltos.io.yaml" generate(reloaderReportFile, "reloaderreports", "ReloaderReport") - clusterSetFile := "../../config/crd/bases/lib.projectsveltos.io_clustersets.yaml" + clusterSetFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_clustersets.lib.projectsveltos.io.yaml" generate(clusterSetFile, "clustersets", "ClusterSet") - setFile := "../../config/crd/bases/lib.projectsveltos.io_sets.yaml" + setFile := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_sets.lib.projectsveltos.io.yaml" generate(setFile, "sets", "Set") } diff --git a/lib/clusterproxy/cluster_utils.go b/lib/clusterproxy/cluster_utils.go index dd2aceb..910ce0c 100644 --- a/lib/clusterproxy/cluster_utils.go +++ b/lib/clusterproxy/cluster_utils.go @@ -22,9 +22,12 @@ import ( "os" "sync/atomic" + "github.com/go-logr/logr" + "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" @@ -33,10 +36,7 @@ import ( 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" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/lib/logsettings" logs "github.com/projectsveltos/libsveltos/lib/logsettings" "github.com/projectsveltos/libsveltos/lib/roles" @@ -55,14 +55,14 @@ var ( // getSveltosCluster returns SveltosCluster func getSveltosCluster(ctx context.Context, c client.Client, - clusterNamespace, clusterName string) (*libsveltosv1alpha1.SveltosCluster, error) { + clusterNamespace, clusterName string) (*libsveltosv1beta1.SveltosCluster, error) { clusterNamespacedName := types.NamespacedName{ Namespace: clusterNamespace, Name: clusterName, } - cluster := &libsveltosv1alpha1.SveltosCluster{} + cluster := &libsveltosv1beta1.SveltosCluster{} if err := c.Get(ctx, clusterNamespacedName, cluster); err != nil { return nil, err } @@ -87,9 +87,9 @@ func getCAPICluster(ctx context.Context, c client.Client, // getCluster returns the cluster object func GetCluster(ctx context.Context, c client.Client, - clusterNamespace, clusterName string, clusterType libsveltosv1alpha1.ClusterType) (client.Object, error) { + clusterNamespace, clusterName string, clusterType libsveltosv1beta1.ClusterType) (client.Object, error) { - if clusterType == libsveltosv1alpha1.ClusterTypeSveltos { + if clusterType == libsveltosv1beta1.ClusterTypeSveltos { return getSveltosCluster(ctx, c, clusterNamespace, clusterName) } return getCAPICluster(ctx, c, clusterNamespace, clusterName) @@ -121,9 +121,9 @@ func isSveltosClusterPaused(ctx context.Context, c client.Client, // IsClusterPaused returns true if cluster is currently paused func IsClusterPaused(ctx context.Context, c client.Client, - clusterNamespace, clusterName string, clusterType libsveltosv1alpha1.ClusterType) (bool, error) { + clusterNamespace, clusterName string, clusterType libsveltosv1beta1.ClusterType) (bool, error) { - if clusterType == libsveltosv1alpha1.ClusterTypeSveltos { + if clusterType == libsveltosv1beta1.ClusterTypeSveltos { return isSveltosClusterPaused(ctx, c, clusterNamespace, clusterName) } return isCAPIClusterPaused(ctx, c, clusterNamespace, clusterName) @@ -131,7 +131,7 @@ func IsClusterPaused(ctx context.Context, c client.Client, func getKubernetesRestConfigForAdmin(ctx context.Context, c client.Client, clusterNamespace, clusterName, adminNamespace, adminName string, - clusterType libsveltosv1alpha1.ClusterType, logger logr.Logger) (*rest.Config, error) { + clusterType libsveltosv1beta1.ClusterType, logger logr.Logger) (*rest.Config, error) { kubeconfigContent, err := roles.GetKubeconfig(ctx, c, clusterNamespace, clusterName, adminNamespace, adminName, clusterType) @@ -156,7 +156,7 @@ func getKubernetesRestConfigForAdmin(ctx context.Context, c client.Client, func getKubernetesClientForAdmin(ctx context.Context, c client.Client, clusterNamespace, clusterName, adminNamespace, adminName string, - clusterType libsveltosv1alpha1.ClusterType, logger logr.Logger) (client.Client, error) { + clusterType libsveltosv1beta1.ClusterType, logger logr.Logger) (client.Client, error) { config, err := getKubernetesRestConfigForAdmin(ctx, c, clusterNamespace, clusterName, adminNamespace, adminName, clusterType, logger) @@ -170,14 +170,14 @@ func getKubernetesClientForAdmin(ctx context.Context, c client.Client, // GetSecretData returns Kubeconfig to access cluster func GetSecretData(ctx context.Context, c client.Client, clusterNamespace, clusterName, adminNamespace, adminName string, - clusterType libsveltosv1alpha1.ClusterType, logger logr.Logger) ([]byte, error) { + clusterType libsveltosv1beta1.ClusterType, logger logr.Logger) ([]byte, error) { if adminName != "" && adminName != kubernetesAdmin { return roles.GetKubeconfig(ctx, c, clusterNamespace, clusterName, adminNamespace, adminName, clusterType) } - if clusterType == libsveltosv1alpha1.ClusterTypeSveltos { + if clusterType == libsveltosv1beta1.ClusterTypeSveltos { return GetSveltosSecretData(ctx, logger, c, clusterNamespace, clusterName) } return GetCAPISecretData(ctx, logger, c, clusterNamespace, clusterName) @@ -186,14 +186,14 @@ func GetSecretData(ctx context.Context, c client.Client, // GetKubernetesRestConfig returns restConfig for a cluster func GetKubernetesRestConfig(ctx context.Context, c client.Client, clusterNamespace, clusterName, adminNamespace, adminName string, - clusterType libsveltosv1alpha1.ClusterType, logger logr.Logger) (*rest.Config, error) { + clusterType libsveltosv1beta1.ClusterType, logger logr.Logger) (*rest.Config, error) { if adminName != "" && adminName != kubernetesAdmin { return getKubernetesRestConfigForAdmin(ctx, c, clusterNamespace, clusterName, adminNamespace, adminName, clusterType, logger) } - if clusterType == libsveltosv1alpha1.ClusterTypeSveltos { + if clusterType == libsveltosv1beta1.ClusterTypeSveltos { return GetSveltosKubernetesRestConfig(ctx, logger, c, clusterNamespace, clusterName) } return GetCAPIKubernetesRestConfig(ctx, logger, c, clusterNamespace, clusterName) @@ -202,31 +202,31 @@ func GetKubernetesRestConfig(ctx context.Context, c client.Client, // GetKubernetesClient returns client to access cluster func GetKubernetesClient(ctx context.Context, c client.Client, clusterNamespace, clusterName, adminNamespace, adminName string, - clusterType libsveltosv1alpha1.ClusterType, logger logr.Logger) (client.Client, error) { + clusterType libsveltosv1beta1.ClusterType, logger logr.Logger) (client.Client, error) { if adminName != "" && adminName != kubernetesAdmin { return getKubernetesClientForAdmin(ctx, c, clusterNamespace, clusterName, adminNamespace, adminName, clusterType, logger) } - if clusterType == libsveltosv1alpha1.ClusterTypeSveltos { + if clusterType == libsveltosv1beta1.ClusterTypeSveltos { return GetSveltosKubernetesClient(ctx, logger, c, c.Scheme(), clusterNamespace, clusterName) } return GetCAPIKubernetesClient(ctx, logger, c, c.Scheme(), clusterNamespace, clusterName) } // GetClusterType returns clustertype for a given cluster -func GetClusterType(cluster *corev1.ObjectReference) libsveltosv1alpha1.ClusterType { +func GetClusterType(cluster *corev1.ObjectReference) libsveltosv1beta1.ClusterType { // TODO: remove this - if cluster.APIVersion != libsveltosv1alpha1.GroupVersion.String() && + if cluster.APIVersion != libsveltosv1beta1.GroupVersion.String() && cluster.APIVersion != clusterv1.GroupVersion.String() { panic(1) } - clusterType := libsveltosv1alpha1.ClusterTypeCapi - if cluster.APIVersion == libsveltosv1alpha1.GroupVersion.String() { - clusterType = libsveltosv1alpha1.ClusterTypeSveltos + clusterType := libsveltosv1beta1.ClusterTypeCapi + if cluster.APIVersion == libsveltosv1beta1.GroupVersion.String() { + clusterType = libsveltosv1beta1.ClusterTypeSveltos } return clusterType } @@ -312,7 +312,7 @@ func getListOfSveltosCluster(ctx context.Context, c client.Client, namespace str listOptions = append(listOptions, client.InNamespace(namespace)) } - clusterList := &libsveltosv1alpha1.SveltosClusterList{} + clusterList := &libsveltosv1beta1.SveltosClusterList{} if err := c.List(ctx, clusterList, listOptions...); err != nil { logger.Error(err, "failed to list all Cluster") return nil, err @@ -388,11 +388,6 @@ func GetListOfClustersForShardKey(ctx context.Context, c client.Client, namespac func getMatchingCAPIClusters(ctx context.Context, c client.Client, selector labels.Selector, namespace string, logger logr.Logger) ([]corev1.ObjectReference, error) { - if selector == nil { - logger.V(logs.LogInfo).Info(nilSelectorMessage) - return nil, fmt.Errorf("%s", nilSelectorMessage) - } - present, err := isCAPIPresent(ctx, c, logger) if err != nil { logger.Error(err, "failed to verify if ClusterAPI Cluster CRD is installed") @@ -456,7 +451,7 @@ func getMatchingSveltosClusters(ctx context.Context, c client.Client, selector l listOptions = append(listOptions, client.InNamespace(namespace)) } - clusterList := &libsveltosv1alpha1.SveltosClusterList{} + clusterList := &libsveltosv1beta1.SveltosClusterList{} if err := c.List(ctx, clusterList, listOptions...); err != nil { logger.Error(err, "failed to list all Cluster") return nil, err @@ -492,7 +487,7 @@ func getMatchingSveltosClusters(ctx context.Context, c client.Client, selector l } // GetMatchingClusters returns all Sveltos/CAPI Clusters currently matching selector -func GetMatchingClusters(ctx context.Context, c client.Client, selector labels.Selector, +func GetMatchingClusters(ctx context.Context, c client.Client, selector *metav1.LabelSelector, namespace string, logger logr.Logger) ([]corev1.ObjectReference, error) { if selector == nil { @@ -502,14 +497,20 @@ func GetMatchingClusters(ctx context.Context, c client.Client, selector labels.S matching := make([]corev1.ObjectReference, 0) - tmpMatching, err := getMatchingCAPIClusters(ctx, c, selector, namespace, logger) + clusterSelector, err := metav1.LabelSelectorAsSelector(selector) + if err != nil { + logger.V(logs.LogInfo).Info(fmt.Sprintf("failed to convert selector %v", err)) + return nil, fmt.Errorf("%w", err) + } + + tmpMatching, err := getMatchingCAPIClusters(ctx, c, clusterSelector, namespace, logger) if err != nil { return nil, err } matching = append(matching, tmpMatching...) - tmpMatching, err = getMatchingSveltosClusters(ctx, c, selector, namespace, logger) + tmpMatching, err = getMatchingSveltosClusters(ctx, c, clusterSelector, namespace, logger) if err != nil { return nil, err } diff --git a/lib/clusterproxy/cluster_utils_test.go b/lib/clusterproxy/cluster_utils_test.go index 4a46eae..8031750 100644 --- a/lib/clusterproxy/cluster_utils_test.go +++ b/lib/clusterproxy/cluster_utils_test.go @@ -24,13 +24,12 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" "k8s.io/klog/v2/textlogger" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/internal/test/helpers/external" "github.com/projectsveltos/libsveltos/lib/clusterproxy" "github.com/projectsveltos/libsveltos/lib/sharding" @@ -39,7 +38,7 @@ import ( var _ = Describe("Cluster utils", func() { var namespace string var cluster *clusterv1.Cluster - var sveltosCluster *libsveltosv1alpha1.SveltosCluster + var sveltosCluster *libsveltosv1beta1.SveltosCluster BeforeEach(func() { namespace = "cluster-utils" + randomString() @@ -57,15 +56,15 @@ var _ = Describe("Cluster utils", func() { }, } - sveltosCluster = &libsveltosv1alpha1.SveltosCluster{ + sveltosCluster = &libsveltosv1beta1.SveltosCluster{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), Namespace: namespace, }, - Spec: libsveltosv1alpha1.SveltosClusterSpec{ + Spec: libsveltosv1beta1.SveltosClusterSpec{ Paused: true, }, - Status: libsveltosv1alpha1.SveltosClusterStatus{ + Status: libsveltosv1beta1.SveltosClusterStatus{ Ready: true, }, } @@ -79,12 +78,12 @@ var _ = Describe("Cluster utils", func() { c := fake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build() paused, err := clusterproxy.IsClusterPaused(context.TODO(), c, cluster.Namespace, - cluster.Name, libsveltosv1alpha1.ClusterTypeCapi) + cluster.Name, libsveltosv1beta1.ClusterTypeCapi) Expect(err).To(BeNil()) Expect(paused).To(BeTrue()) paused, err = clusterproxy.IsClusterPaused(context.TODO(), c, sveltosCluster.Namespace, - sveltosCluster.Name, libsveltosv1alpha1.ClusterTypeSveltos) + sveltosCluster.Name, libsveltosv1beta1.ClusterTypeSveltos) Expect(err).To(BeNil()) Expect(paused).To(BeTrue()) }) @@ -99,12 +98,12 @@ var _ = Describe("Cluster utils", func() { c := fake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build() paused, err := clusterproxy.IsClusterPaused(context.TODO(), c, cluster.Namespace, - cluster.Name, libsveltosv1alpha1.ClusterTypeCapi) + cluster.Name, libsveltosv1beta1.ClusterTypeCapi) Expect(err).To(BeNil()) Expect(paused).To(BeFalse()) paused, err = clusterproxy.IsClusterPaused(context.TODO(), c, sveltosCluster.Namespace, - sveltosCluster.Name, libsveltosv1alpha1.ClusterTypeSveltos) + sveltosCluster.Name, libsveltosv1beta1.ClusterTypeSveltos) Expect(err).To(BeNil()) Expect(paused).To(BeFalse()) }) @@ -141,13 +140,13 @@ var _ = Describe("Cluster utils", func() { c := fake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build() data, err := clusterproxy.GetSecretData(context.TODO(), c, cluster.Namespace, cluster.Name, - "", "", libsveltosv1alpha1.ClusterTypeCapi, + "", "", libsveltosv1beta1.ClusterTypeCapi, textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1)))) Expect(err).To(BeNil()) Expect(data).To(Equal(randomData)) data, err = clusterproxy.GetSecretData(context.TODO(), c, sveltosCluster.Namespace, sveltosCluster.Name, - "", "", libsveltosv1alpha1.ClusterTypeSveltos, + "", "", libsveltosv1beta1.ClusterTypeSveltos, textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1)))) Expect(err).To(BeNil()) Expect(data).To(Equal(randomData)) @@ -263,30 +262,45 @@ var _ = Describe("Cluster utils", func() { }) It("getMatchingClusters returns matchin CAPI Cluster", func() { - selector := libsveltosv1alpha1.Selector("env=qa,zone=west") + selector := libsveltosv1beta1.Selector{ + LabelSelector: metav1.LabelSelector{ + MatchExpressions: []metav1.LabelSelectorRequirement{ + { + Key: "env", + Operator: metav1.LabelSelectorOpIn, + Values: []string{"qa"}, + }, + { + Key: "zone", + Operator: metav1.LabelSelectorOpIn, + Values: []string{"west"}, + }, + }, + }, + } currentLabels := map[string]string{ "env": "qa", "zone": "west", } - sveltosCluster := &libsveltosv1alpha1.SveltosCluster{ + sveltosCluster := &libsveltosv1beta1.SveltosCluster{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), Namespace: randomString(), Labels: currentLabels, }, - Status: libsveltosv1alpha1.SveltosClusterStatus{ + Status: libsveltosv1beta1.SveltosClusterStatus{ Ready: true, }, } - nonMatchingSveltosCluster := &libsveltosv1alpha1.SveltosCluster{ + nonMatchingSveltosCluster := &libsveltosv1beta1.SveltosCluster{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), Namespace: randomString(), }, - Status: libsveltosv1alpha1.SveltosClusterStatus{ + Status: libsveltosv1beta1.SveltosClusterStatus{ Ready: true, }, } @@ -301,9 +315,7 @@ var _ = Describe("Cluster utils", func() { c := fake.NewClientBuilder().WithScheme(scheme).WithStatusSubresource(initObjects...).WithObjects(initObjects...).Build() - parsedSelector, _ := labels.Parse(string(selector)) - - matches, err := clusterproxy.GetMatchingClusters(context.TODO(), c, parsedSelector, "", + matches, err := clusterproxy.GetMatchingClusters(context.TODO(), c, &selector.LabelSelector, "", textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1)))) Expect(err).To(BeNil()) Expect(len(matches)).To(Equal(2)) @@ -312,60 +324,67 @@ var _ = Describe("Cluster utils", func() { Kind: "Cluster", APIVersion: clusterv1.GroupVersion.String()})) Expect(matches).To(ContainElement( corev1.ObjectReference{Namespace: sveltosCluster.Namespace, Name: sveltosCluster.Name, - Kind: libsveltosv1alpha1.SveltosClusterKind, APIVersion: libsveltosv1alpha1.GroupVersion.String()})) + Kind: libsveltosv1beta1.SveltosClusterKind, APIVersion: libsveltosv1beta1.GroupVersion.String()})) - matches, err = clusterproxy.GetMatchingClusters(context.TODO(), c, parsedSelector, + matches, err = clusterproxy.GetMatchingClusters(context.TODO(), c, &selector.LabelSelector, sveltosCluster.Namespace, textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1)))) Expect(err).To(BeNil()) Expect(len(matches)).To(Equal(1)) Expect(matches).To(ContainElement( corev1.ObjectReference{Namespace: sveltosCluster.Namespace, Name: sveltosCluster.Name, - Kind: libsveltosv1alpha1.SveltosClusterKind, APIVersion: libsveltosv1alpha1.GroupVersion.String()})) + Kind: libsveltosv1beta1.SveltosClusterKind, APIVersion: libsveltosv1beta1.GroupVersion.String()})) }) It("getMatchingClusters returns matchin CAPI Cluster", func() { - selector := libsveltosv1alpha1.ClusterSelector{ + key1 := randomString() + value1 := randomString() + key2 := randomString() + value2 := randomString() + + selector := libsveltosv1beta1.Selector{ LabelSelector: metav1.LabelSelector{ MatchExpressions: []metav1.LabelSelectorRequirement{ { - Key: "env", + Key: key1, Operator: metav1.LabelSelectorOpIn, - Values: []string{"qa"}, + Values: []string{value1}, }, { - Key: "zone", + Key: key2, Operator: metav1.LabelSelectorOpIn, - Values: []string{"west"}, + Values: []string{value2}, }, }, }, } currentLabels := map[string]string{ - "env": "qa", - "zone": "west", + key1: value1, + key2: value2, } - parsedSelector, _ := selector.ToSelector() - - sveltosCluster := &libsveltosv1alpha1.SveltosCluster{ + sveltosCluster := &libsveltosv1beta1.SveltosCluster{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), Namespace: randomString(), Labels: currentLabels, }, - Status: libsveltosv1alpha1.SveltosClusterStatus{ + Status: libsveltosv1beta1.SveltosClusterStatus{ Ready: true, }, } - nonMatchingSveltosCluster := &libsveltosv1alpha1.SveltosCluster{ + nonMatchingSveltosCluster := &libsveltosv1beta1.SveltosCluster{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), Namespace: randomString(), + Labels: map[string]string{ + randomString(): randomString(), + key1: value1, + }, }, - Status: libsveltosv1alpha1.SveltosClusterStatus{ + Status: libsveltosv1beta1.SveltosClusterStatus{ Ready: true, }, } @@ -380,7 +399,7 @@ var _ = Describe("Cluster utils", func() { c := fake.NewClientBuilder().WithScheme(scheme).WithStatusSubresource(initObjects...).WithObjects(initObjects...).Build() - matches, err := clusterproxy.GetMatchingClusters(context.TODO(), c, parsedSelector, "", + matches, err := clusterproxy.GetMatchingClusters(context.TODO(), c, &selector.LabelSelector, "", textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1)))) Expect(err).To(BeNil()) Expect(len(matches)).To(Equal(2)) @@ -389,16 +408,15 @@ var _ = Describe("Cluster utils", func() { Kind: "Cluster", APIVersion: clusterv1.GroupVersion.String()})) Expect(matches).To(ContainElement( corev1.ObjectReference{Namespace: sveltosCluster.Namespace, Name: sveltosCluster.Name, - Kind: libsveltosv1alpha1.SveltosClusterKind, APIVersion: libsveltosv1alpha1.GroupVersion.String()})) + Kind: libsveltosv1beta1.SveltosClusterKind, APIVersion: libsveltosv1beta1.GroupVersion.String()})) - matches, err = clusterproxy.GetMatchingClusters(context.TODO(), c, parsedSelector, + matches, err = clusterproxy.GetMatchingClusters(context.TODO(), c, &selector.LabelSelector, sveltosCluster.Namespace, textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1)))) Expect(err).To(BeNil()) Expect(len(matches)).To(Equal(1)) Expect(matches).To(ContainElement( corev1.ObjectReference{Namespace: sveltosCluster.Namespace, Name: sveltosCluster.Name, - Kind: libsveltosv1alpha1.SveltosClusterKind, APIVersion: libsveltosv1alpha1.GroupVersion.String()})) + Kind: libsveltosv1beta1.SveltosClusterKind, APIVersion: libsveltosv1beta1.GroupVersion.String()})) }) - }) diff --git a/lib/clusterproxy/clusterproxy.go b/lib/clusterproxy/clusterproxy.go index 90bd965..9f3ea17 100644 --- a/lib/clusterproxy/clusterproxy.go +++ b/lib/clusterproxy/clusterproxy.go @@ -32,7 +32,7 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/controller-runtime/pkg/client" - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" logs "github.com/projectsveltos/libsveltos/lib/logsettings" ) @@ -162,7 +162,7 @@ func GetSveltosSecretData(ctx context.Context, logger logr.Logger, c client.Clie Name: clusterName, } - cluster := libsveltosv1alpha1.SveltosCluster{} + cluster := libsveltosv1beta1.SveltosCluster{} if err := c.Get(ctx, key, &cluster); err != nil { if apierrors.IsNotFound(err) { logger.Info("SveltosCluster does not exist") @@ -195,7 +195,7 @@ func UpdateSveltosSecretData(ctx context.Context, logger logr.Logger, c client.C Name: clusterName, } - cluster := libsveltosv1alpha1.SveltosCluster{} + cluster := libsveltosv1beta1.SveltosCluster{} if err := c.Get(ctx, key, &cluster); err != nil { if apierrors.IsNotFound(err) { logger.Info("SveltosCluster does not exist") @@ -238,7 +238,7 @@ func IsClusterReadyToBeConfigured( cluster *corev1.ObjectReference, logger logr.Logger, ) (bool, error) { - if cluster.Kind == libsveltosv1alpha1.SveltosClusterKind { + if cluster.Kind == libsveltosv1beta1.SveltosClusterKind { return isSveltosClusterReadyToBeConfigured(ctx, c, cluster, logger) } @@ -252,7 +252,7 @@ func isSveltosClusterReadyToBeConfigured( cluster *corev1.ObjectReference, logger logr.Logger, ) (bool, error) { - sveltosCluster := &libsveltosv1alpha1.SveltosCluster{} + sveltosCluster := &libsveltosv1beta1.SveltosCluster{} err := c.Get(ctx, types.NamespacedName{Namespace: cluster.Namespace, Name: cluster.Name}, sveltosCluster) if err != nil { logger.Info(fmt.Sprintf("Failed to get SveltosCluster %v", err)) @@ -262,7 +262,7 @@ func isSveltosClusterReadyToBeConfigured( return isSveltosClusterStatusReady(sveltosCluster), nil } -func isSveltosClusterStatusReady(sveltosCluster *libsveltosv1alpha1.SveltosCluster) bool { +func isSveltosClusterStatusReady(sveltosCluster *libsveltosv1beta1.SveltosCluster) bool { return sveltosCluster.Status.Ready } diff --git a/lib/clusterproxy/clusterproxy_test.go b/lib/clusterproxy/clusterproxy_test.go index 34869dc..b7a85f5 100644 --- a/lib/clusterproxy/clusterproxy_test.go +++ b/lib/clusterproxy/clusterproxy_test.go @@ -37,7 +37,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/lib/clusterproxy" ) @@ -53,7 +53,7 @@ func setupScheme() (*runtime.Scheme, error) { if err := clientgoscheme.AddToScheme(s); err != nil { return nil, err } - if err := libsveltosv1alpha1.AddToScheme(s); err != nil { + if err := libsveltosv1beta1.AddToScheme(s); err != nil { return nil, err } if err := apiextensionsv1.AddToScheme(s); err != nil { @@ -65,7 +65,7 @@ func setupScheme() (*runtime.Scheme, error) { var _ = Describe("clusterproxy ", func() { var logger logr.Logger var cluster *clusterv1.Cluster - var sveltosCluster *libsveltosv1alpha1.SveltosCluster + var sveltosCluster *libsveltosv1beta1.SveltosCluster var namespace string var scheme *runtime.Scheme @@ -87,7 +87,7 @@ var _ = Describe("clusterproxy ", func() { }, } - sveltosCluster = &libsveltosv1alpha1.SveltosCluster{ + sveltosCluster = &libsveltosv1beta1.SveltosCluster{ ObjectMeta: metav1.ObjectMeta{ Name: upstreamClusterNamePrefix + randomString(), Namespace: namespace, @@ -387,7 +387,7 @@ var _ = Describe("clusterproxy ", func() { &corev1.ObjectReference{ Namespace: sveltosCluster.Namespace, Name: sveltosCluster.Name, - Kind: libsveltosv1alpha1.SveltosClusterKind}, + Kind: libsveltosv1beta1.SveltosClusterKind}, textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1)))) Expect(err).To(BeNil()) Expect(ready).To(Equal(true)) @@ -399,7 +399,7 @@ var _ = Describe("clusterproxy ", func() { &corev1.ObjectReference{ Namespace: sveltosCluster.Namespace, Name: sveltosCluster.Name, - Kind: libsveltosv1alpha1.SveltosClusterKind}, + Kind: libsveltosv1beta1.SveltosClusterKind}, textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1)))) Expect(err).To(BeNil()) Expect(ready).To(Equal(false)) diff --git a/lib/crd/accessrequests.go b/lib/crd/accessrequests.go index f147c1d..bdd20dd 100644 --- a/lib/crd/accessrequests.go +++ b/lib/crd/accessrequests.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var AccessRequestFile = "../../config/crd/bases/lib.projectsveltos.io_accessrequests.yaml" -var AccessRequestCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var AccessRequestFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_accessrequests.lib.projectsveltos.io.yaml" +var AccessRequestCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -151,6 +150,127 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: AccessRequest is the Schema for the accessrequest 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: AccessRequestSpec defines the desired state of AccessRequest + properties: + controlPlaneEndpoint: + description: |- + ControlPlaneEndpoint represents the endpoint used to communicate with the + management cluster controlplane endpoint. It will be used when generating the + kubeconfig. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + name: + description: |- + Name is the name of the service account created + for this AccessRequest + type: string + namespace: + description: |- + Namespace is the namespace of the service account created + for this AccessRequest + type: string + type: + description: Type represent the type of the request + enum: + - SveltosAgent + - Different + type: string + required: + - controlPlaneEndpoint + - name + - namespace + - type + type: object + status: + description: AccessRequestStatus defines the status of AccessRequest + properties: + failureMessage: + description: FailureMessage provides more information if an error + occurs. + type: string + secretRef: + description: SecretRef points to the Secret containing Kubeconfig + 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: object + type: object + served: true storage: true subresources: status: {} diff --git a/lib/crd/classifierreports.go b/lib/crd/classifierreports.go index 3d144f7..d904ec7 100644 --- a/lib/crd/classifierreports.go +++ b/lib/crd/classifierreports.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var ClassifierReportFile = "../../config/crd/bases/lib.projectsveltos.io_classifierreports.yaml" -var ClassifierReportCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var ClassifierReportFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifierreports.lib.projectsveltos.io.yaml" +var ClassifierReportCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -34,6 +33,76 @@ spec: scope: Namespaced versions: - name: v1alpha1 + schema: + openAPIV3Schema: + description: ClassifierReport is the Schema for the classifierreports 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: + properties: + classifierName: + description: |- + ClassifierName is the name of the Classifier instance this report + is for. + type: string + clusterName: + description: |- + ClusterName is the name of the Cluster this ClusterReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + ClusterReport is for. + type: string + clusterType: + description: ClusterType is the type of Cluster + type: string + match: + description: |- + Match indicates whether Cluster is currently a match for + the Classifier instance this report is for + type: boolean + required: + - classifierName + - clusterName + - clusterNamespace + - clusterType + - match + type: object + status: + description: ClassifierReportStatus defines the observed state of ClassifierReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 schema: openAPIV3Schema: description: ClassifierReport is the Schema for the classifierreports API diff --git a/lib/crd/classifiers.go b/lib/crd/classifiers.go index f713dd2..8f081b3 100644 --- a/lib/crd/classifiers.go +++ b/lib/crd/classifiers.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var ClassifierFile = "../../config/crd/bases/lib.projectsveltos.io_classifiers.yaml" -var ClassifierCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var ClassifierFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifiers.lib.projectsveltos.io.yaml" +var ClassifierCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -349,6 +348,325 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: Classifier is the Schema for the classifiers 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: ClassifierSpec defines the desired state of Classifier + properties: + classifierLabels: + description: |- + ClassifierLabels is set of labels, key,value pair, that will be added to each + cluster matching Classifier instance + items: + properties: + key: + description: Key is the label key + type: string + value: + description: Value is the label value + type: string + required: + - key + - value + type: object + type: array + deployedResourceConstraint: + description: DeployedResourceConstraint allows to classify based on + current deployed resources + properties: + aggregatedClassification: + description: |- + AggregatedClassification is optional and can be used to specify a Lua function + that will be used to further detect whether the subset of the resources + selected using the ResourceSelector field are a match for this Classifier. + The function will receive the array of resources selected by ResourceSelectors. + If this field is not specified, a cluster is a match for Classifier instance, + if all ResourceSelectors returns at least one match. + This field allows to perform more complex evaluation on the resources, looking + at all resources together. + This can be useful for more sophisticated tasks, such as identifying resources + that are related to each other or that have similar properties. + The Lua function must return a struct with: + - "matching" field: boolean indicating whether cluster is a match; + - "message" field: (optional) message. + type: string + resourceSelectors: + description: |- + ResourceSelectors identifies what resources to select + If no AggregatedClassification is specified, a cluster is + a match for Classifier instance, if all ResourceSelectors returns at + least one match. + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based + on current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - resourceSelectors + type: object + kubernetesVersionConstraints: + description: KubernetesVersionConstraints allows to classify based + on current kubernetes version + items: + properties: + comparison: + description: Comparison indicate how to compare cluster kubernetes + version with the specified version + enum: + - Equal + - NotEqual + - GreaterThan + - LessThan + - GreaterThanOrEqualTo + - LessThanOrEqualTo + type: string + version: + description: Version is the kubernetes version + type: string + required: + - comparison + - version + type: object + type: array + required: + - classifierLabels + type: object + status: + description: ClassifierStatus defines the observed state of Classifier + properties: + clusterInfo: + description: |- + ClusterInfo reference all the cluster-api Cluster where Classifier + has been/is being deployed + items: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature in the + workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + type: array + machingClusterStatuses: + description: |- + MatchingClusterRefs reference all the cluster-api Cluster currently matching + Classifier + items: + properties: + clusterRef: + description: ClusterRef references the matching Cluster + 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 + managedLabels: + description: |- + ManagedLabels indicates the labels being managed on + the cluster by this Classifier instance + items: + type: string + type: array + unManagedLabels: + description: |- + UnManagedLabel indicates the labels this Classifier instance + would like to manage but cannot because different instance is + already managing it + items: + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + key: + description: |- + Key represents a label Classifier would like to manage + but cannot because currently managed by different instance + type: string + required: + - key + type: object + type: array + required: + - clusterRef + type: object + type: array + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/lib/crd/clusterhealthchecks.go b/lib/crd/clusterhealthchecks.go index f919feb..319a901 100644 --- a/lib/crd/clusterhealthchecks.go +++ b/lib/crd/clusterhealthchecks.go @@ -16,15 +16,25 @@ limitations under the License. */ package crd -var ClusterHealthCheckFile = "../../config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml" -var ClusterHealthCheckCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var ClusterHealthCheckFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_clusterhealthchecks.lib.projectsveltos.io.yaml" +var ClusterHealthCheckCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert controller-gen.kubebuilder.io/version: v0.15.0 name: clusterhealthchecks.lib.projectsveltos.io spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: webhook-service + namespace: projectsveltos + path: /convert + conversionReviewVersions: + - v1 group: lib.projectsveltos.io names: kind: ClusterHealthCheck @@ -200,6 +210,400 @@ spec: - type type: object type: array + required: + - clusterSelector + - livenessChecks + - notifications + type: object + status: + properties: + clusterCondition: + description: |- + ClusterConditions contains conditions and notification status for all clusters + matching ClusterHealthCheck instance + items: + properties: + clusterInfo: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature + in the workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + conditions: + description: Cluster conditions. + items: + description: Condition defines an observation of a Cluster + API resource operational state. + properties: + lastTransitionTime: + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + A human readable message indicating details about the transition. + This field may be empty. + type: string + name: + description: Condition name + type: string + reason: + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. + type: string + severity: + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, + Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + type: string + required: + - lastTransitionTime + - name + - status + - type + type: object + type: array + notificationSummaries: + description: NotificationSummaries contains status information + on notifications + items: + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + name: + description: Name of the notification check. + type: string + status: + description: NotificationStatus specifies the notification + status + enum: + - Delivered + - FailedToDeliver + type: string + required: + - name + - status + type: object + type: array + required: + - clusterInfo + type: object + type: array + matchingClusters: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterHealthCheck 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: ClusterHealthCheck is the Schema for the clusterhealthchecks + 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: ClusterHealthCheckSpec defines the desired state of ClusterHealthCheck + properties: + livenessChecks: + description: |- + LivenessChecks is a list of source of liveness checks to evaluate. + Anytime one of those changes, notifications will be sent + items: + properties: + livenessSourceRef: + description: |- + LivenessSourceRef is a reference to a liveness-specific resource that holds + the details for the liveness check. + 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 + name: + description: |- + Name of the liveness check. + Must be a DNS_LABEL and unique within the ClusterHealthCheck. + type: string + type: + description: Type specifies the type of liveness + enum: + - Addons + - HealthCheck + type: string + required: + - name + - type + type: object + type: array + notifications: + description: Notification is a list of source of events to evaluate. + items: + properties: + name: + description: |- + Name of the notification check. + Must be a DNS_LABEL and unique within the ClusterHealthCheck. + type: string + notificationRef: + description: |- + NotificationRef is a reference to a notification-specific resource that holds + the details for the notification. + 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: + description: NotificationType specifies the type of notification + enum: + - KubernetesEvent + - Slack + - Webex + - Discord + - Teams + type: string + required: + - name + - type + type: object + type: array selector: description: Selector identifies clusters to associate to. properties: @@ -247,7 +651,6 @@ spec: type: object x-kubernetes-map-type: atomic required: - - clusterSelector - livenessChecks - notifications type: object diff --git a/lib/crd/clustersets.go b/lib/crd/clustersets.go index 6cb593c..8a8748a 100644 --- a/lib/crd/clustersets.go +++ b/lib/crd/clustersets.go @@ -16,15 +16,25 @@ limitations under the License. */ package crd -var ClusterSetFile = "../../config/crd/bases/lib.projectsveltos.io_clustersets.yaml" -var ClusterSetCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var ClusterSetFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_clustersets.lib.projectsveltos.io.yaml" +var ClusterSetCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert controller-gen.kubebuilder.io/version: v0.15.0 name: clustersets.lib.projectsveltos.io spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: webhook-service + namespace: projectsveltos + path: /convert + conversionReviewVersions: + - v1 group: lib.projectsveltos.io names: kind: ClusterSet @@ -130,8 +140,238 @@ spec: MaxReplicas specifies the maximum number of clusters to be selected from the pool matching the clusterSelector. type: integer - selector: - description: Selector identifies clusters to associate to. + type: object + status: + description: Status defines the observed state of ClusterSet/Set + properties: + matchingClusterRefs: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterSet/Set 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. + + + 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 + selectedClusterRefs: + description: |- + SelectedClusters reference all the cluster currently selected among + all the ones matching + 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: ClusterSet is the Schema for the clustersets 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: + 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. + + + 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 properties: matchExpressions: description: matchExpressions is a list of label selector requirements. @@ -176,6 +416,11 @@ spec: type: object type: object x-kubernetes-map-type: atomic + maxReplicas: + description: |- + MaxReplicas specifies the maximum number of clusters to be selected + from the pool matching the clusterSelector. + type: integer type: object status: description: Status defines the observed state of ClusterSet/Set diff --git a/lib/crd/crd_test.go b/lib/crd/crd_test.go index 09ca873..9d41965 100644 --- a/lib/crd/crd_test.go +++ b/lib/crd/crd_test.go @@ -29,7 +29,7 @@ var _ = Describe("CRD", func() { It("Gets the Classifier CustomResourceDefinition", func() { yaml := crd.GetClassifierCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_classifiers.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifiers.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -39,7 +39,7 @@ var _ = Describe("CRD", func() { It("Gets the ClassifierReport CustomResourceDefinition", func() { yaml := crd.GetClassifierReportCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_classifierreports.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifierreports.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -49,7 +49,7 @@ var _ = Describe("CRD", func() { It("Gets the DebuggingConfiguration CustomResourceDefinition", func() { yaml := crd.GetDebuggingConfigurationCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_debuggingconfigurations.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -59,7 +59,7 @@ var _ = Describe("CRD", func() { It("Gets the AccessRequest CustomResourceDefinition", func() { yaml := crd.GetAccessRequestCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_accessrequests.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_accessrequests.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -69,7 +69,7 @@ var _ = Describe("CRD", func() { It("Gets the SveltosCluster CustomResourceDefinition", func() { yaml := crd.GetSveltosClusterCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_sveltosclusters.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_sveltosclusters.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -79,7 +79,7 @@ var _ = Describe("CRD", func() { It("Gets the ResourceSummary CustomResourceDefinition", func() { yaml := crd.GetResourceSummaryCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_resourcesummaries.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_resourcesummaries.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -89,7 +89,7 @@ var _ = Describe("CRD", func() { It("Gets the RoleRequest CustomResourceDefinition", func() { yaml := crd.GetRoleRequestCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_rolerequests.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_rolerequests.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -99,7 +99,7 @@ var _ = Describe("CRD", func() { It("Gets the ClusterHealthCheck CustomResourceDefinition", func() { yaml := crd.GetClusterHealthCheckCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_clusterhealthchecks.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -109,7 +109,7 @@ var _ = Describe("CRD", func() { It("Gets the HealthCheck CustomResourceDefinition", func() { yaml := crd.GetHealthCheckCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_healthchecks.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthchecks.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -119,7 +119,7 @@ var _ = Describe("CRD", func() { It("Gets the HealthCheckReport CustomResourceDefinition", func() { yaml := crd.GetHealthCheckReportCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_healthcheckreports.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthcheckreports.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -129,7 +129,7 @@ var _ = Describe("CRD", func() { It("Gets the EventSource CustomResourceDefinition", func() { yaml := crd.GetEventSourceCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_eventsources.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventsources.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -139,7 +139,7 @@ var _ = Describe("CRD", func() { It("Gets the EventReport CustomResourceDefinition", func() { yaml := crd.GetEventReportCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_eventreports.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventreports.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -149,7 +149,7 @@ var _ = Describe("CRD", func() { It("Gets the Reloader CustomResourceDefinition", func() { yaml := crd.GetReloaderCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_reloaders.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaders.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -159,7 +159,7 @@ var _ = Describe("CRD", func() { It("Gets the ReloaderReport CustomResourceDefinition", func() { yaml := crd.GetReloaderReportCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_reloaderreports.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaderreports.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -169,7 +169,7 @@ var _ = Describe("CRD", func() { It("Gets the ClusterSet CustomResourceDefinition", func() { yaml := crd.GetClusterSetCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_clustersets.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_clustersets.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) @@ -179,7 +179,7 @@ var _ = Describe("CRD", func() { It("Gets the Set CustomResourceDefinition", func() { yaml := crd.GetSetCRDYAML() - filename := "../../config/crd/bases/lib.projectsveltos.io_sets.yaml" + filename := "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_sets.lib.projectsveltos.io.yaml" currentFile, err := os.ReadFile(filename) Expect(err).To(BeNil()) diff --git a/lib/crd/debuggingconfigurations.go b/lib/crd/debuggingconfigurations.go index fc7f01d..0a54356 100644 --- a/lib/crd/debuggingconfigurations.go +++ b/lib/crd/debuggingconfigurations.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var DebuggingConfigurationFile = "../../config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml" -var DebuggingConfigurationCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var DebuggingConfigurationFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_debuggingconfigurations.lib.projectsveltos.io.yaml" +var DebuggingConfigurationCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -34,6 +33,72 @@ spec: scope: Cluster versions: - name: v1alpha1 + schema: + openAPIV3Schema: + description: DebuggingConfiguration is the Schema for the debuggingconfigurations + 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: DebuggingConfigurationSpec defines the desired state of DebuggingConfiguration + properties: + configuration: + description: Configuration contains debugging configuration as granular + as per component. + items: + description: ComponentConfiguration is the debugging configuration + to be applied to a Sveltos component. + properties: + component: + description: Component indicates which Sveltos component the + configuration applies to. + enum: + - AddonManager + - Classifier + - ClassifierAgent + - SveltosClusterManager + - DriftDetectionManager + - AccessManager + - HealthCheckManager + - EventManager + - ShardController + - UIBackend + type: string + logLevel: + description: 'LogLevel is the log severity above which logs + are sent to the stdout. [Default: Info]' + enum: + - LogLevelNotSet + - LogLevelInfo + - LogLevelDebug + - LogLevelVerbose + type: string + required: + - component + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: object + served: true + storage: false + - name: v1beta1 schema: openAPIV3Schema: description: DebuggingConfiguration is the Schema for the debuggingconfigurations diff --git a/lib/crd/eventreports.go b/lib/crd/eventreports.go index 72f808a..00f119a 100644 --- a/lib/crd/eventreports.go +++ b/lib/crd/eventreports.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var EventReportFile = "../../config/crd/bases/lib.projectsveltos.io_eventreports.yaml" -var EventReportCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var EventReportFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventreports.lib.projectsveltos.io.yaml" +var EventReportCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -97,6 +96,143 @@ spec: will affect numerous schemas. Don't make new APIs embed an underspecified API type they do not control. + 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 + resources: + description: |- + If EventSource Spec.CollectResources is set to true, all matching resources + will be collected and contained in the Resources field. + format: byte + type: string + required: + - clusterName + - clusterNamespace + - clusterType + - eventSourceName + type: object + status: + description: EventReportStatus defines the observed state of EventReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: EventReport is the Schema for the EventReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this EventReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + EventReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this EventReport + is for. + type: string + eventSourceName: + description: |- + EventSourceName is the name of the EventSource instance this report + is for. + type: string + matchingResources: + description: MatchingResources contains a list of resources matching + an event + 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. + + 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: diff --git a/lib/crd/eventsources.go b/lib/crd/eventsources.go index fc971a9..e833403 100644 --- a/lib/crd/eventsources.go +++ b/lib/crd/eventsources.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var EventSourceFile = "../../config/crd/bases/lib.projectsveltos.io_eventsources.yaml" -var EventSourceCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var EventSourceFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventsources.lib.projectsveltos.io.yaml" +var EventSourceCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -142,5 +141,115 @@ spec: type: object type: object served: true + storage: false + - name: v1beta1 + schema: + openAPIV3Schema: + description: EventSource is the Schema for the EventSource 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: EventSourceSpec defines the desired state of EventSource + properties: + aggregatedSelection: + description: |- + This field is optional and can be used to specify a Lua function + that will be used to further select a subset of the resources that + have already been selected using the ResourceSelector field. + The function will receive the array of resources selected by ResourceSelectors. + If this field is not specified, all resources selected by the ResourceSelector + field will be considered. + This field allows to perform more complex filtering or selection operations + on the resources, looking at all resources together. + This can be useful for more sophisticated tasks, such as identifying resources + that are related to each other or that have similar properties. + The Lua function must return a struct with: + - "resources" field: slice of matching resorces; + - "message" field: (optional) message. + type: string + collectResources: + default: false + description: |- + CollectResources indicates whether matching resources need + to be collected and added to EventReport. + type: boolean + resourceSelectors: + description: ResourceSelectors identifies what resources to select + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based on + current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - resourceSelectors + type: object + type: object + served: true storage: true `) diff --git a/lib/crd/healthcheckreports.go b/lib/crd/healthcheckreports.go index 36f213a..ab79577 100644 --- a/lib/crd/healthcheckreports.go +++ b/lib/crd/healthcheckreports.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var HealthCheckReportFile = "../../config/crd/bases/lib.projectsveltos.io_healthcheckreports.yaml" -var HealthCheckReportCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var HealthCheckReportFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthcheckreports.lib.projectsveltos.io.yaml" +var HealthCheckReportCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -167,6 +166,143 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: HealthCheckReport is the Schema for the HealthCheckReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this HealthCheckReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + HealthCheckReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this HealthCheckReport + is for. + type: string + healthCheckName: + description: |- + HealthName is the name of the HealthCheck instance this report + is for. + type: string + resourceStatuses: + description: ResourceStatuses contains a list of resources with their + status + items: + properties: + healthStatus: + description: HealthStatus is the health status of the object + enum: + - Healthy + - Progressing + - Degraded + - Suspended + type: string + message: + description: Message is an extra message for human consumption + type: string + objectRef: + description: ObjectRef for which status is reported + 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 + resource: + description: |- + If HealthCheck Spec.CollectResources is set to true, resource + will be collected and contained in the Resource field. + format: byte + type: string + required: + - healthStatus + - objectRef + type: object + type: array + required: + - clusterName + - clusterNamespace + - clusterType + - healthCheckName + type: object + status: + description: HealthCheckReportStatus defines the observed state of HealthCheckReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/lib/crd/healthchecks.go b/lib/crd/healthchecks.go index 1743b88..081a51e 100644 --- a/lib/crd/healthchecks.go +++ b/lib/crd/healthchecks.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var HealthCheckFile = "../../config/crd/bases/lib.projectsveltos.io_healthchecks.yaml" -var HealthCheckCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var HealthCheckFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthchecks.lib.projectsveltos.io.yaml" +var HealthCheckCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -140,5 +139,113 @@ spec: type: object type: object served: true + storage: false + - name: v1beta1 + schema: + openAPIV3Schema: + description: HealthCheck is the Schema for the HealthCheck 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: HealthCheckSpec defines the desired state of HealthCheck + properties: + collectResources: + default: false + description: |- + CollectResources indicates whether matching resources need + to be collected and added to HealthReport. + type: boolean + evaluateHealth: + description: |- + The EvaluateHealth field specifies a Lua function responsible for evaluating the + health of the resources selected by resourceSelectors. + This function can assess the health of each resource independently or consider inter-resource relationships. + The function must be named *evaluate* and can access all objects identified by resourceSelectors using + the *resources* variable. It should return an array of structured instances, each containing the following fields: + - resource: The resource being evaluated + - healthStatus: The health status of the resource, which can be one of "Healthy", "Progressing", "Degraded", or "Suspended" + - message: An optional message providing additional information about the health status + minLength: 1 + type: string + resourceSelectors: + description: ResourceSelectors identifies what resources to select + to evaluate health + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based on + current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - evaluateHealth + - resourceSelectors + type: object + type: object + served: true storage: true `) diff --git a/lib/crd/reloaderreports.go b/lib/crd/reloaderreports.go index 4bb9a95..a12fd30 100644 --- a/lib/crd/reloaderreports.go +++ b/lib/crd/reloaderreports.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var ReloaderReportFile = "../../config/crd/bases/lib.projectsveltos.io_reloaderreports.yaml" -var ReloaderReportCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var ReloaderReportFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaderreports.lib.projectsveltos.io.yaml" +var ReloaderReportCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -34,6 +33,99 @@ spec: scope: Namespaced versions: - name: v1alpha1 + schema: + openAPIV3Schema: + description: ReloaderReport is the Schema for the ReloaderReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this ReloaderReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + ReloaderReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this ReloaderReport + is for. + type: string + resourcesToReload: + description: |- + ResourcesToReload contains a list of resources that requires + rolling upgrade + items: + description: |- + ReloaderInfo represents a resource that need to be reloaded + if any mounted ConfigMap/Secret changes. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Deployment + StatefulSet DaemonSet.' + enum: + - Deployment + - StatefulSet + - DaemonSet + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: Namespace of the referenced resource. + minLength: 1 + type: string + value: + type: string + required: + - kind + - name + - namespace + type: object + type: array + required: + - clusterName + - clusterNamespace + - clusterType + type: object + status: + description: ReloaderReportStatus defines the observed state of ReloaderReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 schema: openAPIV3Schema: description: ReloaderReport is the Schema for the ReloaderReport API diff --git a/lib/crd/reloaders.go b/lib/crd/reloaders.go index 4837dba..130c506 100644 --- a/lib/crd/reloaders.go +++ b/lib/crd/reloaders.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var ReloaderFile = "../../config/crd/bases/lib.projectsveltos.io_reloaders.yaml" -var ReloaderCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var ReloaderFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaders.lib.projectsveltos.io.yaml" +var ReloaderCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -34,6 +33,65 @@ spec: scope: Cluster versions: - name: v1alpha1 + schema: + openAPIV3Schema: + description: Reloader is the Schema for the Reloader 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: ReloaderSpec defines the desired state of Reloader + properties: + reloaderInfo: + items: + description: |- + ReloaderInfo represents a resource that need to be reloaded + if any mounted ConfigMap/Secret changes. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Deployment + StatefulSet DaemonSet.' + enum: + - Deployment + - StatefulSet + - DaemonSet + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: Namespace of the referenced resource. + minLength: 1 + type: string + value: + type: string + required: + - kind + - name + - namespace + type: object + type: array + type: object + type: object + served: true + storage: false + - name: v1beta1 schema: openAPIV3Schema: description: Reloader is the Schema for the Reloader API diff --git a/lib/crd/resourcesummaries.go b/lib/crd/resourcesummaries.go index 6cd4eda..2b2639b 100644 --- a/lib/crd/resourcesummaries.go +++ b/lib/crd/resourcesummaries.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var ResourceSummaryFile = "../../config/crd/bases/lib.projectsveltos.io_resourcesummaries.yaml" -var ResourceSummaryCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var ResourceSummaryFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_resourcesummaries.lib.projectsveltos.io.yaml" +var ResourceSummaryCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -292,6 +291,268 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: ResourceSummary is the Schema for the ResourceSummary 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: ResourceSummarySpec defines the desired state of ResourceSummary + properties: + chartResources: + description: Resources deployed by ClusterSummary because of referenced + Helm charts + items: + properties: + chartName: + description: ChartName is the chart name + minLength: 1 + type: string + group: + description: Resources deployed by ClusterSummary because of + helm charts + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + releaseName: + description: ReleaseName is the chart release + minLength: 1 + type: string + releaseNamespace: + description: ReleaseNamespace is the namespace release will + be installed + minLength: 1 + type: string + required: + - chartName + - releaseName + - releaseNamespace + type: object + type: array + kustomizeResources: + description: |- + KustomizeResources deployed by ClusterSummary because of referenced + KustomizationRef + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + resources: + description: Resources deployed by ClusterSummary because of referenced + ConfigMaps/Secrets + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + type: object + status: + description: ResourceSummaryStatus defines the status of ResourceSummary + properties: + helmResourceHashes: + description: HelmResourceHashes specifies list of resource plus hash. + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + helmResourcesChanged: + description: Helm Resources changed. + type: boolean + kustomizeResourceHashes: + description: KustomizeResourceHashes specifies a list of resource + plus hash + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + kustomizeResourcesChanged: + description: KustomizeResources changed. + type: boolean + resourceHashes: + description: ResourceHashes specifies a list of resource plus hash + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + resourcesChanged: + description: Resources changed. + type: boolean + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/lib/crd/rolerequests.go b/lib/crd/rolerequests.go index f393d39..55ad064 100644 --- a/lib/crd/rolerequests.go +++ b/lib/crd/rolerequests.go @@ -16,15 +16,25 @@ limitations under the License. */ package crd -var RoleRequestFile = "../../config/crd/bases/lib.projectsveltos.io_rolerequests.yaml" -var RoleRequestCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var RoleRequestFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_rolerequests.lib.projectsveltos.io.yaml" +var RoleRequestCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert controller-gen.kubebuilder.io/version: v0.15.0 name: rolerequests.lib.projectsveltos.io spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: webhook-service + namespace: projectsveltos + path: /convert + conversionReviewVersions: + - v1 group: lib.projectsveltos.io names: kind: RoleRequest @@ -63,6 +73,238 @@ spec: ClusterSelector identifies clusters where permissions requestes in this instance will be granted (Deprecated use selector instead) type: string + expirationSeconds: + description: |- + ExpirationSeconds is the requested duration of validity of the TokenRequest + associated to ServiceAccount. If not specified, default value is used + format: int64 + type: integer + roleRefs: + description: |- + RoleRefs references all the Secret/ConfigMaps containing kubernetes + Roles/ClusterRoles that need to be deployed in the matching clusters. + items: + description: |- + PolicyRef specifies a resource containing one or more policy + to deploy in matching Clusters. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Secrets + and ConfigMaps.' + enum: + - Secret + - ConfigMap + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the referenced resource. + Namespace can be left empty. In such a case, namespace will + be implicit set to cluster's namespace. + type: string + required: + - kind + - name + - namespace + type: object + type: array + serviceAccountName: + description: |- + ServiceAccountName is the name of the ServiceAccount representing a tenant admin for which + those permissions are requested + type: string + serviceAccountNamespace: + description: |- + ServiceAccountNamespace is the name of the ServiceAccount representing a tenant admin + for which those permissions are requested + type: string + required: + - clusterSelector + - serviceAccountName + - serviceAccountNamespace + type: object + status: + description: RoleRequestStatus defines the status of RoleRequest + properties: + clusterInfo: + description: |- + ClusterInfo represents the hash of the ClusterRoles/Roles deployed in + a matching cluster for the admin. + items: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature in the + workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + type: array + failureMessage: + description: FailureMessage provides more information if an error + occurs. + type: string + matchingClusters: + description: |- + MatchingClusterRefs reference all the cluster currently matching + RoleRequest 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: RoleRequest is the Schema for the rolerequest 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: RoleRequestSpec defines the desired state of RoleRequest + properties: expirationSeconds: description: |- ExpirationSeconds is the requested duration of validity of the TokenRequest @@ -158,7 +400,6 @@ spec: for which those permissions are requested type: string required: - - clusterSelector - serviceAccountName - serviceAccountNamespace type: object diff --git a/lib/crd/sets.go b/lib/crd/sets.go index c811b54..bb8b418 100644 --- a/lib/crd/sets.go +++ b/lib/crd/sets.go @@ -16,15 +16,25 @@ limitations under the License. */ package crd -var SetFile = "../../config/crd/bases/lib.projectsveltos.io_sets.yaml" -var SetCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var SetFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_sets.lib.projectsveltos.io.yaml" +var SetCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert controller-gen.kubebuilder.io/version: v0.15.0 name: sets.lib.projectsveltos.io spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: webhook-service + namespace: projectsveltos + path: /convert + conversionReviewVersions: + - v1 group: lib.projectsveltos.io names: kind: Set @@ -130,8 +140,238 @@ spec: MaxReplicas specifies the maximum number of clusters to be selected from the pool matching the clusterSelector. type: integer - selector: - description: Selector identifies clusters to associate to. + type: object + status: + description: Status defines the observed state of ClusterSet/Set + properties: + matchingClusterRefs: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterSet/Set 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. + + + 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 + selectedClusterRefs: + description: |- + SelectedClusters reference all the cluster currently selected among + all the ones matching + 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: Set is the Schema for the sets 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: + 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. + + + 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 properties: matchExpressions: description: matchExpressions is a list of label selector requirements. @@ -176,6 +416,11 @@ spec: type: object type: object x-kubernetes-map-type: atomic + maxReplicas: + description: |- + MaxReplicas specifies the maximum number of clusters to be selected + from the pool matching the clusterSelector. + type: integer type: object status: description: Status defines the observed state of ClusterSet/Set diff --git a/lib/crd/sveltosclusters.go b/lib/crd/sveltosclusters.go index 81d24b7..e35fabd 100644 --- a/lib/crd/sveltosclusters.go +++ b/lib/crd/sveltosclusters.go @@ -16,9 +16,8 @@ limitations under the License. */ package crd -var SveltosClusterFile = "../../config/crd/bases/lib.projectsveltos.io_sveltosclusters.yaml" -var SveltosClusterCRD = []byte(`--- -apiVersion: apiextensions.k8s.io/v1 +var SveltosClusterFile = "../../manifests/apiextensions.k8s.io_v1_customresourcedefinition_sveltosclusters.lib.projectsveltos.io.yaml" +var SveltosClusterCRD = []byte(`apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -78,6 +77,96 @@ spec: to be hosted in a secret with the pattern ${sveltosClusterName}-sveltos-kubeconfig. + When a value is specified, the referenced Kubernetes Secret object must exist, + and will be used to connect to the Kubernetes cluster. + type: string + paused: + description: |- + Paused can be used to prevent controllers from processing the + SveltosCluster and all its associated objects. + type: boolean + tokenRequestRenewalOption: + description: TokenRequestRenewalOption contains options describing + how to renew TokenRequest + properties: + renewTokenRequestInterval: + description: RenewTokenRequestInterval is the interval at which + to renew the TokenRequest + type: string + required: + - renewTokenRequestInterval + type: object + type: object + status: + description: SveltosClusterStatus defines the status of SveltosCluster + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + lastReconciledTokenRequestAt: + description: |- + LastReconciledTokenRequestAt is the last time the TokenRequest + was renewed. + type: string + ready: + description: Ready is the state of the cluster. + type: boolean + version: + description: The Kubernetes version of the cluster. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - description: Indicates whether cluster is ready to be managed by sveltos + jsonPath: .status.ready + name: Ready + type: boolean + - description: Kubernetes version associated with this Cluster + jsonPath: .status.version + name: Version + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: SveltosCluster is the Schema for the SveltosCluster 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: SveltosClusterSpec defines the desired state of SveltosCluster + properties: + data: + additionalProperties: + type: string + description: ArbitraryData allows for arbitrary nested structures + type: object + kubeconfigName: + description: |- + KubeconfigName allows overriding the default Sveltos convention which expected a valid kubeconfig + to be hosted in a secret with the pattern ${sveltosClusterName}-sveltos-kubeconfig. + + When a value is specified, the referenced Kubernetes Secret object must exist, and will be used to connect to the Kubernetes cluster. type: string diff --git a/lib/deployer/client.go b/lib/deployer/client.go index bec192a..1249dd3 100644 --- a/lib/deployer/client.go +++ b/lib/deployer/client.go @@ -24,7 +24,7 @@ import ( "github.com/go-logr/logr" "sigs.k8s.io/controller-runtime/pkg/client" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + sveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" logs "github.com/projectsveltos/libsveltos/lib/logsettings" ) @@ -95,7 +95,7 @@ type Options struct { func (d *deployer) Deploy( ctx context.Context, clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType sveltosv1beta1.ClusterType, cleanup bool, f RequestHandler, m MetricHandler, @@ -144,7 +144,7 @@ func (d *deployer) Deploy( func (d *deployer) GetResult( ctx context.Context, clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType sveltosv1beta1.ClusterType, cleanup bool, ) Result { @@ -183,7 +183,7 @@ func (d *deployer) GetResult( func (d *deployer) IsInProgress( clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType sveltosv1beta1.ClusterType, cleanup bool, ) bool { @@ -204,7 +204,7 @@ func (d *deployer) IsInProgress( func (d *deployer) CleanupEntries( clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType sveltosv1beta1.ClusterType, cleanup bool) { key := GetKey(clusterNamespace, clusterName, applicant, featureID, clusterType, cleanup) diff --git a/lib/deployer/client_test.go b/lib/deployer/client_test.go index 3b5599b..e23b560 100644 --- a/lib/deployer/client_test.go +++ b/lib/deployer/client_test.go @@ -26,7 +26,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/lib/deployer" ) @@ -53,7 +53,7 @@ var _ = Describe("Client", func() { applicant := randomString() featureID := randomString() cleanup := false - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup) c := fake.NewClientBuilder().WithObjects(nil...).Build() ctx, cancel := context.WithCancel(context.TODO()) @@ -66,7 +66,7 @@ var _ = Describe("Client", func() { d.SetResults(r) Expect(len(d.GetResults())).To(Equal(1)) - result := d.GetResult(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + result := d.GetResult(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup) Expect(result.Err).To(BeNil()) Expect(result.ResultStatus).To(Equal(deployer.Deployed)) }) @@ -77,7 +77,7 @@ var _ = Describe("Client", func() { applicant := randomString() featureID := randomString() cleanup := false - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup) c := fake.NewClientBuilder().WithObjects(nil...).Build() ctx, cancel := context.WithCancel(context.TODO()) @@ -90,7 +90,7 @@ var _ = Describe("Client", func() { d.SetResults(r) Expect(len(d.GetResults())).To(Equal(1)) - result := d.GetResult(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + result := d.GetResult(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup) Expect(result.Err).ToNot(BeNil()) Expect(result.ResultStatus).To(Equal(deployer.Failed)) }) @@ -101,7 +101,7 @@ var _ = Describe("Client", func() { applicant := randomString() featureID := randomString() cleanup := true - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeSveltos, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeSveltos, cleanup) c := fake.NewClientBuilder().WithObjects(nil...).Build() ctx, cancel := context.WithCancel(context.TODO()) @@ -113,7 +113,7 @@ var _ = Describe("Client", func() { d.SetInProgress([]string{key}) Expect(len(d.GetInProgress())).To(Equal(1)) - result := d.GetResult(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeSveltos, cleanup) + result := d.GetResult(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeSveltos, cleanup) Expect(result.Err).To(BeNil()) Expect(result.ResultStatus).To(Equal(deployer.InProgress)) }) @@ -124,7 +124,7 @@ var _ = Describe("Client", func() { applicant := randomString() featureID := randomString() cleanup := false - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeSveltos, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeSveltos, cleanup) c := fake.NewClientBuilder().WithObjects(nil...).Build() ctx, cancel := context.WithCancel(context.TODO()) @@ -136,11 +136,11 @@ var _ = Describe("Client", func() { d.SetJobQueue(key, nil, nil) Expect(len(d.GetJobQueue())).To(Equal(1)) - result := d.GetResult(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeSveltos, cleanup) + result := d.GetResult(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeSveltos, cleanup) Expect(result.Err).To(BeNil()) Expect(result.ResultStatus).To(Equal(deployer.InProgress)) - result = d.GetResult(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + result = d.GetResult(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup) Expect(result.Err).To(BeNil()) Expect(result.ResultStatus).To(Equal(deployer.Unavailable)) }) @@ -159,11 +159,11 @@ var _ = Describe("Client", func() { textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1))), c, 10) defer d.ClearInternalStruct() - result := d.GetResult(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + result := d.GetResult(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup) Expect(result.Err).To(BeNil()) Expect(result.ResultStatus).To(Equal(deployer.Unavailable)) - result = d.GetResult(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeSveltos, cleanup) + result = d.GetResult(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeSveltos, cleanup) Expect(result.Err).To(BeNil()) Expect(result.ResultStatus).To(Equal(deployer.Unavailable)) }) @@ -181,7 +181,7 @@ var _ = Describe("Client", func() { d := deployer.GetClient(context.TODO(), textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1))), c, 10) - err := d.Deploy(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup, nil, nil, deployer.Options{}) + err := d.Deploy(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup, nil, nil, deployer.Options{}) Expect(err).ToNot(BeNil()) }) @@ -202,11 +202,11 @@ var _ = Describe("Client", func() { err := d.RegisterFeatureID(featureID) Expect(err).To(BeNil()) - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup) d.SetDirty([]string{key}) Expect(len(d.GetDirty())).To(Equal(1)) - err = d.Deploy(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, + err = d.Deploy(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup, nil, nil, deployer.Options{}) Expect(err).To(BeNil()) Expect(len(d.GetDirty())).To(Equal(1)) @@ -231,7 +231,7 @@ var _ = Describe("Client", func() { err := d.RegisterFeatureID(featureID) Expect(err).To(BeNil()) - err = d.Deploy(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup, nil, nil, deployer.Options{}) + err = d.Deploy(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup, nil, nil, deployer.Options{}) Expect(err).To(BeNil()) Expect(len(d.GetDirty())).To(Equal(1)) Expect(len(d.GetInProgress())).To(Equal(0)) @@ -244,7 +244,7 @@ var _ = Describe("Client", func() { applicant := randomString() featureID := randomString() cleanup := false - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeSveltos, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeSveltos, cleanup) c := fake.NewClientBuilder().WithObjects(nil...).Build() ctx, cancel := context.WithCancel(context.TODO()) @@ -259,7 +259,7 @@ var _ = Describe("Client", func() { d.SetInProgress([]string{key}) Expect(len(d.GetInProgress())).To(Equal(1)) - err = d.Deploy(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeSveltos, + err = d.Deploy(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeSveltos, cleanup, nil, nil, deployer.Options{}) Expect(err).To(BeNil()) Expect(len(d.GetDirty())).To(Equal(1)) @@ -273,7 +273,7 @@ var _ = Describe("Client", func() { applicant := randomString() featureID := randomString() cleanup := false - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup) c := fake.NewClientBuilder().WithObjects(nil...).Build() ctx, cancel := context.WithCancel(context.TODO()) @@ -289,7 +289,7 @@ var _ = Describe("Client", func() { d.SetResults(r) Expect(len(d.GetResults())).To(Equal(1)) - err = d.Deploy(ctx, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, + err = d.Deploy(ctx, ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup, nil, nil, deployer.Options{}) Expect(err).To(BeNil()) Expect(len(d.GetDirty())).To(Equal(1)) @@ -304,7 +304,7 @@ var _ = Describe("Client", func() { applicant := randomString() featureID := randomString() cleanup := false - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup) c := fake.NewClientBuilder().WithObjects(nil...).Build() _, cancel := context.WithCancel(context.TODO()) @@ -329,7 +329,7 @@ var _ = Describe("Client", func() { d.SetJobQueue(key, nil, nil) Expect(len(d.GetJobQueue())).To(Equal(1)) - d.CleanupEntries(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + d.CleanupEntries(ns, name, applicant, featureID, libsveltosv1beta1.ClusterTypeCapi, cleanup) Expect(len(d.GetDirty())).To(Equal(0)) Expect(len(d.GetInProgress())).To(Equal(1)) Expect(len(d.GetJobQueue())).To(Equal(0)) diff --git a/lib/deployer/deployer_suite_test.go b/lib/deployer/deployer_suite_test.go index 60eb5c4..854c84c 100644 --- a/lib/deployer/deployer_suite_test.go +++ b/lib/deployer/deployer_suite_test.go @@ -37,7 +37,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/internal/test/helpers" ) @@ -117,7 +117,7 @@ func setupScheme() (*runtime.Scheme, error) { if err := clientgoscheme.AddToScheme(s); err != nil { return nil, err } - if err := libsveltosv1alpha1.AddToScheme(s); err != nil { + if err := libsveltosv1beta1.AddToScheme(s); err != nil { return nil, err } diff --git a/lib/deployer/fake/client.go b/lib/deployer/fake/client.go index b236699..0fb7d0e 100644 --- a/lib/deployer/fake/client.go +++ b/lib/deployer/fake/client.go @@ -22,9 +22,8 @@ import ( "github.com/go-logr/logr" "sigs.k8s.io/controller-runtime/pkg/client" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/lib/deployer" - - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" ) // fakeDeployer is a fake provider that implements the DeployerInterface @@ -64,7 +63,7 @@ func (d *fakeDeployer) RegisterFeatureID( func (d *fakeDeployer) Deploy( ctx context.Context, clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType libsveltosv1beta1.ClusterType, cleanup bool, f deployer.RequestHandler, m deployer.MetricHandler, @@ -84,7 +83,7 @@ func (d *fakeDeployer) Deploy( func (d *fakeDeployer) GetResult( ctx context.Context, clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType libsveltosv1beta1.ClusterType, cleanup bool, ) deployer.Result { @@ -107,7 +106,7 @@ func (d *fakeDeployer) GetResult( func (d *fakeDeployer) IsInProgress( clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType libsveltosv1beta1.ClusterType, cleanup bool, ) bool { @@ -122,7 +121,7 @@ func (d *fakeDeployer) IsInProgress( func (d *fakeDeployer) CleanupEntries( clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType libsveltosv1beta1.ClusterType, cleanup bool) { key := deployer.GetKey(clusterNamespace, clusterName, applicant, featureID, clusterType, cleanup) @@ -134,7 +133,7 @@ func (d *fakeDeployer) CleanupEntries( // StoreResult store request result func (d *fakeDeployer) StoreResult( clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType libsveltosv1beta1.ClusterType, cleanup bool, err error, ) { @@ -146,7 +145,7 @@ func (d *fakeDeployer) StoreResult( // StoreInProgress marks request as in progress func (d *fakeDeployer) StoreInProgress( clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType libsveltosv1beta1.ClusterType, cleanup bool, ) { diff --git a/lib/deployer/request_interface.go b/lib/deployer/request_interface.go index 346250a..e6ae745 100644 --- a/lib/deployer/request_interface.go +++ b/lib/deployer/request_interface.go @@ -23,7 +23,7 @@ import ( "github.com/go-logr/logr" "sigs.k8s.io/controller-runtime/pkg/client" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" ) const ( @@ -63,11 +63,11 @@ type Result struct { type RequestHandler func(ctx context.Context, c client.Client, clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, o Options, logger logr.Logger) error + clusterType libsveltosv1beta1.ClusterType, o Options, logger logr.Logger) error type MetricHandler func(elapsed time.Duration, clusterNamespace, clusterName, featureID string, - clusterType sveltosv1alpha1.ClusterType, logger logr.Logger) + clusterType libsveltosv1beta1.ClusterType, logger logr.Logger) type DeployerInterface interface { // RegisterFeatureID allows registering a feature ID. @@ -89,7 +89,7 @@ type DeployerInterface interface { Deploy( ctx context.Context, clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType libsveltosv1beta1.ClusterType, cleanup bool, f RequestHandler, m MetricHandler, @@ -102,7 +102,7 @@ type DeployerInterface interface { // removed is currently in progress. IsInProgress( clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType libsveltosv1beta1.ClusterType, cleanup bool, ) bool @@ -110,12 +110,12 @@ type DeployerInterface interface { GetResult( ctx context.Context, clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType libsveltosv1beta1.ClusterType, cleanup bool, ) Result // CleanupEntries removes any entry (from any internal data structure) for // given feature CleanupEntries(clusterNamespace, clusterName, applicant, featureID string, - clusterType sveltosv1alpha1.ClusterType, cleanup bool) + clusterType libsveltosv1beta1.ClusterType, cleanup bool) } diff --git a/lib/deployer/utils_test.go b/lib/deployer/utils_test.go index 34f99d2..286d9c2 100644 --- a/lib/deployer/utils_test.go +++ b/lib/deployer/utils_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/lib/deployer" "github.com/projectsveltos/libsveltos/lib/utils" ) @@ -72,7 +72,7 @@ var _ = Describe("Client", func() { ObjectMeta: metav1.ObjectMeta{ Name: name, Labels: map[string]string{ - deployer.ReferenceKindLabel: string(libsveltosv1alpha1.ConfigMapReferencedResourceKind), + deployer.ReferenceKindLabel: string(libsveltosv1beta1.ConfigMapReferencedResourceKind), deployer.ReferenceNameLabel: configMapName, deployer.ReferenceNamespaceLabel: configMapNs, }, @@ -103,13 +103,13 @@ var _ = Describe("Client", func() { Expect(err).To(BeNil()) // If different configMap, return error - _, err = deployer.ValidateObjectForUpdate(context.TODO(), dr, u, string(libsveltosv1alpha1.ConfigMapReferencedResourceKind), + _, err = deployer.ValidateObjectForUpdate(context.TODO(), dr, u, string(libsveltosv1beta1.ConfigMapReferencedResourceKind), randomString(), randomString(), cp) Expect(err).ToNot(BeNil()) // If same configMap, return no error var resourceInfo *deployer.ResourceInfo - resourceInfo, err = deployer.ValidateObjectForUpdate(context.TODO(), dr, u, string(libsveltosv1alpha1.ConfigMapReferencedResourceKind), + resourceInfo, err = deployer.ValidateObjectForUpdate(context.TODO(), dr, u, string(libsveltosv1beta1.ConfigMapReferencedResourceKind), configMapNs, configMapName, cp) Expect(err).To(BeNil()) Expect(resourceInfo.ResourceVersion).ToNot(BeEmpty()) @@ -117,7 +117,7 @@ var _ = Describe("Client", func() { }) It("addOwnerReference adds an OwnerReference to an object. removeOwnerReference removes it", func() { - roleRequest := &libsveltosv1alpha1.RoleRequest{ + roleRequest := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, @@ -134,7 +134,7 @@ var _ = Describe("Client", func() { Expect(policy.GetOwnerReferences()).ToNot(BeNil()) Expect(len(policy.GetOwnerReferences())).To(Equal(1)) - Expect(policy.GetOwnerReferences()[0].Kind).To(Equal(libsveltosv1alpha1.RoleRequestKind)) + Expect(policy.GetOwnerReferences()[0].Kind).To(Equal(libsveltosv1beta1.RoleRequestKind)) Expect(policy.GetOwnerReferences()[0].Name).To(Equal(roleRequest.Name)) deployer.RemoveOwnerReference(policy, roleRequest) @@ -142,7 +142,7 @@ var _ = Describe("Client", func() { }) It("IsOnlyOwnerReference returns true when only one Owner is present", func() { - roleRequest := &libsveltosv1alpha1.RoleRequest{ + roleRequest := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, @@ -159,7 +159,7 @@ var _ = Describe("Client", func() { Expect(deployer.IsOnlyOwnerReference(policy, roleRequest)).To(BeTrue()) - roleRequest2 := &libsveltosv1alpha1.RoleRequest{ + roleRequest2 := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, @@ -170,14 +170,14 @@ var _ = Describe("Client", func() { }) It("IsOwnerReference returns true when owner is present", func() { - roleRequest := &libsveltosv1alpha1.RoleRequest{ + roleRequest := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, } Expect(addTypeInformationToObject(testEnv.Scheme(), roleRequest)).To(Succeed()) - roleRequest2 := &libsveltosv1alpha1.RoleRequest{ + roleRequest2 := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, diff --git a/lib/deployer/worker.go b/lib/deployer/worker.go index febfe08..bfe1c6f 100644 --- a/lib/deployer/worker.go +++ b/lib/deployer/worker.go @@ -27,7 +27,7 @@ import ( "github.com/go-logr/logr" "sigs.k8s.io/controller-runtime/pkg/client" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + sveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" logs "github.com/projectsveltos/libsveltos/lib/logsettings" ) @@ -92,7 +92,7 @@ func (d *deployer) startWorkloadWorkers(ctx context.Context, numOfWorker int, lo // - clusterNamespace and clusterName which are the namespace/name of the // cluster where feature needs to be deployed; // - featureID is a unique identifier for the feature that needs to be deployed. -func GetKey(clusterNamespace, clusterName, applicant, featureID string, clusterType sveltosv1alpha1.ClusterType, cleanup bool) string { +func GetKey(clusterNamespace, clusterName, applicant, featureID string, clusterType sveltosv1beta1.ClusterType, cleanup bool) string { return clusterNamespace + separator + clusterName + separator + string(clusterType) + separator + applicant + separator + featureID + separator + strconv.FormatBool(cleanup) } @@ -114,7 +114,7 @@ func getClusterFromKey(key string) (namespace, name string, err error) { // getClusterTypeFromKey given a unique request key, returns: // - clusterType of the cluster where features need to be deployed -func getClusterTypeFromKey(key string) (clusterType sveltosv1alpha1.ClusterType, err error) { +func getClusterTypeFromKey(key string) (clusterType sveltosv1beta1.ClusterType, err error) { info := strings.Split(key, separator) const length = 6 if len(info) != length { @@ -122,7 +122,7 @@ func getClusterTypeFromKey(key string) (clusterType sveltosv1alpha1.ClusterType, return } currentClusterType := info[2] - clusterType = sveltosv1alpha1.ClusterType(currentClusterType) + clusterType = sveltosv1beta1.ClusterType(currentClusterType) return } @@ -268,7 +268,7 @@ func storeResult(d *deployer, key string, err error, handlerOptions Options, // If result is available it returns the result. // If request is still queued, responseParams is nil and an error is nil. // If result is not available and request is neither queued nor already processed, it returns an error to indicate that. -func getRequestStatus(d *deployer, clusterNamespace, clusterName, applicant, featureID string, clusterType sveltosv1alpha1.ClusterType, +func getRequestStatus(d *deployer, clusterNamespace, clusterName, applicant, featureID string, clusterType sveltosv1beta1.ClusterType, cleanup bool) (*responseParams, error) { key := GetKey(clusterNamespace, clusterName, applicant, featureID, clusterType, cleanup) diff --git a/lib/deployer/worker_test.go b/lib/deployer/worker_test.go index b96f78c..b3fe6a5 100644 --- a/lib/deployer/worker_test.go +++ b/lib/deployer/worker_test.go @@ -28,14 +28,14 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + sveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/lib/deployer" ) var messages chan string func writeToChannelHandler(ctx context.Context, c client.Client, - namespace, name, applicant, featureID string, clusterType sveltosv1alpha1.ClusterType, + namespace, name, applicant, featureID string, clusterType sveltosv1beta1.ClusterType, o deployer.Options, logger logr.Logger) error { By("writeToChannelHandler: writing to channel") @@ -45,14 +45,14 @@ func writeToChannelHandler(ctx context.Context, c client.Client, func metricHandler(elapsed time.Duration, clusterNamespace, clusterName, featureID string, - clusterType sveltosv1alpha1.ClusterType, + clusterType sveltosv1beta1.ClusterType, logger logr.Logger) { By("metricHandler: storing metrics") } func doNothingHandler(ctx context.Context, c client.Client, - namespace, name, applicant, featureID string, clusterType sveltosv1alpha1.ClusterType, + namespace, name, applicant, featureID string, clusterType sveltosv1beta1.ClusterType, o deployer.Options, logger logr.Logger) error { return nil @@ -65,7 +65,7 @@ var _ = Describe("Worker", func() { applicant := randomString() featureID := randomString() cleanup := true - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeCapi, cleanup) outNs, outName, err := deployer.GetClusterFromKey(key) Expect(err).To(BeNil()) @@ -86,7 +86,7 @@ var _ = Describe("Worker", func() { applicant := "" featureID := randomString() cleanup := false - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, false) + key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeCapi, false) outNs, outName, err := deployer.GetClusterFromKey(key) Expect(err).To(BeNil()) @@ -126,7 +126,7 @@ var _ = Describe("Worker", func() { applicant := randomString() featureID := randomString() cleanup := false - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeCapi, cleanup) d.SetInProgress([]string{key}) Expect(len(d.GetInProgress())).To(Equal(1)) @@ -145,7 +145,7 @@ var _ = Describe("Worker", func() { applicant := randomString() featureID := randomString() cleanup := false - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeCapi, cleanup) d.SetInProgress([]string{key}) Expect(len(d.GetInProgress())).To(Equal(1)) @@ -170,13 +170,13 @@ var _ = Describe("Worker", func() { applicant := randomString() featureID := randomString() cleanup := true - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeSveltos, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeSveltos, cleanup) r := map[string]error{key: nil} d.SetResults(r) Expect(len(d.GetResults())).To(Equal(1)) - resp, err := deployer.GetRequestStatus(d, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeSveltos, cleanup) + resp, err := deployer.GetRequestStatus(d, ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeSveltos, cleanup) Expect(err).To(BeNil()) Expect(resp).ToNot(BeNil()) Expect(deployer.IsResponseDeployed(resp)).To(BeTrue()) @@ -193,13 +193,13 @@ var _ = Describe("Worker", func() { applicant := randomString() featureID := randomString() cleanup := true - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeCapi, cleanup) r := map[string]error{key: fmt.Errorf("failed to deploy")} d.SetResults(r) Expect(len(d.GetResults())).To(Equal(1)) - resp, err := deployer.GetRequestStatus(d, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + resp, err := deployer.GetRequestStatus(d, ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeCapi, cleanup) Expect(err).To(BeNil()) Expect(resp).ToNot(BeNil()) Expect(deployer.IsResponseFailed(resp)).To(BeTrue()) @@ -216,12 +216,12 @@ var _ = Describe("Worker", func() { applicant := randomString() featureID := randomString() cleanup := false - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeSveltos, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeSveltos, cleanup) d.SetInProgress([]string{key}) Expect(len(d.GetInProgress())).To(Equal(1)) - resp, err := deployer.GetRequestStatus(d, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeSveltos, cleanup) + resp, err := deployer.GetRequestStatus(d, ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeSveltos, cleanup) Expect(err).To(BeNil()) Expect(resp).To(BeNil()) }) @@ -237,12 +237,12 @@ var _ = Describe("Worker", func() { applicant := randomString() featureID := randomString() cleanup := false - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeCapi, cleanup) d.SetJobQueue(key, nil, nil) Expect(len(d.GetJobQueue())).To(Equal(1)) - resp, err := deployer.GetRequestStatus(d, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + resp, err := deployer.GetRequestStatus(d, ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeCapi, cleanup) Expect(err).To(BeNil()) Expect(resp).To(BeNil()) }) @@ -259,7 +259,7 @@ var _ = Describe("Worker", func() { applicant := randomString() featureID := randomString() cleanup := true - key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + key := deployer.GetKey(ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeCapi, cleanup) d.SetJobQueue(key, writeToChannelHandler, metricHandler) Expect(len(d.GetJobQueue())).To(Equal(1)) messages = make(chan string) @@ -280,7 +280,7 @@ var _ = Describe("Worker", func() { return gotResult }, 20*time.Second, time.Second).Should(BeTrue()) - resp, err := deployer.GetRequestStatus(d, ns, name, applicant, featureID, sveltosv1alpha1.ClusterTypeCapi, cleanup) + resp, err := deployer.GetRequestStatus(d, ns, name, applicant, featureID, sveltosv1beta1.ClusterTypeCapi, cleanup) Expect(err).To(BeNil()) Expect(deployer.IsResponseDeployed(resp)).To(BeTrue()) }) diff --git a/lib/logsettings/logsettings.go b/lib/logsettings/logsettings.go index 87bdcdd..2df086f 100644 --- a/lib/logsettings/logsettings.go +++ b/lib/logsettings/logsettings.go @@ -33,7 +33,7 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" ) // Following are log severity levels to be used by sveltos services @@ -68,7 +68,7 @@ type LogSetter struct { verboseValue string // Component registered - component sveltosv1alpha1.Component + component libsveltosv1beta1.Component config *rest.Config } @@ -78,7 +78,7 @@ var ( once sync.Once ) -func newInstance(component sveltosv1alpha1.Component, config *rest.Config, logger logr.Logger) *LogSetter { +func newInstance(component libsveltosv1beta1.Component, config *rest.Config, logger logr.Logger) *LogSetter { once.Do(func() { logger.Info("Creating LogSetter instance") instance = &LogSetter{ @@ -127,7 +127,7 @@ func GetInstance() *LogSetter { // severity set for affected component(s). func RegisterForLogSettings( ctx context.Context, - component sveltosv1alpha1.Component, + component libsveltosv1beta1.Component, logger logr.Logger, config *rest.Config, ) *LogSetter { @@ -172,7 +172,7 @@ func runDebuggingConfigurationInformer( handlers := cache.ResourceEventHandlerFuncs{ AddFunc: func(obj interface{}) { instance.logger.Info("got add notification for DebuggingConfiguration") - d := &sveltosv1alpha1.DebuggingConfiguration{} + d := &libsveltosv1beta1.DebuggingConfiguration{} err := runtime.DefaultUnstructuredConverter. FromUnstructured(obj.(*unstructured.Unstructured).UnstructuredContent(), d) if err != nil { @@ -193,7 +193,7 @@ func runDebuggingConfigurationInformer( }, UpdateFunc: func(oldObj, newObj interface{}) { instance.logger.Info("got update notification for DebuggingConfiguration") - d := &sveltosv1alpha1.DebuggingConfiguration{} + d := &libsveltosv1beta1.DebuggingConfiguration{} err := runtime.DefaultUnstructuredConverter. FromUnstructured(newObj.(*unstructured.Unstructured).UnstructuredContent(), d) if err != nil { @@ -212,25 +212,25 @@ func runDebuggingConfigurationInformer( // UpdateLogLevel updates log severity func UpdateLogLevel( - d *sveltosv1alpha1.DebuggingConfiguration, + d *libsveltosv1beta1.DebuggingConfiguration, ) { found := false for _, c := range d.Spec.Configuration { if instance.component == c.Component { - if c.LogLevel == sveltosv1alpha1.LogLevelVerbose { + if c.LogLevel == libsveltosv1beta1.LogLevelVerbose { found = true instance.logger.Info("Setting log severity to verbose", "verbose", instance.verboseValue) if err := flag.Lookup("v").Value.Set(instance.verboseValue); err != nil { instance.logger.Error(err, "unable to set log level") } - } else if c.LogLevel == sveltosv1alpha1.LogLevelDebug { + } else if c.LogLevel == libsveltosv1beta1.LogLevelDebug { found = true instance.logger.Info("Setting log severity to debug", "debug", instance.debugValue) if err := flag.Lookup("v").Value.Set(instance.debugValue); err != nil { instance.logger.Error(err, "unable to set log level") } - } else if c.LogLevel == sveltosv1alpha1.LogLevelInfo { + } else if c.LogLevel == libsveltosv1beta1.LogLevelInfo { found = true instance.logger.Info("Setting log severity to info", "info", instance.infoValue) if err := flag.Lookup("v").Value.Set(instance.infoValue); err != nil { diff --git a/lib/logsettings/logsettings_suite_test.go b/lib/logsettings/logsettings_suite_test.go index 5d4bc43..5502f2c 100644 --- a/lib/logsettings/logsettings_suite_test.go +++ b/lib/logsettings/logsettings_suite_test.go @@ -33,7 +33,7 @@ import ( "k8s.io/klog/v2/textlogger" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/internal/test/helpers" "github.com/projectsveltos/libsveltos/lib/logsettings" ) @@ -81,7 +81,7 @@ var _ = BeforeSuite(func() { klog.InitFlags(nil) Expect(flag.Lookup("v").Value.Set("0")).To(BeNil()) - instance = logsettings.RegisterForLogSettings(ctx, sveltosv1alpha1.ComponentAddonManager, + instance = logsettings.RegisterForLogSettings(ctx, libsveltosv1beta1.ComponentAddonManager, textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1))), testEnv.Config) }) @@ -100,7 +100,7 @@ func setupScheme() (*runtime.Scheme, error) { if err := v1.AddToScheme(s); err != nil { return nil, err } - if err := sveltosv1alpha1.AddToScheme(s); err != nil { + if err := libsveltosv1beta1.AddToScheme(s); err != nil { return nil, err } return s, nil diff --git a/lib/logsettings/logsettings_test.go b/lib/logsettings/logsettings_test.go index 694d77c..4e55d7f 100644 --- a/lib/logsettings/logsettings_test.go +++ b/lib/logsettings/logsettings_test.go @@ -25,19 +25,19 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/lib/logsettings" ) var _ = Describe("Logsettings", func() { It("Should change log level appropriately", func() { - conf := &sveltosv1alpha1.DebuggingConfiguration{ + conf := &libsveltosv1beta1.DebuggingConfiguration{ ObjectMeta: metav1.ObjectMeta{ Name: "default", }, - Spec: sveltosv1alpha1.DebuggingConfigurationSpec{ - Configuration: []sveltosv1alpha1.ComponentConfiguration{ - {Component: sveltosv1alpha1.ComponentAddonManager, LogLevel: sveltosv1alpha1.LogLevelDebug}, + Spec: libsveltosv1beta1.DebuggingConfigurationSpec{ + Configuration: []libsveltosv1beta1.ComponentConfiguration{ + {Component: libsveltosv1beta1.ComponentAddonManager, LogLevel: libsveltosv1beta1.LogLevelDebug}, }, }, } @@ -47,8 +47,8 @@ var _ = Describe("Logsettings", func() { Expect(f).ToNot(BeNil()) Expect(f.Value.String()).To(Equal(strconv.Itoa(logsettings.LogDebug))) - conf.Spec.Configuration = []sveltosv1alpha1.ComponentConfiguration{ - {Component: sveltosv1alpha1.ComponentAddonManager, LogLevel: sveltosv1alpha1.LogLevelInfo}, + conf.Spec.Configuration = []libsveltosv1beta1.ComponentConfiguration{ + {Component: libsveltosv1beta1.ComponentAddonManager, LogLevel: libsveltosv1beta1.LogLevelInfo}, } logsettings.UpdateLogLevel(conf) @@ -56,8 +56,8 @@ var _ = Describe("Logsettings", func() { Expect(f).ToNot(BeNil()) Expect(f.Value.String()).To(Equal(strconv.Itoa(logsettings.LogInfo))) - conf.Spec.Configuration = []sveltosv1alpha1.ComponentConfiguration{ - {Component: sveltosv1alpha1.ComponentAddonManager, LogLevel: sveltosv1alpha1.LogLevelVerbose}, + conf.Spec.Configuration = []libsveltosv1beta1.ComponentConfiguration{ + {Component: libsveltosv1beta1.ComponentAddonManager, LogLevel: libsveltosv1beta1.LogLevelVerbose}, } logsettings.UpdateLogLevel(conf) @@ -67,8 +67,8 @@ var _ = Describe("Logsettings", func() { newDebugValue := 8 instance.SetDebugValue(newDebugValue) - conf.Spec.Configuration = []sveltosv1alpha1.ComponentConfiguration{ - {Component: sveltosv1alpha1.ComponentAddonManager, LogLevel: sveltosv1alpha1.LogLevelDebug}, + conf.Spec.Configuration = []libsveltosv1beta1.ComponentConfiguration{ + {Component: libsveltosv1beta1.ComponentAddonManager, LogLevel: libsveltosv1beta1.LogLevelDebug}, } logsettings.UpdateLogLevel(conf) @@ -78,8 +78,8 @@ var _ = Describe("Logsettings", func() { newInfoValue := 5 instance.SetInfoValue(newInfoValue) - conf.Spec.Configuration = []sveltosv1alpha1.ComponentConfiguration{ - {Component: sveltosv1alpha1.ComponentAddonManager, LogLevel: sveltosv1alpha1.LogLevelInfo}, + conf.Spec.Configuration = []libsveltosv1beta1.ComponentConfiguration{ + {Component: libsveltosv1beta1.ComponentAddonManager, LogLevel: libsveltosv1beta1.LogLevelInfo}, } logsettings.UpdateLogLevel(conf) diff --git a/lib/roles/roles.go b/lib/roles/roles.go index 9afdce4..5b39c4e 100644 --- a/lib/roles/roles.go +++ b/lib/roles/roles.go @@ -27,7 +27,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/lib/deployer" ) @@ -55,7 +55,7 @@ const ( // in cluster. It returns nil if it does not exist yet. func GetSecret(ctx context.Context, c client.Client, clusterNamespace, clusterName, serviceAccountNamespace, serviceAccountName string, - clusterType sveltosv1alpha1.ClusterType) (*corev1.Secret, error) { + clusterType libsveltosv1beta1.ClusterType) (*corev1.Secret, error) { secretList := &corev1.SecretList{} err := c.List(ctx, secretList, getListOptionsForSecret(clusterNamespace, clusterName, @@ -80,7 +80,7 @@ func GetSecret(ctx context.Context, c client.Client, // If Secret already exists, updates Data section if necessary (kubeconfig is different) func CreateSecret(ctx context.Context, c client.Client, clusterNamespace, clusterName, serviceAccountNamespace, serviceAccountName string, - clusterType sveltosv1alpha1.ClusterType, kubeconfig []byte, owner client.Object) (*corev1.Secret, error) { + clusterType libsveltosv1beta1.ClusterType, kubeconfig []byte, owner client.Object) (*corev1.Secret, error) { secretList := &corev1.SecretList{} err := c.List(ctx, secretList, getListOptionsForSecret(clusterNamespace, clusterName, @@ -108,7 +108,7 @@ func CreateSecret(ctx context.Context, c client.Client, // Removes owner as one of the OwnerReferences for secret. If no more OwnerReferences are left, deletes secret. func DeleteSecret(ctx context.Context, c client.Client, clusterNamespace, clusterName, serviceAccountNamespace, serviceAccountName string, - clusterType sveltosv1alpha1.ClusterType, owner client.Object) error { + clusterType libsveltosv1beta1.ClusterType, owner client.Object) error { secretList := &corev1.SecretList{} err := c.List(ctx, secretList, getListOptionsForSecret(clusterNamespace, clusterName, @@ -142,7 +142,7 @@ func DeleteSecret(ctx context.Context, c client.Client, func ListSecretForOwner(ctx context.Context, c client.Client, owner client.Object) ([]corev1.Secret, error) { listOption := []client.ListOption{ client.MatchingLabels{ - sveltosv1alpha1.RoleRequestLabel: "ok", + libsveltosv1beta1.RoleRequestLabel: "ok", }, } @@ -168,7 +168,7 @@ func ListSecretForOwner(ctx context.Context, c client.Client, owner client.Objec func ListSecrets(ctx context.Context, c client.Client) ([]corev1.Secret, error) { listOption := []client.ListOption{ client.MatchingLabels{ - sveltosv1alpha1.RoleRequestLabel: "ok", + libsveltosv1beta1.RoleRequestLabel: "ok", }, } @@ -192,7 +192,7 @@ func ListSecrets(ctx context.Context, c client.Client) ([]corev1.Secret, error) // Returns nil if kubeconfig is not found. Returns an error if any occurred. func GetKubeconfig(ctx context.Context, c client.Client, clusterNamespace, clusterName, serviceAccountNamespace, serviceAccountName string, - clusterType sveltosv1alpha1.ClusterType) ([]byte, error) { + clusterType libsveltosv1beta1.ClusterType) ([]byte, error) { secretList := &corev1.SecretList{} err := c.List(ctx, secretList, getListOptionsForSecret(clusterNamespace, clusterName, serviceAccountNamespace, serviceAccountName)...) @@ -255,10 +255,10 @@ func createSecret(ctx context.Context, c client.Client, Namespace: namespace, Name: name, Labels: map[string]string{ - clusterNameLabel: clusterName, - serviceAccountNameLabel: serviceAccountName, - serviceAccountNamespaceLabel: serviceAccountNamespace, - sveltosv1alpha1.RoleRequestLabel: "ok", + clusterNameLabel: clusterName, + serviceAccountNameLabel: serviceAccountName, + serviceAccountNamespaceLabel: serviceAccountNamespace, + libsveltosv1beta1.RoleRequestLabel: "ok", }, }, Data: map[string][]byte{ diff --git a/lib/roles/roles_suite_test.go b/lib/roles/roles_suite_test.go index 3c7b8ca..6b98886 100644 --- a/lib/roles/roles_suite_test.go +++ b/lib/roles/roles_suite_test.go @@ -14,7 +14,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" ) var ( @@ -46,7 +46,7 @@ func setupScheme() (*runtime.Scheme, error) { if err := clientgoscheme.AddToScheme(s); err != nil { return nil, err } - if err := sveltosv1alpha1.AddToScheme(s); err != nil { + if err := libsveltosv1beta1.AddToScheme(s); err != nil { return nil, err } diff --git a/lib/roles/roles_test.go b/lib/roles/roles_test.go index 173d0c7..75068bb 100644 --- a/lib/roles/roles_test.go +++ b/lib/roles/roles_test.go @@ -12,7 +12,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/lib/crd" "github.com/projectsveltos/libsveltos/lib/roles" "github.com/projectsveltos/libsveltos/lib/utils" @@ -29,7 +29,7 @@ var _ = Describe("Roles", func() { secret, err := roles.GetKubeconfig(context.TODO(), c, clusterNamespace, clusterName, serviceAccountNamespace, serviceaccountName, - sveltosv1alpha1.ClusterTypeSveltos) + libsveltosv1beta1.ClusterTypeSveltos) Expect(err).To(BeNil()) Expect(secret).To(BeNil()) }) @@ -62,7 +62,7 @@ var _ = Describe("Roles", func() { currentKubeconfig, err := roles.GetKubeconfig(context.TODO(), c, clusterNamespace, clusterName, serviceAccountNamespace, serviceaccountName, - sveltosv1alpha1.ClusterTypeSveltos) + libsveltosv1beta1.ClusterTypeSveltos) Expect(err).To(BeNil()) Expect(currentKubeconfig).ToNot(BeNil()) Expect(reflect.DeepEqual(currentKubeconfig, kubeconfig)).To(BeTrue()) @@ -78,7 +78,7 @@ var _ = Describe("Roles", func() { secret, err := roles.GetSecret(context.TODO(), c, clusterNamespace, clusterName, serviceAccountNamespace, serviceaccountName, - sveltosv1alpha1.ClusterTypeSveltos) + libsveltosv1beta1.ClusterTypeSveltos) Expect(err).To(BeNil()) Expect(secret).To(BeNil()) }) @@ -111,7 +111,7 @@ var _ = Describe("Roles", func() { currentSecret, err := roles.GetSecret(context.TODO(), c, clusterNamespace, clusterName, serviceAccountNamespace, serviceaccountName, - sveltosv1alpha1.ClusterTypeSveltos) + libsveltosv1beta1.ClusterTypeSveltos) Expect(err).To(BeNil()) Expect(currentSecret).ToNot(BeNil()) Expect(currentSecret.Namespace).To(Equal(clusterNamespace)) @@ -149,7 +149,7 @@ var _ = Describe("Roles", func() { Expect(err).To(BeNil()) Expect(c.Create(context.TODO(), roleRequestCRD)).To(Succeed()) - roleRequest := &sveltosv1alpha1.RoleRequest{ + roleRequest := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, @@ -157,7 +157,7 @@ var _ = Describe("Roles", func() { secret, err := roles.CreateSecret(context.TODO(), c, clusterNamespace, clusterName, serviceAccountNamespace, serviceaccountName, - sveltosv1alpha1.ClusterTypeSveltos, []byte(randomString()), roleRequest) + libsveltosv1beta1.ClusterTypeSveltos, []byte(randomString()), roleRequest) Expect(err).To(BeNil()) Expect(secret).ToNot(BeNil()) Expect(secret.Namespace).To(Equal(clusterNamespace)) @@ -203,7 +203,7 @@ var _ = Describe("Roles", func() { initObjects := []client.Object{secret} - roleRequest := &sveltosv1alpha1.RoleRequest{ + roleRequest := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, @@ -213,7 +213,7 @@ var _ = Describe("Roles", func() { currentSecret, err := roles.CreateSecret(context.TODO(), c, clusterNamespace, clusterName, serviceAccountNamespace, serviceaccountName, - sveltosv1alpha1.ClusterTypeSveltos, kubeconfig, roleRequest) + libsveltosv1beta1.ClusterTypeSveltos, kubeconfig, roleRequest) Expect(err).To(BeNil()) Expect(currentSecret).ToNot(BeNil()) Expect(currentSecret.Namespace).To(Equal(clusterNamespace)) @@ -250,7 +250,7 @@ var _ = Describe("Roles", func() { c := fake.NewClientBuilder().WithScheme(scheme).Build() - roleRequest := &sveltosv1alpha1.RoleRequest{ + roleRequest := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, @@ -259,7 +259,7 @@ var _ = Describe("Roles", func() { err := roles.DeleteSecret(context.TODO(), c, clusterNamespace, clusterName, serviceaccountNamespace, serviceaccountName, - sveltosv1alpha1.ClusterTypeSveltos, roleRequest) + libsveltosv1beta1.ClusterTypeSveltos, roleRequest) Expect(err).To(BeNil()) }) @@ -269,7 +269,7 @@ var _ = Describe("Roles", func() { serviceaccountNamespace := randomString() serviceaccountName := randomString() - roleRequest := &sveltosv1alpha1.RoleRequest{ + roleRequest := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, @@ -286,7 +286,7 @@ var _ = Describe("Roles", func() { roles.ServiceAccountNamespaceLabel: serviceaccountNamespace, }, OwnerReferences: []metav1.OwnerReference{ - {APIVersion: roleRequest.APIVersion, Kind: sveltosv1alpha1.RoleRequestKind, Name: roleRequest.Name}, + {APIVersion: roleRequest.APIVersion, Kind: libsveltosv1beta1.RoleRequestKind, Name: roleRequest.Name}, }, }, } @@ -297,7 +297,7 @@ var _ = Describe("Roles", func() { err := roles.DeleteSecret(context.TODO(), c, clusterNamespace, clusterName, serviceaccountNamespace, serviceaccountName, - sveltosv1alpha1.ClusterTypeSveltos, roleRequest) + libsveltosv1beta1.ClusterTypeSveltos, roleRequest) Expect(err).To(BeNil()) listOptions := []client.ListOption{ @@ -320,14 +320,14 @@ var _ = Describe("Roles", func() { serviceaccountNamespace := randomString() serviceaccountName := randomString() - roleRequest1 := &sveltosv1alpha1.RoleRequest{ + roleRequest1 := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, } Expect(addTypeInformationToObject(scheme, roleRequest1)).To(Succeed()) - roleRequest2 := &sveltosv1alpha1.RoleRequest{ + roleRequest2 := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, @@ -344,8 +344,8 @@ var _ = Describe("Roles", func() { roles.ServiceAccountNamespaceLabel: serviceaccountNamespace, }, OwnerReferences: []metav1.OwnerReference{ - {APIVersion: roleRequest1.APIVersion, Kind: sveltosv1alpha1.RoleRequestKind, Name: roleRequest1.Name}, - {APIVersion: roleRequest2.APIVersion, Kind: sveltosv1alpha1.RoleRequestKind, Name: roleRequest2.Name}, + {APIVersion: roleRequest1.APIVersion, Kind: libsveltosv1beta1.RoleRequestKind, Name: roleRequest1.Name}, + {APIVersion: roleRequest2.APIVersion, Kind: libsveltosv1beta1.RoleRequestKind, Name: roleRequest2.Name}, }, }, } @@ -356,7 +356,7 @@ var _ = Describe("Roles", func() { err := roles.DeleteSecret(context.TODO(), c, clusterNamespace, clusterName, serviceaccountNamespace, serviceaccountName, - sveltosv1alpha1.ClusterTypeSveltos, roleRequest1) + libsveltosv1beta1.ClusterTypeSveltos, roleRequest1) Expect(err).To(BeNil()) listOptions := []client.ListOption{ @@ -377,7 +377,7 @@ var _ = Describe("Roles", func() { }) It("ListSecretForOwner returns all secret for which owner is one of the OnwerReferences", func() { - roleRequest1 := &sveltosv1alpha1.RoleRequest{ + roleRequest1 := &libsveltosv1beta1.RoleRequest{ ObjectMeta: metav1.ObjectMeta{ Name: randomString(), }, @@ -389,10 +389,10 @@ var _ = Describe("Roles", func() { Namespace: randomString(), Name: randomString(), Labels: map[string]string{ - sveltosv1alpha1.RoleRequestLabel: "ok", + libsveltosv1beta1.RoleRequestLabel: "ok", }, OwnerReferences: []metav1.OwnerReference{ - {APIVersion: roleRequest1.APIVersion, Kind: sveltosv1alpha1.RoleRequestKind, Name: roleRequest1.Name}, + {APIVersion: roleRequest1.APIVersion, Kind: libsveltosv1beta1.RoleRequestKind, Name: roleRequest1.Name}, }, }, } @@ -402,7 +402,7 @@ var _ = Describe("Roles", func() { Namespace: randomString(), Name: randomString(), OwnerReferences: []metav1.OwnerReference{ - {APIVersion: roleRequest1.APIVersion, Kind: sveltosv1alpha1.RoleRequestKind, Name: roleRequest1.Name}, + {APIVersion: roleRequest1.APIVersion, Kind: libsveltosv1beta1.RoleRequestKind, Name: roleRequest1.Name}, }, }, } @@ -412,7 +412,7 @@ var _ = Describe("Roles", func() { Namespace: randomString(), Name: randomString(), Labels: map[string]string{ - sveltosv1alpha1.RoleRequestLabel: "ok", + libsveltosv1beta1.RoleRequestLabel: "ok", }, }, } @@ -438,12 +438,12 @@ var _ = Describe("Roles", func() { Name: randomString(), OwnerReferences: []metav1.OwnerReference{ { - APIVersion: sveltosv1alpha1.GroupVersion.String(), - Kind: sveltosv1alpha1.RoleRequestKind, + APIVersion: libsveltosv1beta1.GroupVersion.String(), + Kind: libsveltosv1beta1.RoleRequestKind, Name: randomString()}, }, Labels: map[string]string{ - sveltosv1alpha1.RoleRequestLabel: "ok", + libsveltosv1beta1.RoleRequestLabel: "ok", }, }, } diff --git a/lib/sharding/utils.go b/lib/sharding/utils.go index 63c6d2a..25e1b30 100644 --- a/lib/sharding/utils.go +++ b/lib/sharding/utils.go @@ -27,7 +27,7 @@ import ( "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" - sveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" ) // Sharding can be used to to horizontal scale sveltos. @@ -79,8 +79,8 @@ func IsShardAMatch(shardKey string, cluster client.Object) bool { // component indicates the sveltos component requesting it. // returns a bool indicating whether the cluster:shard pair has changed and an error // if any occurred -func RegisterClusterShard(ctx context.Context, c client.Client, component sveltosv1alpha1.Component, - feature, shard, clusterNamespace, clusterName string, clusterType sveltosv1alpha1.ClusterType) (bool, error) { +func RegisterClusterShard(ctx context.Context, c client.Client, component libsveltosv1beta1.Component, + feature, shard, clusterNamespace, clusterName string, clusterType libsveltosv1beta1.ClusterType) (bool, error) { cm, err := getConfigMap(ctx, c, component, feature) if err != nil { @@ -115,13 +115,13 @@ const ( configMapNamespace = "projectsveltos" ) -func getConfigMapName(component sveltosv1alpha1.Component, feature string) string { +func getConfigMapName(component libsveltosv1beta1.Component, feature string) string { return fmt.Sprintf("%s-%s-%s", configMapName, strings.ToLower(string(component)), strings.ToLower(feature)) } -func getConfigMap(ctx context.Context, c client.Client, component sveltosv1alpha1.Component, +func getConfigMap(ctx context.Context, c client.Client, component libsveltosv1beta1.Component, feature string) (*corev1.ConfigMap, error) { cm := &corev1.ConfigMap{} @@ -137,7 +137,7 @@ func getConfigMap(ctx context.Context, c client.Client, component sveltosv1alpha return cm, nil } -func createConfigMap(ctx context.Context, c client.Client, component sveltosv1alpha1.Component, +func createConfigMap(ctx context.Context, c client.Client, component libsveltosv1beta1.Component, feature string) (*corev1.ConfigMap, error) { name := getConfigMapName(component, feature) diff --git a/lib/sharding/utils_test.go b/lib/sharding/utils_test.go index 2ccd27a..ef6661a 100644 --- a/lib/sharding/utils_test.go +++ b/lib/sharding/utils_test.go @@ -10,7 +10,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client/fake" - libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1" + libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" "github.com/projectsveltos/libsveltos/lib/sharding" ) @@ -21,55 +21,55 @@ var _ = Describe("Sharding", func() { cluster := &corev1.ObjectReference{ Name: randomString(), Namespace: randomString(), - Kind: libsveltosv1alpha1.SveltosClusterKind, - APIVersion: libsveltosv1alpha1.GroupVersion.String(), + Kind: libsveltosv1beta1.SveltosClusterKind, + APIVersion: libsveltosv1beta1.GroupVersion.String(), } shard := randomString() // First time, add entry and return false since cluster:shard was never changed - shardChanged, err := sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1alpha1.ComponentAddonManager, - "helm", shard, cluster.Namespace, cluster.Name, libsveltosv1alpha1.ClusterTypeSveltos) + shardChanged, err := sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager, + "helm", shard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos) Expect(err).To(BeNil()) Expect(shardChanged).To(BeFalse()) // return false since cluster:shard was never changed - shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1alpha1.ComponentAddonManager, - "helm", shard, cluster.Namespace, cluster.Name, libsveltosv1alpha1.ClusterTypeSveltos) + shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager, + "helm", shard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos) Expect(err).To(BeNil()) Expect(shardChanged).To(BeFalse()) // return true since cluster:shard has changed newShard := randomString() - shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1alpha1.ComponentAddonManager, - "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1alpha1.ClusterTypeSveltos) + shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager, + "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos) Expect(err).To(BeNil()) Expect(shardChanged).To(BeTrue()) // return false since cluster:shard has not changed (and previous step updated configMap) - shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1alpha1.ComponentAddonManager, - "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1alpha1.ClusterTypeSveltos) + shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager, + "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeSveltos) Expect(err).To(BeNil()) Expect(shardChanged).To(BeFalse()) // register capi cluster with same namespace/name of sveltoscluster used so far - shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1alpha1.ComponentAddonManager, - "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1alpha1.ClusterTypeCapi) + shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager, + "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeCapi) Expect(err).To(BeNil()) Expect(shardChanged).To(BeFalse()) - shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1alpha1.ComponentAddonManager, - "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1alpha1.ClusterTypeCapi) + shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager, + "helm", newShard, cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeCapi) Expect(err).To(BeNil()) Expect(shardChanged).To(BeFalse()) - shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1alpha1.ComponentAddonManager, - "helm", randomString(), cluster.Namespace, cluster.Name, libsveltosv1alpha1.ClusterTypeCapi) + shardChanged, err = sharding.RegisterClusterShard(context.TODO(), c, libsveltosv1beta1.ComponentAddonManager, + "helm", randomString(), cluster.Namespace, cluster.Name, libsveltosv1beta1.ClusterTypeCapi) Expect(err).To(BeNil()) Expect(shardChanged).To(BeTrue()) }) It("IsShardAMatch returns false when shard is not a match", func() { - cluster := &libsveltosv1alpha1.SveltosCluster{ + cluster := &libsveltosv1beta1.SveltosCluster{ ObjectMeta: metav1.ObjectMeta{ Namespace: randomString(), Name: randomString(), @@ -88,7 +88,7 @@ var _ = Describe("Sharding", func() { It("IsShardAMatch returns true when shard is a match", func() { shard := randomString() - cluster := &libsveltosv1alpha1.SveltosCluster{ + cluster := &libsveltosv1beta1.SveltosCluster{ ObjectMeta: metav1.ObjectMeta{ Namespace: randomString(), Name: randomString(), diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_accessrequests.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_accessrequests.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..e221124 --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_accessrequests.lib.projectsveltos.io.yaml @@ -0,0 +1,257 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: accessrequests.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: AccessRequest + listKind: AccessRequestList + plural: accessrequests + singular: accessrequest + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: AccessRequest is the Schema for the accessrequest 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: AccessRequestSpec defines the desired state of AccessRequest + properties: + controlPlaneEndpoint: + description: |- + ControlPlaneEndpoint represents the endpoint used to communicate with the + management cluster controlplane endpoint. It will be used when generating the + kubeconfig. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + name: + description: |- + Name is the name of the service account created + for this AccessRequest + type: string + namespace: + description: |- + Namespace is the namespace of the service account created + for this AccessRequest + type: string + type: + description: Type represent the type of the request + enum: + - SveltosAgent + - Different + type: string + required: + - controlPlaneEndpoint + - name + - namespace + - type + type: object + status: + description: AccessRequestStatus defines the status of AccessRequest + properties: + failureMessage: + description: FailureMessage provides more information if an error + occurs. + type: string + secretRef: + description: SecretRef points to the Secret containing Kubeconfig + 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: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: AccessRequest is the Schema for the accessrequest 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: AccessRequestSpec defines the desired state of AccessRequest + properties: + controlPlaneEndpoint: + description: |- + ControlPlaneEndpoint represents the endpoint used to communicate with the + management cluster controlplane endpoint. It will be used when generating the + kubeconfig. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + name: + description: |- + Name is the name of the service account created + for this AccessRequest + type: string + namespace: + description: |- + Namespace is the namespace of the service account created + for this AccessRequest + type: string + type: + description: Type represent the type of the request + enum: + - SveltosAgent + - Different + type: string + required: + - controlPlaneEndpoint + - name + - namespace + - type + type: object + status: + description: AccessRequestStatus defines the status of AccessRequest + properties: + failureMessage: + description: FailureMessage provides more information if an error + occurs. + type: string + secretRef: + description: SecretRef points to the Secret containing Kubeconfig + 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: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifierreports.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifierreports.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..694516a --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifierreports.lib.projectsveltos.io.yaml @@ -0,0 +1,155 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: classifierreports.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: ClassifierReport + listKind: ClassifierReportList + plural: classifierreports + singular: classifierreport + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ClassifierReport is the Schema for the classifierreports 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: + properties: + classifierName: + description: |- + ClassifierName is the name of the Classifier instance this report + is for. + type: string + clusterName: + description: |- + ClusterName is the name of the Cluster this ClusterReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + ClusterReport is for. + type: string + clusterType: + description: ClusterType is the type of Cluster + type: string + match: + description: |- + Match indicates whether Cluster is currently a match for + the Classifier instance this report is for + type: boolean + required: + - classifierName + - clusterName + - clusterNamespace + - clusterType + - match + type: object + status: + description: ClassifierReportStatus defines the observed state of ClassifierReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: ClassifierReport is the Schema for the classifierreports 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: + properties: + classifierName: + description: |- + ClassifierName is the name of the Classifier instance this report + is for. + type: string + clusterName: + description: |- + ClusterName is the name of the Cluster this ClusterReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + ClusterReport is for. + type: string + clusterType: + description: ClusterType is the type of Cluster + type: string + match: + description: |- + Match indicates whether Cluster is currently a match for + the Classifier instance this report is for + type: boolean + required: + - classifierName + - clusterName + - clusterNamespace + - clusterType + - match + type: object + status: + description: ClassifierReportStatus defines the observed state of ClassifierReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifiers.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifiers.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..8b92c1e --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_classifiers.lib.projectsveltos.io.yaml @@ -0,0 +1,653 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: classifiers.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: Classifier + listKind: ClassifierList + plural: classifiers + singular: classifier + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Classifier is the Schema for the classifiers 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: ClassifierSpec defines the desired state of Classifier + properties: + classifierLabels: + description: |- + ClassifierLabels is set of labels, key,value pair, that will be added to each + cluster matching Classifier instance + items: + properties: + key: + description: Key is the label key + type: string + value: + description: Value is the label value + type: string + required: + - key + - value + type: object + type: array + deployedResourceConstraint: + description: DeployedResourceConstraint allows to classify based on + current deployed resources + properties: + aggregatedClassification: + description: |- + AggregatedClassification is optional and can be used to specify a Lua function + that will be used to further detect whether the subset of the resources + selected using the ResourceSelector field are a match for this Classifier. + The function will receive the array of resources selected by ResourceSelectors. + If this field is not specified, a cluster is a match for Classifier instance, + if all ResourceSelectors returns at least one match. + This field allows to perform more complex evaluation on the resources, looking + at all resources together. + This can be useful for more sophisticated tasks, such as identifying resources + that are related to each other or that have similar properties. + The Lua function must return a struct with: + - "matching" field: boolean indicating whether cluster is a match; + - "message" field: (optional) message. + type: string + resourceSelectors: + description: |- + ResourceSelectors identifies what resources to select + If no AggregatedClassification is specified, a cluster is + a match for Classifier instance, if all ResourceSelectors returns at + least one match. + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based + on current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - resourceSelectors + type: object + kubernetesVersionConstraints: + description: KubernetesVersionConstraints allows to classify based + on current kubernetes version + items: + properties: + comparison: + description: Comparison indicate how to compare cluster kubernetes + version with the specified version + enum: + - Equal + - NotEqual + - GreaterThan + - LessThan + - GreaterThanOrEqualTo + - LessThanOrEqualTo + type: string + version: + description: Version is the kubernetes version + type: string + required: + - comparison + - version + type: object + type: array + required: + - classifierLabels + type: object + status: + description: ClassifierStatus defines the observed state of Classifier + properties: + clusterInfo: + description: |- + ClusterInfo reference all the cluster-api Cluster where Classifier + has been/is being deployed + items: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature in the + workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + type: array + machingClusterStatuses: + description: |- + MatchingClusterRefs reference all the cluster-api Cluster currently matching + Classifier + items: + properties: + clusterRef: + description: ClusterRef references the matching Cluster + 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 + managedLabels: + description: |- + ManagedLabels indicates the labels being managed on + the cluster by this Classifier instance + items: + type: string + type: array + unManagedLabels: + description: |- + UnManagedLabel indicates the labels this Classifier instance + would like to manage but cannot because different instance is + already managing it + items: + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + key: + description: |- + Key represents a label Classifier would like to manage + but cannot because currently managed by different instance + type: string + required: + - key + type: object + type: array + required: + - clusterRef + type: object + type: array + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: Classifier is the Schema for the classifiers 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: ClassifierSpec defines the desired state of Classifier + properties: + classifierLabels: + description: |- + ClassifierLabels is set of labels, key,value pair, that will be added to each + cluster matching Classifier instance + items: + properties: + key: + description: Key is the label key + type: string + value: + description: Value is the label value + type: string + required: + - key + - value + type: object + type: array + deployedResourceConstraint: + description: DeployedResourceConstraint allows to classify based on + current deployed resources + properties: + aggregatedClassification: + description: |- + AggregatedClassification is optional and can be used to specify a Lua function + that will be used to further detect whether the subset of the resources + selected using the ResourceSelector field are a match for this Classifier. + The function will receive the array of resources selected by ResourceSelectors. + If this field is not specified, a cluster is a match for Classifier instance, + if all ResourceSelectors returns at least one match. + This field allows to perform more complex evaluation on the resources, looking + at all resources together. + This can be useful for more sophisticated tasks, such as identifying resources + that are related to each other or that have similar properties. + The Lua function must return a struct with: + - "matching" field: boolean indicating whether cluster is a match; + - "message" field: (optional) message. + type: string + resourceSelectors: + description: |- + ResourceSelectors identifies what resources to select + If no AggregatedClassification is specified, a cluster is + a match for Classifier instance, if all ResourceSelectors returns at + least one match. + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based + on current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - resourceSelectors + type: object + kubernetesVersionConstraints: + description: KubernetesVersionConstraints allows to classify based + on current kubernetes version + items: + properties: + comparison: + description: Comparison indicate how to compare cluster kubernetes + version with the specified version + enum: + - Equal + - NotEqual + - GreaterThan + - LessThan + - GreaterThanOrEqualTo + - LessThanOrEqualTo + type: string + version: + description: Version is the kubernetes version + type: string + required: + - comparison + - version + type: object + type: array + required: + - classifierLabels + type: object + status: + description: ClassifierStatus defines the observed state of Classifier + properties: + clusterInfo: + description: |- + ClusterInfo reference all the cluster-api Cluster where Classifier + has been/is being deployed + items: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature in the + workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + type: array + machingClusterStatuses: + description: |- + MatchingClusterRefs reference all the cluster-api Cluster currently matching + Classifier + items: + properties: + clusterRef: + description: ClusterRef references the matching Cluster + 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 + managedLabels: + description: |- + ManagedLabels indicates the labels being managed on + the cluster by this Classifier instance + items: + type: string + type: array + unManagedLabels: + description: |- + UnManagedLabel indicates the labels this Classifier instance + would like to manage but cannot because different instance is + already managing it + items: + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + key: + description: |- + Key represents a label Classifier would like to manage + but cannot because currently managed by different instance + type: string + required: + - key + type: object + type: array + required: + - clusterRef + type: object + type: array + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_clusterhealthchecks.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_clusterhealthchecks.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..20b34e7 --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_clusterhealthchecks.lib.projectsveltos.io.yaml @@ -0,0 +1,863 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert + controller-gen.kubebuilder.io/version: v0.15.0 + name: clusterhealthchecks.lib.projectsveltos.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: webhook-service + namespace: projectsveltos + path: /convert + conversionReviewVersions: + - v1 + group: lib.projectsveltos.io + names: + kind: ClusterHealthCheck + listKind: ClusterHealthCheckList + plural: clusterhealthchecks + singular: clusterhealthcheck + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ClusterHealthCheck is the Schema for the clusterhealthchecks + 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: ClusterHealthCheckSpec defines the desired state of ClusterHealthCheck + properties: + clusterSelector: + description: ClusterSelector identifies clusters to associate to (Deprecated + use selector instead). + type: string + livenessChecks: + description: |- + LivenessChecks is a list of source of liveness checks to evaluate. + Anytime one of those changes, notifications will be sent + items: + properties: + livenessSourceRef: + description: |- + LivenessSourceRef is a reference to a liveness-specific resource that holds + the details for the liveness check. + 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 + name: + description: |- + Name of the liveness check. + Must be a DNS_LABEL and unique within the ClusterHealthCheck. + type: string + type: + description: Type specifies the type of liveness + enum: + - Addons + - HealthCheck + type: string + required: + - name + - type + type: object + type: array + notifications: + description: Notification is a list of source of events to evaluate. + items: + properties: + name: + description: |- + Name of the notification check. + Must be a DNS_LABEL and unique within the ClusterHealthCheck. + type: string + notificationRef: + description: |- + NotificationRef is a reference to a notification-specific resource that holds + the details for the notification. + 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: + description: NotificationType specifies the type of notification + enum: + - KubernetesEvent + - Slack + - Webex + - Discord + - Teams + type: string + required: + - name + - type + type: object + type: array + required: + - clusterSelector + - livenessChecks + - notifications + type: object + status: + properties: + clusterCondition: + description: |- + ClusterConditions contains conditions and notification status for all clusters + matching ClusterHealthCheck instance + items: + properties: + clusterInfo: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature + in the workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + conditions: + description: Cluster conditions. + items: + description: Condition defines an observation of a Cluster + API resource operational state. + properties: + lastTransitionTime: + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + A human readable message indicating details about the transition. + This field may be empty. + type: string + name: + description: Condition name + type: string + reason: + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. + type: string + severity: + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, + Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + type: string + required: + - lastTransitionTime + - name + - status + - type + type: object + type: array + notificationSummaries: + description: NotificationSummaries contains status information + on notifications + items: + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + name: + description: Name of the notification check. + type: string + status: + description: NotificationStatus specifies the notification + status + enum: + - Delivered + - FailedToDeliver + type: string + required: + - name + - status + type: object + type: array + required: + - clusterInfo + type: object + type: array + matchingClusters: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterHealthCheck 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: ClusterHealthCheck is the Schema for the clusterhealthchecks + 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: ClusterHealthCheckSpec defines the desired state of ClusterHealthCheck + properties: + livenessChecks: + description: |- + LivenessChecks is a list of source of liveness checks to evaluate. + Anytime one of those changes, notifications will be sent + items: + properties: + livenessSourceRef: + description: |- + LivenessSourceRef is a reference to a liveness-specific resource that holds + the details for the liveness check. + 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 + name: + description: |- + Name of the liveness check. + Must be a DNS_LABEL and unique within the ClusterHealthCheck. + type: string + type: + description: Type specifies the type of liveness + enum: + - Addons + - HealthCheck + type: string + required: + - name + - type + type: object + type: array + notifications: + description: Notification is a list of source of events to evaluate. + items: + properties: + name: + description: |- + Name of the notification check. + Must be a DNS_LABEL and unique within the ClusterHealthCheck. + type: string + notificationRef: + description: |- + NotificationRef is a reference to a notification-specific resource that holds + the details for the notification. + 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: + description: NotificationType specifies the type of notification + enum: + - KubernetesEvent + - Slack + - Webex + - Discord + - Teams + type: string + required: + - name + - type + type: object + type: array + selector: + description: Selector identifies clusters to associate to. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - livenessChecks + - notifications + type: object + status: + properties: + clusterCondition: + description: |- + ClusterConditions contains conditions and notification status for all clusters + matching ClusterHealthCheck instance + items: + properties: + clusterInfo: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature + in the workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + conditions: + description: Cluster conditions. + items: + description: Condition defines an observation of a Cluster + API resource operational state. + properties: + lastTransitionTime: + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + A human readable message indicating details about the transition. + This field may be empty. + type: string + name: + description: Condition name + type: string + reason: + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. + type: string + severity: + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, + Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + type: string + required: + - lastTransitionTime + - name + - status + - type + type: object + type: array + notificationSummaries: + description: NotificationSummaries contains status information + on notifications + items: + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + name: + description: Name of the notification check. + type: string + status: + description: NotificationStatus specifies the notification + status + enum: + - Delivered + - FailedToDeliver + type: string + required: + - name + - status + type: object + type: array + required: + - clusterInfo + type: object + type: array + matchingClusters: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterHealthCheck 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. + + + 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/manifests/apiextensions.k8s.io_v1_customresourcedefinition_clustersets.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_clustersets.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..56540f8 --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_clustersets.lib.projectsveltos.io.yaml @@ -0,0 +1,546 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert + controller-gen.kubebuilder.io/version: v0.15.0 + name: clustersets.lib.projectsveltos.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: webhook-service + namespace: projectsveltos + path: /convert + conversionReviewVersions: + - v1 + group: lib.projectsveltos.io + names: + kind: ClusterSet + listKind: ClusterSetList + plural: clustersets + singular: clusterset + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ClusterSet is the Schema for the clustersets 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: + 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. + + + 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 (Deprecated + use selector instead). + type: string + maxReplicas: + description: |- + MaxReplicas specifies the maximum number of clusters to be selected + from the pool matching the clusterSelector. + type: integer + type: object + status: + description: Status defines the observed state of ClusterSet/Set + properties: + matchingClusterRefs: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterSet/Set 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. + + + 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 + selectedClusterRefs: + description: |- + SelectedClusters reference all the cluster currently selected among + all the ones matching + 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: ClusterSet is the Schema for the clustersets 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: + 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. + + + 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 + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + maxReplicas: + description: |- + MaxReplicas specifies the maximum number of clusters to be selected + from the pool matching the clusterSelector. + type: integer + type: object + status: + description: Status defines the observed state of ClusterSet/Set + properties: + matchingClusterRefs: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterSet/Set 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. + + + 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 + selectedClusterRefs: + description: |- + SelectedClusters reference all the cluster currently selected among + all the ones matching + 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. + + + 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/manifests/apiextensions.k8s.io_v1_customresourcedefinition_debuggingconfigurations.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_debuggingconfigurations.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..12218cd --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_debuggingconfigurations.lib.projectsveltos.io.yaml @@ -0,0 +1,147 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: debuggingconfigurations.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: DebuggingConfiguration + listKind: DebuggingConfigurationList + plural: debuggingconfigurations + singular: debuggingconfiguration + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: DebuggingConfiguration is the Schema for the debuggingconfigurations + 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: DebuggingConfigurationSpec defines the desired state of DebuggingConfiguration + properties: + configuration: + description: Configuration contains debugging configuration as granular + as per component. + items: + description: ComponentConfiguration is the debugging configuration + to be applied to a Sveltos component. + properties: + component: + description: Component indicates which Sveltos component the + configuration applies to. + enum: + - AddonManager + - Classifier + - ClassifierAgent + - SveltosClusterManager + - DriftDetectionManager + - AccessManager + - HealthCheckManager + - EventManager + - ShardController + - UIBackend + type: string + logLevel: + description: 'LogLevel is the log severity above which logs + are sent to the stdout. [Default: Info]' + enum: + - LogLevelNotSet + - LogLevelInfo + - LogLevelDebug + - LogLevelVerbose + type: string + required: + - component + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: object + served: true + storage: false + - name: v1beta1 + schema: + openAPIV3Schema: + description: DebuggingConfiguration is the Schema for the debuggingconfigurations + 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: DebuggingConfigurationSpec defines the desired state of DebuggingConfiguration + properties: + configuration: + description: Configuration contains debugging configuration as granular + as per component. + items: + description: ComponentConfiguration is the debugging configuration + to be applied to a Sveltos component. + properties: + component: + description: Component indicates which Sveltos component the + configuration applies to. + enum: + - AddonManager + - Classifier + - ClassifierAgent + - SveltosClusterManager + - DriftDetectionManager + - AccessManager + - HealthCheckManager + - EventManager + - ShardController + - UIBackend + type: string + logLevel: + description: 'LogLevel is the log severity above which logs + are sent to the stdout. [Default: Info]' + enum: + - LogLevelNotSet + - LogLevelInfo + - LogLevelDebug + - LogLevelVerbose + type: string + required: + - component + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: object + served: true + storage: true diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventreports.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventreports.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..6548cb8 --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventreports.lib.projectsveltos.io.yaml @@ -0,0 +1,289 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: eventreports.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: EventReport + listKind: EventReportList + plural: eventreports + singular: eventreport + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: EventReport is the Schema for the EventReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this EventReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + EventReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this EventReport + is for. + type: string + eventSourceName: + description: |- + EventSourceName is the name of the EventSource instance this report + is for. + type: string + matchingResources: + description: MatchingResources contains a list of resources matching + an event + 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. + + + 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 + resources: + description: |- + If EventSource Spec.CollectResources is set to true, all matching resources + will be collected and contained in the Resources field. + format: byte + type: string + required: + - clusterName + - clusterNamespace + - clusterType + - eventSourceName + type: object + status: + description: EventReportStatus defines the observed state of EventReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: EventReport is the Schema for the EventReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this EventReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + EventReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this EventReport + is for. + type: string + eventSourceName: + description: |- + EventSourceName is the name of the EventSource instance this report + is for. + type: string + matchingResources: + description: MatchingResources contains a list of resources matching + an event + 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. + + + 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 + resources: + description: |- + If EventSource Spec.CollectResources is set to true, all matching resources + will be collected and contained in the Resources field. + format: byte + type: string + required: + - clusterName + - clusterNamespace + - clusterType + - eventSourceName + type: object + status: + description: EventReportStatus defines the observed state of EventReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventsources.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventsources.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..3d8639a --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_eventsources.lib.projectsveltos.io.yaml @@ -0,0 +1,235 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: eventsources.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: EventSource + listKind: EventSourceList + plural: eventsources + singular: eventsource + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: EventSource is the Schema for the EventSource 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: EventSourceSpec defines the desired state of EventSource + properties: + aggregatedSelection: + description: |- + This field is optional and can be used to specify a Lua function + that will be used to further select a subset of the resources that + have already been selected using the ResourceSelector field. + The function will receive the array of resources selected by ResourceSelectors. + If this field is not specified, all resources selected by the ResourceSelector + field will be considered. + This field allows to perform more complex filtering or selection operations + on the resources, looking at all resources together. + This can be useful for more sophisticated tasks, such as identifying resources + that are related to each other or that have similar properties. + The Lua function must return a struct with: + - "resources" field: slice of matching resorces; + - "message" field: (optional) message. + type: string + collectResources: + default: false + description: |- + CollectResources indicates whether matching resources need + to be collected and added to EventReport. + type: boolean + resourceSelectors: + description: ResourceSelectors identifies what resources to select + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based on + current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - resourceSelectors + type: object + type: object + served: true + storage: false + - name: v1beta1 + schema: + openAPIV3Schema: + description: EventSource is the Schema for the EventSource 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: EventSourceSpec defines the desired state of EventSource + properties: + aggregatedSelection: + description: |- + This field is optional and can be used to specify a Lua function + that will be used to further select a subset of the resources that + have already been selected using the ResourceSelector field. + The function will receive the array of resources selected by ResourceSelectors. + If this field is not specified, all resources selected by the ResourceSelector + field will be considered. + This field allows to perform more complex filtering or selection operations + on the resources, looking at all resources together. + This can be useful for more sophisticated tasks, such as identifying resources + that are related to each other or that have similar properties. + The Lua function must return a struct with: + - "resources" field: slice of matching resorces; + - "message" field: (optional) message. + type: string + collectResources: + default: false + description: |- + CollectResources indicates whether matching resources need + to be collected and added to EventReport. + type: boolean + resourceSelectors: + description: ResourceSelectors identifies what resources to select + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based on + current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - resourceSelectors + type: object + type: object + served: true + storage: true diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthcheckreports.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthcheckreports.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..9b0ad5a --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthcheckreports.lib.projectsveltos.io.yaml @@ -0,0 +1,289 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: healthcheckreports.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: HealthCheckReport + listKind: HealthCheckReportList + plural: healthcheckreports + singular: healthcheckreport + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: HealthCheckReport is the Schema for the HealthCheckReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this HealthCheckReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + HealthCheckReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this HealthCheckReport + is for. + type: string + healthCheckName: + description: |- + HealthName is the name of the HealthCheck instance this report + is for. + type: string + resourceStatuses: + description: ResourceStatuses contains a list of resources with their + status + items: + properties: + healthStatus: + description: HealthStatus is the health status of the object + enum: + - Healthy + - Progressing + - Degraded + - Suspended + type: string + message: + description: Message is an extra message for human consumption + type: string + objectRef: + description: ObjectRef for which status is reported + 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 + resource: + description: |- + If HealthCheck Spec.CollectResources is set to true, resource + will be collected and contained in the Resource field. + format: byte + type: string + required: + - healthStatus + - objectRef + type: object + type: array + required: + - clusterName + - clusterNamespace + - clusterType + - healthCheckName + type: object + status: + description: HealthCheckReportStatus defines the observed state of HealthCheckReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: HealthCheckReport is the Schema for the HealthCheckReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this HealthCheckReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + HealthCheckReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this HealthCheckReport + is for. + type: string + healthCheckName: + description: |- + HealthName is the name of the HealthCheck instance this report + is for. + type: string + resourceStatuses: + description: ResourceStatuses contains a list of resources with their + status + items: + properties: + healthStatus: + description: HealthStatus is the health status of the object + enum: + - Healthy + - Progressing + - Degraded + - Suspended + type: string + message: + description: Message is an extra message for human consumption + type: string + objectRef: + description: ObjectRef for which status is reported + 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 + resource: + description: |- + If HealthCheck Spec.CollectResources is set to true, resource + will be collected and contained in the Resource field. + format: byte + type: string + required: + - healthStatus + - objectRef + type: object + type: array + required: + - clusterName + - clusterNamespace + - clusterType + - healthCheckName + type: object + status: + description: HealthCheckReportStatus defines the observed state of HealthCheckReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthchecks.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthchecks.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..c0957ef --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_healthchecks.lib.projectsveltos.io.yaml @@ -0,0 +1,231 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: healthchecks.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: HealthCheck + listKind: HealthCheckList + plural: healthchecks + singular: healthcheck + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: HealthCheck is the Schema for the HealthCheck 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: HealthCheckSpec defines the desired state of HealthCheck + properties: + collectResources: + default: false + description: |- + CollectResources indicates whether matching resources need + to be collected and added to HealthReport. + type: boolean + evaluateHealth: + description: |- + The EvaluateHealth field specifies a Lua function responsible for evaluating the + health of the resources selected by resourceSelectors. + This function can assess the health of each resource independently or consider inter-resource relationships. + The function must be named *evaluate* and can access all objects identified by resourceSelectors using + the *resources* variable. It should return an array of structured instances, each containing the following fields: + - resource: The resource being evaluated + - healthStatus: The health status of the resource, which can be one of "Healthy", "Progressing", "Degraded", or "Suspended" + - message: An optional message providing additional information about the health status + minLength: 1 + type: string + resourceSelectors: + description: ResourceSelectors identifies what resources to select + to evaluate health + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based on + current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - evaluateHealth + - resourceSelectors + type: object + type: object + served: true + storage: false + - name: v1beta1 + schema: + openAPIV3Schema: + description: HealthCheck is the Schema for the HealthCheck 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: HealthCheckSpec defines the desired state of HealthCheck + properties: + collectResources: + default: false + description: |- + CollectResources indicates whether matching resources need + to be collected and added to HealthReport. + type: boolean + evaluateHealth: + description: |- + The EvaluateHealth field specifies a Lua function responsible for evaluating the + health of the resources selected by resourceSelectors. + This function can assess the health of each resource independently or consider inter-resource relationships. + The function must be named *evaluate* and can access all objects identified by resourceSelectors using + the *resources* variable. It should return an array of structured instances, each containing the following fields: + - resource: The resource being evaluated + - healthStatus: The health status of the resource, which can be one of "Healthy", "Progressing", "Degraded", or "Suspended" + - message: An optional message providing additional information about the health status + minLength: 1 + type: string + resourceSelectors: + description: ResourceSelectors identifies what resources to select + to evaluate health + items: + description: ResourceSelector defines what resources are a match + properties: + evaluate: + description: |- + Evaluate contains a function "evaluate" in lua language. + The function will be passed one of the object selected based on + above criteria. + Must return struct with field "matching" representing whether + object is a match and an optional "message" field. + type: string + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + labelFilters: + description: LabelFilters allows to filter resources based on + current labels. + items: + properties: + key: + description: Key is the label key + type: string + operation: + description: Operation is the comparison operation + enum: + - Equal + - Different + type: string + value: + description: Value is the label value + type: string + required: + - key + - operation + - value + type: object + type: array + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - version + type: object + type: array + required: + - evaluateHealth + - resourceSelectors + type: object + type: object + served: true + storage: true diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaderreports.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaderreports.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..026bf10 --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaderreports.lib.projectsveltos.io.yaml @@ -0,0 +1,201 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: reloaderreports.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: ReloaderReport + listKind: ReloaderReportList + plural: reloaderreports + singular: reloaderreport + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ReloaderReport is the Schema for the ReloaderReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this ReloaderReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + ReloaderReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this ReloaderReport + is for. + type: string + resourcesToReload: + description: |- + ResourcesToReload contains a list of resources that requires + rolling upgrade + items: + description: |- + ReloaderInfo represents a resource that need to be reloaded + if any mounted ConfigMap/Secret changes. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Deployment + StatefulSet DaemonSet.' + enum: + - Deployment + - StatefulSet + - DaemonSet + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: Namespace of the referenced resource. + minLength: 1 + type: string + value: + type: string + required: + - kind + - name + - namespace + type: object + type: array + required: + - clusterName + - clusterNamespace + - clusterType + type: object + status: + description: ReloaderReportStatus defines the observed state of ReloaderReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: ReloaderReport is the Schema for the ReloaderReport 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: + properties: + clusterName: + description: |- + ClusterName is the name of the Cluster this ReloaderReport + is for. + type: string + clusterNamespace: + description: |- + ClusterNamespace is the namespace of the Cluster this + ReloaderReport is for. + type: string + clusterType: + description: |- + ClusterType is the type of Cluster this ReloaderReport + is for. + type: string + resourcesToReload: + description: |- + ResourcesToReload contains a list of resources that requires + rolling upgrade + items: + description: |- + ReloaderInfo represents a resource that need to be reloaded + if any mounted ConfigMap/Secret changes. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Deployment + StatefulSet DaemonSet.' + enum: + - Deployment + - StatefulSet + - DaemonSet + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: Namespace of the referenced resource. + minLength: 1 + type: string + value: + type: string + required: + - kind + - name + - namespace + type: object + type: array + required: + - clusterName + - clusterNamespace + - clusterType + type: object + status: + description: ReloaderReportStatus defines the observed state of ReloaderReport + properties: + phase: + description: Phase represents the current phase of report. + enum: + - WaitingForDelivery + - Delivering + - Processed + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaders.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaders.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..4854f5c --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_reloaders.lib.projectsveltos.io.yaml @@ -0,0 +1,133 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: reloaders.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: Reloader + listKind: ReloaderList + plural: reloaders + singular: reloader + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Reloader is the Schema for the Reloader 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: ReloaderSpec defines the desired state of Reloader + properties: + reloaderInfo: + items: + description: |- + ReloaderInfo represents a resource that need to be reloaded + if any mounted ConfigMap/Secret changes. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Deployment + StatefulSet DaemonSet.' + enum: + - Deployment + - StatefulSet + - DaemonSet + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: Namespace of the referenced resource. + minLength: 1 + type: string + value: + type: string + required: + - kind + - name + - namespace + type: object + type: array + type: object + type: object + served: true + storage: false + - name: v1beta1 + schema: + openAPIV3Schema: + description: Reloader is the Schema for the Reloader 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: ReloaderSpec defines the desired state of Reloader + properties: + reloaderInfo: + items: + description: |- + ReloaderInfo represents a resource that need to be reloaded + if any mounted ConfigMap/Secret changes. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Deployment + StatefulSet DaemonSet.' + enum: + - Deployment + - StatefulSet + - DaemonSet + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: Namespace of the referenced resource. + minLength: 1 + type: string + value: + type: string + required: + - kind + - name + - namespace + type: object + type: array + type: object + type: object + served: true + storage: true diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_resourcesummaries.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_resourcesummaries.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..c4c18cd --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_resourcesummaries.lib.projectsveltos.io.yaml @@ -0,0 +1,539 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: resourcesummaries.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: ResourceSummary + listKind: ResourceSummaryList + plural: resourcesummaries + singular: resourcesummary + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ResourceSummary is the Schema for the ResourceSummary 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: ResourceSummarySpec defines the desired state of ResourceSummary + properties: + chartResources: + description: Resources deployed by ClusterSummary because of referenced + Helm charts + items: + properties: + chartName: + description: ChartName is the chart name + minLength: 1 + type: string + group: + description: Resources deployed by ClusterSummary because of + helm charts + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + releaseName: + description: ReleaseName is the chart release + minLength: 1 + type: string + releaseNamespace: + description: ReleaseNamespace is the namespace release will + be installed + minLength: 1 + type: string + required: + - chartName + - releaseName + - releaseNamespace + type: object + type: array + kustomizeResources: + description: |- + KustomizeResources deployed by ClusterSummary because of referenced + KustomizationRef + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + resources: + description: Resources deployed by ClusterSummary because of referenced + ConfigMaps/Secrets + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + type: object + status: + description: ResourceSummaryStatus defines the status of ResourceSummary + properties: + helmResourceHashes: + description: HelmResourceHashes specifies list of resource plus hash. + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + helmResourcesChanged: + description: Helm Resources changed. + type: boolean + kustomizeResourceHashes: + description: KustomizeResourceHashes specifies a list of resource + plus hash + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + kustomizeResourcesChanged: + description: KustomizeResources changed. + type: boolean + resourceHashes: + description: ResourceHashes specifies a list of resource plus hash + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + resourcesChanged: + description: Resources changed. + type: boolean + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: ResourceSummary is the Schema for the ResourceSummary 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: ResourceSummarySpec defines the desired state of ResourceSummary + properties: + chartResources: + description: Resources deployed by ClusterSummary because of referenced + Helm charts + items: + properties: + chartName: + description: ChartName is the chart name + minLength: 1 + type: string + group: + description: Resources deployed by ClusterSummary because of + helm charts + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + releaseName: + description: ReleaseName is the chart release + minLength: 1 + type: string + releaseNamespace: + description: ReleaseNamespace is the namespace release will + be installed + minLength: 1 + type: string + required: + - chartName + - releaseName + - releaseNamespace + type: object + type: array + kustomizeResources: + description: |- + KustomizeResources deployed by ClusterSummary because of referenced + KustomizationRef + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + resources: + description: Resources deployed by ClusterSummary because of referenced + ConfigMaps/Secrets + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + type: object + status: + description: ResourceSummaryStatus defines the status of ResourceSummary + properties: + helmResourceHashes: + description: HelmResourceHashes specifies list of resource plus hash. + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + helmResourcesChanged: + description: Helm Resources changed. + type: boolean + kustomizeResourceHashes: + description: KustomizeResourceHashes specifies a list of resource + plus hash + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + kustomizeResourcesChanged: + description: KustomizeResources changed. + type: boolean + resourceHashes: + description: ResourceHashes specifies a list of resource plus hash + items: + properties: + group: + description: Group of the resource deployed in the Cluster. + type: string + hash: + description: Hash is the hash of a resource's data. + type: string + kind: + description: Kind of the resource deployed in the Cluster. + minLength: 1 + type: string + name: + description: Name of the resource deployed in the Cluster. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the resource deployed in the Cluster. + Empty for resources scoped at cluster level. + type: string + version: + description: Version of the resource deployed in the Cluster. + type: string + required: + - group + - kind + - name + - version + type: object + type: array + resourcesChanged: + description: Resources changed. + type: boolean + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_rolerequests.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_rolerequests.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..9c1be0e --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_rolerequests.lib.projectsveltos.io.yaml @@ -0,0 +1,540 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert + controller-gen.kubebuilder.io/version: v0.15.0 + name: rolerequests.lib.projectsveltos.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: webhook-service + namespace: projectsveltos + path: /convert + conversionReviewVersions: + - v1 + group: lib.projectsveltos.io + names: + kind: RoleRequest + listKind: RoleRequestList + plural: rolerequests + singular: rolerequest + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: RoleRequest is the Schema for the rolerequest 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: RoleRequestSpec defines the desired state of RoleRequest + properties: + clusterSelector: + description: |- + ClusterSelector identifies clusters where permissions requestes + in this instance will be granted (Deprecated use selector instead) + type: string + expirationSeconds: + description: |- + ExpirationSeconds is the requested duration of validity of the TokenRequest + associated to ServiceAccount. If not specified, default value is used + format: int64 + type: integer + roleRefs: + description: |- + RoleRefs references all the Secret/ConfigMaps containing kubernetes + Roles/ClusterRoles that need to be deployed in the matching clusters. + items: + description: |- + PolicyRef specifies a resource containing one or more policy + to deploy in matching Clusters. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Secrets + and ConfigMaps.' + enum: + - Secret + - ConfigMap + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the referenced resource. + Namespace can be left empty. In such a case, namespace will + be implicit set to cluster's namespace. + type: string + required: + - kind + - name + - namespace + type: object + type: array + serviceAccountName: + description: |- + ServiceAccountName is the name of the ServiceAccount representing a tenant admin for which + those permissions are requested + type: string + serviceAccountNamespace: + description: |- + ServiceAccountNamespace is the name of the ServiceAccount representing a tenant admin + for which those permissions are requested + type: string + required: + - clusterSelector + - serviceAccountName + - serviceAccountNamespace + type: object + status: + description: RoleRequestStatus defines the status of RoleRequest + properties: + clusterInfo: + description: |- + ClusterInfo represents the hash of the ClusterRoles/Roles deployed in + a matching cluster for the admin. + items: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature in the + workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + type: array + failureMessage: + description: FailureMessage provides more information if an error + occurs. + type: string + matchingClusters: + description: |- + MatchingClusterRefs reference all the cluster currently matching + RoleRequest 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: RoleRequest is the Schema for the rolerequest 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: RoleRequestSpec defines the desired state of RoleRequest + properties: + expirationSeconds: + description: |- + ExpirationSeconds is the requested duration of validity of the TokenRequest + associated to ServiceAccount. If not specified, default value is used + format: int64 + type: integer + roleRefs: + description: |- + RoleRefs references all the Secret/ConfigMaps containing kubernetes + Roles/ClusterRoles that need to be deployed in the matching clusters. + items: + description: |- + PolicyRef specifies a resource containing one or more policy + to deploy in matching Clusters. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Secrets + and ConfigMaps.' + enum: + - Secret + - ConfigMap + type: string + name: + description: Name of the referenced resource. + minLength: 1 + type: string + namespace: + description: |- + Namespace of the referenced resource. + Namespace can be left empty. In such a case, namespace will + be implicit set to cluster's namespace. + type: string + required: + - kind + - name + - namespace + type: object + type: array + selector: + description: Selector identifies clusters to associate to. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + serviceAccountName: + description: |- + ServiceAccountName is the name of the ServiceAccount representing a tenant admin for which + those permissions are requested + type: string + serviceAccountNamespace: + description: |- + ServiceAccountNamespace is the name of the ServiceAccount representing a tenant admin + for which those permissions are requested + type: string + required: + - serviceAccountName + - serviceAccountNamespace + type: object + status: + description: RoleRequestStatus defines the status of RoleRequest + properties: + clusterInfo: + description: |- + ClusterInfo represents the hash of the ClusterRoles/Roles deployed in + a matching cluster for the admin. + items: + properties: + cluster: + description: Cluster references the Cluster + 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 + failureMessage: + description: FailureMessage provides more information about + the error. + type: string + hash: + description: |- + Hash represents the hash of the Classifier currently deployed + in the Cluster + format: byte + type: string + status: + description: Status represents the state of the feature in the + workload cluster + enum: + - Provisioning + - Provisioned + - Failed + - Removing + - Removed + type: string + required: + - cluster + - hash + type: object + type: array + failureMessage: + description: FailureMessage provides more information if an error + occurs. + type: string + matchingClusters: + description: |- + MatchingClusterRefs reference all the cluster currently matching + RoleRequest 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. + + + 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/manifests/apiextensions.k8s.io_v1_customresourcedefinition_sets.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_sets.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..4ec1d59 --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_sets.lib.projectsveltos.io.yaml @@ -0,0 +1,546 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: projectsveltos/projectsveltos-serving-cert + controller-gen.kubebuilder.io/version: v0.15.0 + name: sets.lib.projectsveltos.io +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: webhook-service + namespace: projectsveltos + path: /convert + conversionReviewVersions: + - v1 + group: lib.projectsveltos.io + names: + kind: Set + listKind: SetList + plural: sets + singular: set + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Set is the Schema for the sets 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: + 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. + + + 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 (Deprecated + use selector instead). + type: string + maxReplicas: + description: |- + MaxReplicas specifies the maximum number of clusters to be selected + from the pool matching the clusterSelector. + type: integer + type: object + status: + description: Status defines the observed state of ClusterSet/Set + properties: + matchingClusterRefs: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterSet/Set 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. + + + 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 + selectedClusterRefs: + description: |- + SelectedClusters reference all the cluster currently selected among + all the ones matching + 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. + + + 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: false + subresources: + status: {} + - name: v1beta1 + schema: + openAPIV3Schema: + description: Set is the Schema for the sets 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: + 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. + + + 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 + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + maxReplicas: + description: |- + MaxReplicas specifies the maximum number of clusters to be selected + from the pool matching the clusterSelector. + type: integer + type: object + status: + description: Status defines the observed state of ClusterSet/Set + properties: + matchingClusterRefs: + description: |- + MatchingClusterRefs reference all the clusters currently matching + ClusterSet/Set 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. + + + 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 + selectedClusterRefs: + description: |- + SelectedClusters reference all the cluster currently selected among + all the ones matching + 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. + + + 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/manifests/apiextensions.k8s.io_v1_customresourcedefinition_sveltosclusters.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_sveltosclusters.lib.projectsveltos.io.yaml new file mode 100644 index 0000000..b0395b6 --- /dev/null +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_sveltosclusters.lib.projectsveltos.io.yaml @@ -0,0 +1,195 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: sveltosclusters.lib.projectsveltos.io +spec: + group: lib.projectsveltos.io + names: + kind: SveltosCluster + listKind: SveltosClusterList + plural: sveltosclusters + singular: sveltoscluster + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: Indicates whether cluster is ready to be managed by sveltos + jsonPath: .status.ready + name: Ready + type: boolean + - description: Kubernetes version associated with this Cluster + jsonPath: .status.version + name: Version + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: SveltosCluster is the Schema for the SveltosCluster 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: SveltosClusterSpec defines the desired state of SveltosCluster + properties: + data: + additionalProperties: + type: string + description: ArbitraryData allows for arbitrary nested structures + type: object + kubeconfigName: + description: |- + KubeconfigName allows overriding the default Sveltos convention which expected a valid kubeconfig + to be hosted in a secret with the pattern ${sveltosClusterName}-sveltos-kubeconfig. + + + When a value is specified, the referenced Kubernetes Secret object must exist, + and will be used to connect to the Kubernetes cluster. + type: string + paused: + description: |- + Paused can be used to prevent controllers from processing the + SveltosCluster and all its associated objects. + type: boolean + tokenRequestRenewalOption: + description: TokenRequestRenewalOption contains options describing + how to renew TokenRequest + properties: + renewTokenRequestInterval: + description: RenewTokenRequestInterval is the interval at which + to renew the TokenRequest + type: string + required: + - renewTokenRequestInterval + type: object + type: object + status: + description: SveltosClusterStatus defines the status of SveltosCluster + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + lastReconciledTokenRequestAt: + description: |- + LastReconciledTokenRequestAt is the last time the TokenRequest + was renewed. + type: string + ready: + description: Ready is the state of the cluster. + type: boolean + version: + description: The Kubernetes version of the cluster. + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - description: Indicates whether cluster is ready to be managed by sveltos + jsonPath: .status.ready + name: Ready + type: boolean + - description: Kubernetes version associated with this Cluster + jsonPath: .status.version + name: Version + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: SveltosCluster is the Schema for the SveltosCluster 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: SveltosClusterSpec defines the desired state of SveltosCluster + properties: + data: + additionalProperties: + type: string + description: ArbitraryData allows for arbitrary nested structures + type: object + kubeconfigName: + description: |- + KubeconfigName allows overriding the default Sveltos convention which expected a valid kubeconfig + to be hosted in a secret with the pattern ${sveltosClusterName}-sveltos-kubeconfig. + + + When a value is specified, the referenced Kubernetes Secret object must exist, + and will be used to connect to the Kubernetes cluster. + type: string + paused: + description: |- + Paused can be used to prevent controllers from processing the + SveltosCluster and all its associated objects. + type: boolean + tokenRequestRenewalOption: + description: TokenRequestRenewalOption contains options describing + how to renew TokenRequest + properties: + renewTokenRequestInterval: + description: RenewTokenRequestInterval is the interval at which + to renew the TokenRequest + type: string + required: + - renewTokenRequestInterval + type: object + type: object + status: + description: SveltosClusterStatus defines the status of SveltosCluster + properties: + failureMessage: + description: |- + FailureMessage is a human consumable message explaining the + misconfiguration + type: string + lastReconciledTokenRequestAt: + description: |- + LastReconciledTokenRequestAt is the last time the TokenRequest + was renewed. + type: string + ready: + description: Ready is the state of the cluster. + type: boolean + version: + description: The Kubernetes version of the cluster. + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {}