diff --git a/go.mod b/go.mod index 9975686c7..e618b2962 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/nmstate/kubernetes-nmstate/api v0.0.0-20240605150941-df565dd7bf35 github.com/onsi/ginkgo/v2 v2.19.0 github.com/onsi/gomega v1.33.1 - github.com/openshift-kni/eco-goinfra v0.0.0-20240726142624-8eb62208ad75 // latest + github.com/openshift-kni/eco-goinfra v0.0.0-20240731154756-d6b470ae81c2 // latest github.com/openshift-kni/k8sreporter v1.0.5 github.com/openshift/api v3.9.1-0.20191111211345-a27ff30ebf09+incompatible github.com/openshift/cluster-nfd-operator v0.0.0-20240604082319-19bf50784aa7 diff --git a/go.sum b/go.sum index 1428cde84..98c7174bd 100644 --- a/go.sum +++ b/go.sum @@ -1677,8 +1677,8 @@ github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/openshift-kni/cluster-group-upgrades-operator v0.0.0-20240423171335-f07cdbf8af2c h1:wAPCXsnAXOUAJ5DYlVgGUcV9YBSiVlH4o9tbQ9py8ZY= github.com/openshift-kni/cluster-group-upgrades-operator v0.0.0-20240423171335-f07cdbf8af2c/go.mod h1:hkzqKpmQvh7vgPx8Hw6IExJorKPM0dEeJdOXjIW3gNw= -github.com/openshift-kni/eco-goinfra v0.0.0-20240726142624-8eb62208ad75 h1:uQLMNk7wMc6M3E9EPZsCyOE7b6dfR1R/VuA9OtoodIE= -github.com/openshift-kni/eco-goinfra v0.0.0-20240726142624-8eb62208ad75/go.mod h1:8ZRjyXSCF76jL77Cd5EQucWPIUTabUM3aI5JblC/vMk= +github.com/openshift-kni/eco-goinfra v0.0.0-20240731154756-d6b470ae81c2 h1:aA+sf6SZUXe1ZyRaeTrhfNzk88u/vBKgECSTeOOOME4= +github.com/openshift-kni/eco-goinfra v0.0.0-20240731154756-d6b470ae81c2/go.mod h1:8ZRjyXSCF76jL77Cd5EQucWPIUTabUM3aI5JblC/vMk= github.com/openshift-kni/k8sreporter v1.0.5 h1:1GYBc/BTZyVoXilHef43v9A8BSzw700zAPZ6zsZvo6Y= github.com/openshift-kni/k8sreporter v1.0.5/go.mod h1:fg8HI9yxiKAi6UzR6NTtrmQmA2WKzUqmkRUHwQ1+Bj8= github.com/openshift-kni/lifecycle-agent v0.0.0-20240606123201-0c45cd13c2f1 h1:y+0Ecc+MSZA/GNS3VOpKq+XK9x8qoNA7TlyHvqbVbpw= diff --git a/tests/cnf/ran/talm/internal/helper/cgu.go b/tests/cnf/ran/talm/internal/helper/cgu.go index 35a6bf8b3..54bdcfd14 100644 --- a/tests/cnf/ran/talm/internal/helper/cgu.go +++ b/tests/cnf/ran/talm/internal/helper/cgu.go @@ -12,10 +12,10 @@ import ( "github.com/openshift-kni/eco-goinfra/pkg/namespace" "github.com/openshift-kni/eco-goinfra/pkg/ocm" "github.com/openshift-kni/eco-goinfra/pkg/olm" + operatorsv1alpha1 "github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1" . "github.com/openshift-kni/eco-gotests/tests/cnf/ran/internal/raninittools" "github.com/openshift-kni/eco-gotests/tests/cnf/ran/talm/internal/tsparams" configv1 "github.com/openshift/api/config/v1" - operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" diff --git a/tests/cnf/ran/talm/internal/tsparams/talmvars.go b/tests/cnf/ran/talm/internal/tsparams/talmvars.go index 195a64ec1..ae4bc9dcf 100644 --- a/tests/cnf/ran/talm/internal/tsparams/talmvars.go +++ b/tests/cnf/ran/talm/internal/tsparams/talmvars.go @@ -4,9 +4,9 @@ import ( "fmt" cguv1alpha1 "github.com/openshift-kni/cluster-group-upgrades-operator/pkg/api/clustergroupupgrades/v1alpha1" + olmv1alpha1 "github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1" "github.com/openshift-kni/eco-gotests/tests/cnf/ran/internal/ranparam" "github.com/openshift-kni/k8sreporter" - olmv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/utils/ptr" policiesv1 "open-cluster-management.io/governance-policy-propagator/api/v1" diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/clients/clients.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/clients/clients.go index cfdb7d9d1..8b7fae18b 100644 --- a/vendor/github.com/openshift-kni/eco-goinfra/pkg/clients/clients.go +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/clients/clients.go @@ -6,7 +6,6 @@ import ( "os" "github.com/openshift-kni/eco-goinfra/pkg/argocd/argocdtypes" - "github.com/openshift-kni/eco-goinfra/pkg/oadp/oadptypes" "github.com/golang/glog" "k8s.io/client-go/dynamic" @@ -23,13 +22,11 @@ import ( eskv1 "github.com/openshift/elasticsearch-operator/apis/logging/v1" monv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + oauthv1 "github.com/openshift/api/oauth/v1" clientConfigV1 "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1" v1security "github.com/openshift/client-go/security/clientset/versioned/typed/security/v1" mcv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1" ptpV1 "github.com/openshift/ptp-operator/pkg/client/clientset/versioned/typed/ptp/v1" - olm2 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme" - - oauthv1 "github.com/openshift/api/oauth/v1" olmv1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1" olm "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/typed/operators/v1alpha1" @@ -106,7 +103,6 @@ import ( multinetpolicyclientv1 "github.com/k8snetworkplumbingwg/multi-networkpolicy/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1beta1" noobaav1alpha1 "github.com/kube-object-storage/lib-bucket-provisioner/pkg/apis/objectbucket.io/v1alpha1" cguapiv1alpha1 "github.com/openshift-kni/cluster-group-upgrades-operator/pkg/api/clustergroupupgrades/v1alpha1" - nvidiagpuv1 "github.com/openshift-kni/eco-goinfra/pkg/schemes/nvidiagpu/nvidiagputypes" machinev1beta1client "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1" operatorv1alpha1 "github.com/openshift/client-go/operator/clientset/versioned/typed/operator/v1alpha1" nfdv1 "github.com/openshift/cluster-nfd-operator/api/v1" @@ -293,10 +289,6 @@ func SetScheme(crScheme *runtime.Scheme) error { return err } - if err := olm2.AddToScheme(crScheme); err != nil { - return err - } - if err := oauthv1.AddToScheme(crScheme); err != nil { return err } @@ -333,10 +325,6 @@ func SetScheme(crScheme *runtime.Scheme) error { return err } - if err := nvidiagpuv1.AddToScheme(crScheme); err != nil { - return err - } - if err := nfdv1.AddToScheme(crScheme); err != nil { return err } @@ -609,8 +597,6 @@ func GetTestClients(tcp TestClientParams) *Settings { genericClientObjects = append(genericClientObjects, v) case *monv1.ServiceMonitor: genericClientObjects = append(genericClientObjects, v) - case *oadptypes.DataProtectionApplication: - genericClientObjects = append(genericClientObjects, v) // ArgoCD Client Objects case *argocdOperatorv1alpha1.ArgoCD: genericClientObjects = append(genericClientObjects, v) diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/nvidiagpu/clusterpolicy.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/nvidiagpu/clusterpolicy.go index 09ce2f268..2c25d793c 100644 --- a/vendor/github.com/openshift-kni/eco-goinfra/pkg/nvidiagpu/clusterpolicy.go +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/nvidiagpu/clusterpolicy.go @@ -11,7 +11,7 @@ import ( k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/json" - goclient "sigs.k8s.io/controller-runtime/pkg/client" + runtimeClient "sigs.k8s.io/controller-runtime/pkg/client" ) // Builder provides a struct for ClusterPolicy object @@ -23,7 +23,7 @@ type Builder struct { // Created Builder object on the cluster. Object *nvidiagpuv1.ClusterPolicy // api client to interact with the cluster. - apiClient *clients.Settings + apiClient runtimeClient.Client // errorMsg is processed before Builder object is created. errorMsg string } @@ -33,24 +33,40 @@ func NewBuilderFromObjectString(apiClient *clients.Settings, almExample string) glog.V(100).Infof( "Initializing new Builder structure from almExample string") + if apiClient == nil { + glog.V(100).Infof("The apiClient cannot be nil") + + return nil + } + + err := apiClient.AttachScheme(nvidiagpuv1.AddToScheme) + if err != nil { + glog.V(100).Infof("Failed to add nvidiagpuv1 scheme to client schemes") + + return nil + } + clusterPolicy, err := getClusterPolicyFromAlmExample(almExample) + if err != nil { + glog.V(100).Infof( + "error initializing ClusterPolicy from alm-examples: %s", err.Error()) + + return &Builder{ + apiClient: apiClient.Client, + errorMsg: fmt.Sprintf("error initializing ClusterPolicy from alm-examples: %s", err.Error()), + } + } + glog.V(100).Infof( "Initializing new Builder structure from almExample string with clusterPolicy name: %s", clusterPolicy.Name) builder := Builder{ - apiClient: apiClient, + apiClient: apiClient.Client, Definition: clusterPolicy, } - if err != nil { - glog.V(100).Infof( - "Error initializing ClusterPolicy from alm-examples: %s", err.Error()) - - builder.errorMsg = fmt.Sprintf("Error initializing ClusterPolicy from alm-examples: %s", err.Error()) - } - if builder.Definition == nil { glog.V(100).Infof("The ClusterPolicy object definition is nil") @@ -60,36 +76,25 @@ func NewBuilderFromObjectString(apiClient *clients.Settings, almExample string) return &builder } -// Get returns clusterPolicy object if found. -func (builder *Builder) Get() (*nvidiagpuv1.ClusterPolicy, error) { - if valid, err := builder.validate(); !valid { - return nil, err - } +// Pull loads an existing clusterPolicy into Builder struct. +func Pull(apiClient *clients.Settings, name string) (*Builder, error) { + glog.V(100).Infof("Pulling existing clusterPolicy name: %s", name) - glog.V(100).Infof( - "Collecting ClusterPolicy object %s", builder.Definition.Name) + if apiClient == nil { + glog.V(100).Infof("The apiClient cannot be nil") - clusterPolicy := &nvidiagpuv1.ClusterPolicy{} - err := builder.apiClient.Get(context.TODO(), goclient.ObjectKey{ - Name: builder.Definition.Name, - }, clusterPolicy) + return nil, fmt.Errorf("clusterPolicy 'apiClient' cannot be nil") + } + err := apiClient.AttachScheme(nvidiagpuv1.AddToScheme) if err != nil { - glog.V(100).Infof( - "ClusterPolicy object %s does not exist", builder.Definition.Name) + glog.V(100).Infof("Failed to add nvidiagpuv1 scheme to client schemes") return nil, err } - return clusterPolicy, err -} - -// Pull loads an existing clusterPolicy into Builder struct. -func Pull(apiClient *clients.Settings, name string) (*Builder, error) { - glog.V(100).Infof("Pulling existing clusterPolicy name: %s", name) - builder := Builder{ - apiClient: apiClient, + apiClient: apiClient.Client, Definition: &nvidiagpuv1.ClusterPolicy{ ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -100,7 +105,7 @@ func Pull(apiClient *clients.Settings, name string) (*Builder, error) { if name == "" { glog.V(100).Infof("ClusterPolicy name is empty") - builder.errorMsg = "ClusterPolicy 'name' cannot be empty" + return nil, fmt.Errorf("clusterPolicy 'name' cannot be empty") } if !builder.Exists() { @@ -112,6 +117,28 @@ func Pull(apiClient *clients.Settings, name string) (*Builder, error) { return &builder, nil } +// Get returns clusterPolicy object if found. +func (builder *Builder) Get() (*nvidiagpuv1.ClusterPolicy, error) { + if valid, err := builder.validate(); !valid { + return nil, err + } + + glog.V(100).Infof( + "Collecting ClusterPolicy object %s", builder.Definition.Name) + + clusterPolicy := &nvidiagpuv1.ClusterPolicy{} + err := builder.apiClient.Get(context.TODO(), runtimeClient.ObjectKey{Name: builder.Definition.Name}, clusterPolicy) + + if err != nil { + glog.V(100).Infof( + "ClusterPolicy object %s does not exist", builder.Definition.Name) + + return nil, err + } + + return clusterPolicy, err +} + // Exists checks whether the given ClusterPolicy exists. func (builder *Builder) Exists() bool { if valid, _ := builder.validate(); !valid { @@ -140,7 +167,9 @@ func (builder *Builder) Delete() (*Builder, error) { glog.V(100).Infof("Deleting ClusterPolicy %s", builder.Definition.Name) if !builder.Exists() { - return builder, fmt.Errorf("clusterpolicy cannot be deleted because it does not exist") + glog.V(100).Infof("clusterpolicy cannot be deleted because it does not exist") + + return builder, nil } err := builder.apiClient.Delete(context.TODO(), builder.Definition) @@ -204,27 +233,6 @@ func (builder *Builder) Update(force bool) (*Builder, error) { return builder, err } -// getClusterPolicyFromAlmExample extracts the ClusterPolicy from the alm-examples block. -func getClusterPolicyFromAlmExample(almExample string) (*nvidiagpuv1.ClusterPolicy, error) { - clusterPolicyList := &nvidiagpuv1.ClusterPolicyList{} - - if almExample == "" { - return nil, fmt.Errorf("almExample is an empty string") - } - - err := json.Unmarshal([]byte(almExample), &clusterPolicyList.Items) - - if err != nil { - return nil, err - } - - if len(clusterPolicyList.Items) == 0 { - return nil, fmt.Errorf("failed to get alm examples") - } - - return &clusterPolicyList.Items[0], nil -} - // validate will check that the builder and builder definition are properly initialized before // accessing any member fields. func (builder *Builder) validate() (bool, error) { @@ -256,3 +264,24 @@ func (builder *Builder) validate() (bool, error) { return true, nil } + +// getClusterPolicyFromAlmExample extracts the ClusterPolicy from the alm-examples block. +func getClusterPolicyFromAlmExample(almExample string) (*nvidiagpuv1.ClusterPolicy, error) { + clusterPolicyList := &nvidiagpuv1.ClusterPolicyList{} + + if almExample == "" { + return nil, fmt.Errorf("almExample is an empty string") + } + + err := json.Unmarshal([]byte(almExample), &clusterPolicyList.Items) + + if err != nil { + return nil, err + } + + if len(clusterPolicyList.Items) == 0 { + return nil, fmt.Errorf("failed to get alm examples") + } + + return &clusterPolicyList.Items[0], nil +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/const.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/const.go deleted file mode 100644 index 7180eddc3..000000000 --- a/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/const.go +++ /dev/null @@ -1,10 +0,0 @@ -package oadp - -const ( - // APIGroup represents oadp api group. - APIGroup = "oadp.openshift.io" - // V1Alpha1Version represents v1alpha1 version of oadp api. - V1Alpha1Version = "v1alpha1" - // DPAKind represents the kind for dataprotectionapplication resources. - DPAKind = "DataProtectionApplication" -) diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/dataprotectionapplication.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/dataprotectionapplication.go index c450365df..d249cf4a4 100644 --- a/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/dataprotectionapplication.go +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/dataprotectionapplication.go @@ -7,36 +7,27 @@ import ( "github.com/golang/glog" "github.com/openshift-kni/eco-goinfra/pkg/clients" "github.com/openshift-kni/eco-goinfra/pkg/msg" - "github.com/openshift-kni/eco-goinfra/pkg/oadp/oadptypes" + oadpv1alpha1 "github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" + runtimeClient "sigs.k8s.io/controller-runtime/pkg/client" ) // DPABuilder provides a struct for backup object from the cluster and a backup definition. type DPABuilder struct { // Backup definition, used to create the backup object. - Definition *oadptypes.DataProtectionApplication + Definition *oadpv1alpha1.DataProtectionApplication // Created backup object. - Object *oadptypes.DataProtectionApplication + Object *oadpv1alpha1.DataProtectionApplication // Used to store latest error message upon defining or mutating backup definition. errorMsg string // api client to interact with the cluster. - apiClient *clients.Settings -} - -// GetDataProtectionApplicationGVR returns dataprotectionapplication's GroupVersionResource. -func GetDataProtectionApplicationGVR() schema.GroupVersionResource { - return schema.GroupVersionResource{ - Group: APIGroup, Version: V1Alpha1Version, Resource: "dataprotectionapplications", - } + apiClient runtimeClient.Client } // NewDPABuilder creates a new instance of DPABuilder. func NewDPABuilder( - apiClient *clients.Settings, name, namespace string, config oadptypes.ApplicationConfig) *DPABuilder { + apiClient *clients.Settings, name, namespace string, config oadpv1alpha1.ApplicationConfig) *DPABuilder { glog.V(100).Infof( "Initializing new dataprotectionapplication structure with the following params: "+ "name: %s, namespace: %s, config %v", @@ -48,18 +39,21 @@ func NewDPABuilder( return nil } + if err := apiClient.AttachScheme(oadpv1alpha1.AddToScheme); err != nil { + glog.V(100).Infof( + "Failed to add oadpv1alpha1 scheme to client schemes") + + return nil + } + builder := &DPABuilder{ - apiClient: apiClient, - Definition: &oadptypes.DataProtectionApplication{ - TypeMeta: metav1.TypeMeta{ - Kind: DPAKind, - APIVersion: V1Alpha1Version, - }, + apiClient: apiClient.Client, + Definition: &oadpv1alpha1.DataProtectionApplication{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, }, - Spec: oadptypes.DataProtectionApplicationSpec{ + Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &config, }, }, @@ -96,9 +90,16 @@ func PullDPA(apiClient *clients.Settings, name, nsname string) (*DPABuilder, err return nil, fmt.Errorf("the apiClient is nil") } + if err := apiClient.AttachScheme(oadpv1alpha1.AddToScheme); err != nil { + glog.V(100).Infof( + "Failed to add oadpv1alpha1 scheme to client schemes") + + return nil, fmt.Errorf("failed to add oadpv1alpha1 to client schemes") + } + builder := DPABuilder{ - apiClient: apiClient, - Definition: &oadptypes.DataProtectionApplication{ + apiClient: apiClient.Client, + Definition: &oadpv1alpha1.DataProtectionApplication{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: nsname, @@ -128,7 +129,7 @@ func PullDPA(apiClient *clients.Settings, name, nsname string) (*DPABuilder, err } // WithBackupLocation configures the dataprotectionapplication with the specified backup location. -func (builder *DPABuilder) WithBackupLocation(backupLocation oadptypes.BackupLocation) *DPABuilder { +func (builder *DPABuilder) WithBackupLocation(backupLocation oadpv1alpha1.BackupLocation) *DPABuilder { if valid, _ := builder.validate(); !valid { return builder } @@ -150,7 +151,7 @@ func (builder *DPABuilder) WithBackupLocation(backupLocation oadptypes.BackupLoc } // Get fetches the defined dataprotectionapplication from the cluster. -func (builder *DPABuilder) Get() (*oadptypes.DataProtectionApplication, error) { +func (builder *DPABuilder) Get() (*oadpv1alpha1.DataProtectionApplication, error) { if valid, err := builder.validate(); !valid { return nil, err } @@ -158,14 +159,18 @@ func (builder *DPABuilder) Get() (*oadptypes.DataProtectionApplication, error) { glog.V(100).Infof("Getting dataprotectionapplication %s in namespace %s", builder.Definition.Name, builder.Definition.Namespace) - unsObject, err := builder.apiClient.Resource(GetDataProtectionApplicationGVR()).Namespace( - builder.Definition.Namespace).Get(context.TODO(), builder.Definition.Name, metav1.GetOptions{}) + dataprotectionapplication := &oadpv1alpha1.DataProtectionApplication{} + + err := builder.apiClient.Get(context.TODO(), runtimeClient.ObjectKey{ + Name: builder.Definition.Name, + Namespace: builder.Definition.Namespace, + }, dataprotectionapplication) if err != nil { return nil, err } - return builder.convertToStructured(unsObject) + return dataprotectionapplication, err } // Exists checks whether the given dataprotectionapplication exists. @@ -195,28 +200,9 @@ func (builder *DPABuilder) Create() (*DPABuilder, error) { var err error if !builder.Exists() { - unstructuredDPA, err := runtime.DefaultUnstructuredConverter.ToUnstructured(builder.Definition) - - if err != nil { - glog.V(100).Infof("Failed to convert structured DataProtectionApplication to unstructured object") - - return nil, err - } - - unsObject, err := builder.apiClient.Resource( - GetDataProtectionApplicationGVR()).Namespace(builder.Definition.Namespace).Create( - context.TODO(), &unstructured.Unstructured{Object: unstructuredDPA}, metav1.CreateOptions{}) - - if err != nil { - glog.V(100).Infof("Failed to create dataprotectionapplication") - - return nil, err - } - - builder.Object, err = builder.convertToStructured(unsObject) - - if err != nil { - return nil, err + err = builder.apiClient.Create(context.TODO(), builder.Definition) + if err == nil { + builder.Object = builder.Definition } } @@ -230,38 +216,22 @@ func (builder *DPABuilder) Update(force bool) (*DPABuilder, error) { return builder, err } + glog.V(100).Infof("Updating dataprotectionapplication %s in namespace %s", + builder.Definition.Name, builder.Definition.Namespace) + if !builder.Exists() { return nil, fmt.Errorf("failed to update dataprotectionapplication, object does not exist on cluster") } - glog.V(100).Infof("Updating the dataprotectionapplication object %s in namespace %s", - builder.Definition.Name, builder.Definition.Namespace, - ) - - if builder.errorMsg != "" { - return nil, fmt.Errorf(builder.errorMsg) - } - - builder.Definition.ResourceVersion = builder.Object.ResourceVersion - builder.Definition.ObjectMeta.ResourceVersion = builder.Object.ObjectMeta.ResourceVersion - - unstructuredDPA, err := runtime.DefaultUnstructuredConverter.ToUnstructured(builder.Definition) - if err != nil { - glog.V(100).Infof("Failed to convert structured DataProtectionApplication to unstructured object") - - return nil, err - } - - unstructObj, err := builder.apiClient.Resource( - GetDataProtectionApplicationGVR()).Namespace(builder.Definition.Namespace).Update( - context.TODO(), &unstructured.Unstructured{Object: unstructuredDPA}, metav1.UpdateOptions{}) + err := builder.apiClient.Update(context.TODO(), builder.Definition) if err != nil { if force { glog.V(100).Infof( msg.FailToUpdateNotification("dataprotectionapplication", builder.Definition.Name, builder.Definition.Namespace)) - err := builder.Delete() + err = builder.Delete() + builder.Definition.ResourceVersion = "" if err != nil { glog.V(100).Infof( @@ -275,14 +245,7 @@ func (builder *DPABuilder) Update(force bool) (*DPABuilder, error) { } if err == nil { - structuredDPA, err := builder.convertToStructured(unstructObj) - if err != nil { - glog.V(100).Infof("Failed to convert unstructured dataprotectionapplication into structured object") - - return nil, err - } - - builder.Object = structuredDPA + builder.Object = builder.Definition } return builder, err @@ -294,9 +257,8 @@ func (builder *DPABuilder) Delete() error { return err } - glog.V(100).Infof("Deleting the dataprotectionapplication object %s in namespace %s", - builder.Definition.Name, builder.Definition.Namespace, - ) + glog.V(100).Infof("Deleting the dataprotectionapplication %s in namespace %s", + builder.Definition.Name, builder.Definition.Namespace) if !builder.Exists() { glog.V(100).Infof("Dataprotectionapplication %s in namespace %s cannot be deleted because it does not exist", @@ -305,12 +267,10 @@ func (builder *DPABuilder) Delete() error { return nil } - err := builder.apiClient.Resource( - GetDataProtectionApplicationGVR()).Namespace(builder.Definition.Namespace).Delete( - context.TODO(), builder.Definition.Name, metav1.DeleteOptions{}) + err := builder.apiClient.Delete(context.TODO(), builder.Definition) if err != nil { - return fmt.Errorf("can not delete dataprotectionapplication: %w", err) + return fmt.Errorf("cannot delete dataprotectionapplication: %w", err) } builder.Object = nil @@ -318,22 +278,6 @@ func (builder *DPABuilder) Delete() error { return nil } -func (builder *DPABuilder) convertToStructured( - unsObject *unstructured.Unstructured) (*oadptypes.DataProtectionApplication, error) { - dpaBuilder := &oadptypes.DataProtectionApplication{} - - err := runtime.DefaultUnstructuredConverter.FromUnstructured(unsObject.Object, dpaBuilder) - if err != nil { - glog.V(100).Infof( - "Failed to convert from unstructured to DataProtectionApplication object in namespace %s", - builder.Definition.Name, builder.Definition.Namespace) - - return nil, err - } - - return dpaBuilder, err -} - // validate will check that the builder and builder definition are properly initialized before // accessing any member fields. func (builder *DPABuilder) validate() (bool, error) { diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/dataprotectionapplicationlist.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/dataprotectionapplicationlist.go index 06b6955dd..7e32bd117 100644 --- a/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/dataprotectionapplicationlist.go +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/dataprotectionapplicationlist.go @@ -6,14 +6,13 @@ import ( "github.com/golang/glog" "github.com/openshift-kni/eco-goinfra/pkg/clients" - "github.com/openshift-kni/eco-goinfra/pkg/oadp/oadptypes" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" + oadpv1alpha1 "github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1" + runtimeClient "sigs.k8s.io/controller-runtime/pkg/client" ) // ListDataProtectionApplication returns dataprotectionapplication inventory in the given namespace. func ListDataProtectionApplication( - apiClient *clients.Settings, nsname string, options ...metav1.ListOptions) ([]*DPABuilder, error) { + apiClient *clients.Settings, nsname string, options ...runtimeClient.ListOptions) ([]*DPABuilder, error) { glog.V(100).Infof("Listing dataprotectionapplications in namespace %s", nsname) if apiClient == nil { @@ -22,6 +21,13 @@ func ListDataProtectionApplication( return nil, fmt.Errorf("the apiClient is nil") } + if err := apiClient.AttachScheme(oadpv1alpha1.AddToScheme); err != nil { + glog.V(100).Infof( + "Failed to add oadpv1alpha1 scheme to client schemes") + + return nil, err + } + if nsname == "" { glog.V(100).Infof("dataprotectionapplication 'nsname' parameter can not be empty") @@ -29,7 +35,7 @@ func ListDataProtectionApplication( } logMessage := fmt.Sprintf("Listing dataprotectionapplications in the nsname %s", nsname) - passedOptions := metav1.ListOptions{} + passedOptions := runtimeClient.ListOptions{} if len(options) == 1 { passedOptions = options[0] @@ -42,35 +48,26 @@ func ListDataProtectionApplication( glog.V(100).Infof(logMessage) - unstructObjList, err := apiClient.Resource(GetDataProtectionApplicationGVR()). - Namespace(nsname).List(context.TODO(), passedOptions) + dataprotectionapplications := new(oadpv1alpha1.DataProtectionApplicationList) + err := apiClient.List(context.TODO(), dataprotectionapplications, &passedOptions) + if err != nil { - glog.V(100).Infof("Failed to list dataprotectionapplications in the nsname %s due to %s", nsname, err.Error()) + glog.V(100).Infof("Failed to list all dataprotectionapplications due to %s", err.Error()) return nil, err } var dpaObjects []*DPABuilder - for _, runningDPA := range unstructObjList.Items { - dataprotectionapplication := &oadptypes.DataProtectionApplication{} - - err = runtime.DefaultUnstructuredConverter.FromUnstructured(runningDPA.Object, dataprotectionapplication) - if err != nil { - glog.V(100).Infof( - "Failed to convert from unstructured list to DataProtectionApplicationList object in namespace %s", - nsname) - - return nil, err - } - - dpaBuilder := &DPABuilder{ - apiClient: apiClient, - Object: dataprotectionapplication, - Definition: dataprotectionapplication, + for _, dataprotectionapplication := range dataprotectionapplications.Items { + copiedDPA := dataprotectionapplication + builder := &DPABuilder{ + apiClient: apiClient.Client, + Object: &copiedDPA, + Definition: &copiedDPA, } - dpaObjects = append(dpaObjects, dpaBuilder) + dpaObjects = append(dpaObjects, builder) } return dpaObjects, nil diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/oadptypes/dataprotectionapplication.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/oadptypes/dataprotectionapplication.go deleted file mode 100644 index 3ca042912..000000000 --- a/vendor/github.com/openshift-kni/eco-goinfra/pkg/oadp/oadptypes/dataprotectionapplication.go +++ /dev/null @@ -1,1041 +0,0 @@ -/* -Copyright 2021. - -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 oadptypes - -import ( - velero "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // DPAGroupVersion is group version used to register these objects. - DPAGroupVersion = schema.GroupVersion{Group: "oadp.openshift.io", Version: "v1alpha1"} - - // DPASchemeBuilder is used to add go types to the GroupVersionKind scheme. - DPASchemeBuilder = &scheme.Builder{GroupVersion: DPAGroupVersion} - - // DPAAddToScheme adds the types in this group-version to the given scheme. - DPAAddToScheme = DPASchemeBuilder.AddToScheme -) - -// ConditionReconciled represents Reconciled condition. -const ConditionReconciled = "Reconciled" - -// ReconciledReasonComplete represents Reconciled condition complete reason. -const ReconciledReasonComplete = "Complete" - -// ReconciledReasonError represents Reconciled condition error reason. -const ReconciledReasonError = "Error" - -// ReconcileCompleteMessage represents Reconciled condition complete message. -const ReconcileCompleteMessage = "Reconcile complete" - -// DefaultPlugin contains string name of plugin. -type DefaultPlugin string - -// DefaultPluginAWS represents aws plugin name. -const DefaultPluginAWS DefaultPlugin = "aws" - -// DefaultPluginGCP represents gcp plugin name. -const DefaultPluginGCP DefaultPlugin = "gcp" - -// DefaultPluginMicrosoftAzure represents azure plugin name. -const DefaultPluginMicrosoftAzure DefaultPlugin = "azure" - -// DefaultPluginCSI represents csi plugin name. -const DefaultPluginCSI DefaultPlugin = "csi" - -// DefaultPluginVSM represents vsm plugin name. -const DefaultPluginVSM DefaultPlugin = "vsm" - -// DefaultPluginOpenShift represents openshift plugin name. -const DefaultPluginOpenShift DefaultPlugin = "openshift" - -// DefaultPluginKubeVirt represents kubevirt plugin name. -const DefaultPluginKubeVirt DefaultPlugin = "kubevirt" - -// CustomPlugin sets name and image of custom plugin. -type CustomPlugin struct { - Name string `json:"name"` - Image string `json:"image"` -} - -// UnsupportedImageKey field does not have enum validation for development flexibility. -type UnsupportedImageKey string - -// VeleroConfig contains velero configuration. -type VeleroConfig struct { - // featureFlags defines the list of features to enable for Velero instance - // +optional - FeatureFlags []string `json:"featureFlags,omitempty"` - DefaultPlugins []DefaultPlugin `json:"defaultPlugins,omitempty"` - // customPlugins defines the custom plugin to be installed with Velero - // +optional - CustomPlugins []CustomPlugin `json:"customPlugins,omitempty"` - // restoreResourceVersionPriority represents a configmap that will be created if - // defined for use in conjunction with EnableAPIGroupVersions feature flag - // Defining this field automatically add EnableAPIGroupVersions to the velero server feature flag - // +optional - RestoreResourcesVersionPriority string `json:"restoreResourcesVersionPriority,omitempty"` - // If you need to install Velero without a default backup storage location noDefaultBackupLocation - // flag is required for confirmation - // +optional - NoDefaultBackupLocation bool `json:"noDefaultBackupLocation,omitempty"` - // Pod specific configuration - PodConfig *PodConfig `json:"podConfig,omitempty"` - // Velero server’s log level (use debug for the most logging, leave unset for velero default) - // +optional - // +kubebuilder:validation:Enum=trace;debug;info;warning;error;fatal;panic - LogLevel string `json:"logLevel,omitempty"` - // How often to check status on async backup/restore operations after backup processing. Default value is 2m. - // +optional - ItemOperationSyncFrequency string `json:"itemOperationSyncFrequency,omitempty"` - // How long to wait on asynchronous BackupItemActions and RestoreItemActions - // to complete before timing out. Default value is 1h. - // +optional - DefaultItemOperationTimeout string `json:"defaultItemOperationTimeout,omitempty"` - // Use pod volume file system backup by default for volumes - // +optional - DefaultVolumesToFSBackup *bool `json:"defaultVolumesToFSBackup,omitempty"` - // Specify whether CSI snapshot data should be moved to backup storage by default - // +optional - DefaultSnapshotMoveData *bool `json:"defaultSnapshotMoveData,omitempty"` - // Disable informer cache for Get calls on restore. With this enabled, it will speed up restore in cases where - // there are backup resources which already exist in the cluster, but for very large clusters this will increase - // velero memory usage. Default is false. - // +optional - DisableInformerCache *bool `json:"disableInformerCache,omitempty"` - // resourceTimeout defines how long to wait for several Velero resources before timeout occurs, - // such as Velero CRD availability, volumeSnapshot deletion, and repo availability. - // Default is 10m - // +optional - ResourceTimeout string `json:"resourceTimeout,omitempty"` -} - -// PodConfig defines the pod configuration options. -type PodConfig struct { - // labels to add to pods - // +optional - Labels map[string]string `json:"labels,omitempty"` - // nodeSelector defines the nodeSelector to be supplied to podSpec - // +optional - NodeSelector map[string]string `json:"nodeSelector,omitempty"` - // tolerations defines the list of tolerations to be applied to daemonset - // +optional - Tolerations []corev1.Toleration `json:"tolerations,omitempty"` - // resourceAllocations defines the CPU and Memory resource allocations for the Pod - // +optional - // +nullable - ResourceAllocations corev1.ResourceRequirements `json:"resourceAllocations,omitempty"` - // env defines the list of environment variables to be supplied to podSpec - // +optional - Env []corev1.EnvVar `json:"env,omitempty"` -} - -// NodeAgentCommonFields defines node agent fields. -type NodeAgentCommonFields struct { - // enable defines a boolean pointer whether we want the daemonset to - // exist or not - // +optional - Enable *bool `json:"enable,omitempty"` - // supplementalGroups defines the linux groups to be applied to the NodeAgent Pod - // +optional - SupplementalGroups []int64 `json:"supplementalGroups,omitempty"` - // timeout defines the NodeAgent timeout, default value is 1h - // +optional - Timeout string `json:"timeout,omitempty"` - // Pod specific configuration - PodConfig *PodConfig `json:"podConfig,omitempty"` -} - -// NodeAgentConfig is the configuration for node server. -type NodeAgentConfig struct { - // Embedding NodeAgentCommonFields - // +optional - NodeAgentCommonFields `json:",inline"` - - // The type of uploader to transfer the data of pod volumes, the supported values are 'restic' or 'kopia' - // +kubebuilder:validation:Enum=restic;kopia - // +kubebuilder:validation:Required - UploaderType string `json:"uploaderType"` -} - -// ResticConfig is the configuration for restic server. -type ResticConfig struct { - // Embedding NodeAgentCommonFields - // +optional - NodeAgentCommonFields `json:",inline"` -} - -// ApplicationConfig defines the configuration for the Data Protection Application. -type ApplicationConfig struct { - Velero *VeleroConfig `json:"velero,omitempty"` - // (deprecation warning) ResticConfig is the configuration for restic DaemonSet. - // restic is for backwards compatibility and is replaced by the nodeAgent - // restic will be removed with the OADP 1.4 - // +kubebuilder:deprecatedversion:warning=1.3 - // +optional - Restic *ResticConfig `json:"restic,omitempty"` - - // NodeAgent is needed to allow selection between kopia or restic - // +optional - NodeAgent *NodeAgentConfig `json:"nodeAgent,omitempty"` -} - -// CloudStorageLocation defines BackupStorageLocation using bucket referenced by CloudStorage CR. -type CloudStorageLocation struct { - CloudStorageRef corev1.LocalObjectReference `json:"cloudStorageRef"` - // config is for provider-specific configuration fields. - // +optional - Config map[string]string `json:"config,omitempty"` - - // credential contains the credential information intended to be used with this location - // +optional - Credential *corev1.SecretKeySelector `json:"credential,omitempty"` - - // default indicates this location is the default backup storage location. - // +optional - Default bool `json:"default,omitempty"` - - // backupSyncPeriod defines how frequently to sync backup API objects from object storage. A value of 0 disables sync. - // +optional - // +nullable - BackupSyncPeriod *metav1.Duration `json:"backupSyncPeriod,omitempty"` - - // Prefix and CACert are copied from velero/pkg/apis/v1/backupstoragelocation_types.go under ObjectStorageLocation - - // Prefix is the path inside a bucket to use for Velero storage. Optional. - // +optional - Prefix string `json:"prefix,omitempty"` - - // CACert defines a CA bundle to use when verifying TLS connections to the provider. - // +optional - CACert []byte `json:"caCert,omitempty"` -} - -// BackupLocation defines the configuration for the DPA backup storage. -type BackupLocation struct { - // +optional - Name string `json:"name,omitempty"` - // +optional - Velero *velero.BackupStorageLocationSpec `json:"velero,omitempty"` - // +optional - CloudStorage *CloudStorageLocation `json:"bucket,omitempty"` -} - -// SnapshotLocation defines the configuration for the DPA snapshot store. -type SnapshotLocation struct { - Velero *velero.VolumeSnapshotLocationSpec `json:"velero"` -} - -// NonAdmin sets nonadmin features. -type NonAdmin struct { - // Enables non admin feature, by default is disabled - // +optional - Enable *bool `json:"enable,omitempty"` -} - -// DataMover defines the various config for DPA data mover. -type DataMover struct { - // enable flag is used to specify whether you want to deploy the volume snapshot mover controller - // +optional - Enable bool `json:"enable,omitempty"` - // User supplied Restic Secret name - // +optional - CredentialName string `json:"credentialName,omitempty"` - // User supplied timeout to be used for VolumeSnapshotBackup and VolumeSnapshotRestore - // to complete, default value is 10m - // +optional - Timeout string `json:"timeout,omitempty"` - // the number of batched volumeSnapshotBackups that can be inProgress at once, default value is 10 - // +optional - MaxConcurrentBackupVolumes string `json:"maxConcurrentBackupVolumes,omitempty"` - // the number of batched volumeSnapshotRestores that can be inProgress at once, default value is 10 - // +optional - MaxConcurrentRestoreVolumes string `json:"maxConcurrentRestoreVolumes,omitempty"` - // defines how often (in days) to prune the datamover snapshots from the repository - // +optional - PruneInterval string `json:"pruneInterval,omitempty"` - // defines configurations for data mover volume options for a storageClass - // +optional - VolumeOptionsForStorageClasses map[string]DataMoverVolumeOptions `json:"volumeOptionsForStorageClasses,omitempty"` - // defines the parameters that can be specified for retention of datamover snapshots - // +optional - SnapshotRetainPolicy *RetainPolicy `json:"snapshotRetainPolicy,omitempty"` - // schedule is a cronspec (https://en.wikipedia.org/wiki/Cron#Overview) that - // can be used to schedule datamover(volsync) synchronization to occur at regular, time-based - // intervals. For example, in order to enforce datamover SnapshotRetainPolicy at a regular interval you need to - // specify this Schedule trigger as a cron expression, by default the trigger is a manual trigger. For more details - // on Volsync triggers, refer: https://volsync.readthedocs.io/en/stable/usage/triggers.html - //+kubebuilder:validation:Pattern=`^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$` - //+optional - Schedule string `json:"schedule,omitempty"` -} - -// RetainPolicy defines the fields for retention of datamover snapshots. -type RetainPolicy struct { - // Hourly defines the number of snapshots to be kept hourly - //+optional - Hourly string `json:"hourly,omitempty"` - // Daily defines the number of snapshots to be kept daily - //+optional - Daily string `json:"daily,omitempty"` - // Weekly defines the number of snapshots to be kept weekly - //+optional - Weekly string `json:"weekly,omitempty"` - // Monthly defines the number of snapshots to be kept monthly - //+optional - Monthly string `json:"monthly,omitempty"` - // Yearly defines the number of snapshots to be kept yearly - //+optional - Yearly string `json:"yearly,omitempty"` - // Within defines the number of snapshots to be kept Within the given time period - //+optional - Within string `json:"within,omitempty"` -} - -// DataMoverVolumeOptions define data volume options. -type DataMoverVolumeOptions struct { - SourceVolumeOptions *VolumeOptions `json:"sourceVolumeOptions,omitempty"` - DestinationVolumeOptions *VolumeOptions `json:"destinationVolumeOptions,omitempty"` -} - -// VolumeOptions defines configurations for VolSync options. -type VolumeOptions struct { - // storageClassName can be used to override the StorageClass of the source - // or destination PVC - //+optional - StorageClassName string `json:"storageClassName,omitempty"` - // accessMode can be used to override the accessMode of the source or - // destination PVC - //+optional - AccessMode corev1.PersistentVolumeAccessMode `json:"accessMode,omitempty"` - // cacheStorageClassName is the storageClass that should be used when provisioning - // the data mover cache volume - //+optional - CacheStorageClassName string `json:"cacheStorageClassName,omitempty"` - // cacheCapacity determines the size of the restic metadata cache volume - //+optional - CacheCapacity string `json:"cacheCapacity,omitempty"` - // cacheAccessMode is the access mode to be used to provision the cache volume - //+optional - CacheAccessMode string `json:"cacheAccessMode,omitempty"` -} - -// Features defines the configuration for the DPA to enable the tech preview features. -type Features struct { - // (do not use warning) dataMover is for backwards compatibility and - // will be removed in the future. Use Velero Built-in Data Mover instead - // +optional - DataMover *DataMover `json:"dataMover,omitempty"` -} - -// DataProtectionApplicationSpec defines the desired state of Velero. -type DataProtectionApplicationSpec struct { - // backupLocations defines the list of desired configuration to use for BackupStorageLocations - // +optional - BackupLocations []BackupLocation `json:"backupLocations"` - // snapshotLocations defines the list of desired configuration to use for VolumeSnapshotLocations - // +optional - SnapshotLocations []SnapshotLocation `json:"snapshotLocations"` - // unsupportedOverrides can be used to override images used in deployments. - // Available keys are: - // - veleroImageFqin - // - awsPluginImageFqin - // - openshiftPluginImageFqin - // - azurePluginImageFqin - // - gcpPluginImageFqin - // - csiPluginImageFqin - // - resticRestoreImageFqin - // - kubevirtPluginImageFqin - // - nonAdminControllerImageFqin - // - operator-type - // - tech-preview-ack - // +optional - UnsupportedOverrides map[UnsupportedImageKey]string `json:"unsupportedOverrides,omitempty"` - // add annotations to pods deployed by operator - // +optional - PodAnnotations map[string]string `json:"podAnnotations,omitempty"` - // podDnsPolicy defines how a pod's DNS will be configured. - // https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy - // +optional - PodDNSPolicy corev1.DNSPolicy `json:"podDnsPolicy,omitempty"` - // podDnsConfig defines the DNS parameters of a pod in addition to - // those generated from DNSPolicy. - // https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config - // +optional - PodDNSConfig corev1.PodDNSConfig `json:"podDnsConfig,omitempty"` - // backupImages is used to specify whether you want to deploy a registry for enabling backup and restore of images - // +optional - BackupImages *bool `json:"backupImages,omitempty"` - // configuration is used to configure the data protection application's server config - Configuration *ApplicationConfig `json:"configuration"` - // features defines the configuration for the DPA to enable the OADP tech preview features - // +optional - Features *Features `json:"features"` - // nonAdmin defines the configuration for the DPA to enable backup and restore operations for non-admin users - // +optional - NonAdmin *NonAdmin `json:"nonAdmin,omitempty"` -} - -// DataProtectionApplicationStatus defines the observed state of DataProtectionApplication. -type DataProtectionApplicationStatus struct { - Conditions []metav1.Condition `json:"conditions,omitempty"` -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:resource:path=dataprotectionapplications,shortName=dpa - -// DataProtectionApplication is the Schema for the dpa API. -type DataProtectionApplication struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec DataProtectionApplicationSpec `json:"spec,omitempty"` - Status DataProtectionApplicationStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// DataProtectionApplicationList contains a list of Velero. -type DataProtectionApplicationList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []DataProtectionApplication `json:"items"` -} - -// BackupImages behavior when nil to true. -// -//nolint:stylecheck -func (dpa *DataProtectionApplication) BackupImages() bool { - return dpa.Spec.BackupImages == nil || *dpa.Spec.BackupImages -} - -// GetDisableInformerCache defaults DisableInformerCache behavior when nil to false. -func (dpa *DataProtectionApplication) GetDisableInformerCache() bool { - if dpa.Spec.Configuration.Velero.DisableInformerCache == nil { - return false - } - - return *dpa.Spec.Configuration.Velero.DisableInformerCache -} - -// HasFeatureFlag returns current state of velero featureFlag. -func (veleroConfig *VeleroConfig) HasFeatureFlag(flag string) bool { - for _, featureFlag := range veleroConfig.FeatureFlags { - if featureFlag == flag { - return true - } - } - - return false -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataProtectionApplication) DeepCopyInto(out *DataProtectionApplication) { - *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 DataProtectionApplication. -func (in *DataProtectionApplication) DeepCopy() *DataProtectionApplication { - if in == nil { - return nil - } - - out := new(DataProtectionApplication) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -// -//nolint:ireturn -func (in *DataProtectionApplication) 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 *DataProtectionApplicationSpec) DeepCopyInto(out *DataProtectionApplicationSpec) { - *out = *in - if in.BackupLocations != nil { - in, out := &in.BackupLocations, &out.BackupLocations - *out = make([]BackupLocation, len(*in)) - - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - - if in.SnapshotLocations != nil { - in, out := &in.SnapshotLocations, &out.SnapshotLocations - *out = make([]SnapshotLocation, len(*in)) - - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - - if in.UnsupportedOverrides != nil { - in, out := &in.UnsupportedOverrides, &out.UnsupportedOverrides - *out = make(map[UnsupportedImageKey]string, len(*in)) - - for key, val := range *in { - (*out)[key] = val - } - } - - if in.PodAnnotations != nil { - in, out := &in.PodAnnotations, &out.PodAnnotations - *out = make(map[string]string, len(*in)) - - for key, val := range *in { - (*out)[key] = val - } - } - - in.PodDNSConfig.DeepCopyInto(&out.PodDNSConfig) - - if in.BackupImages != nil { - in, out := &in.BackupImages, &out.BackupImages - *out = new(bool) - **out = **in - } - - if in.Configuration != nil { - in, out := &in.Configuration, &out.Configuration - *out = new(ApplicationConfig) - (*in).DeepCopyInto(*out) - } - - if in.Features != nil { - in, out := &in.Features, &out.Features - *out = new(Features) - (*in).DeepCopyInto(*out) - } - - if in.NonAdmin != nil { - in, out := &in.NonAdmin, &out.NonAdmin - *out = new(NonAdmin) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataProtectionApplicationSpec. -func (in *DataProtectionApplicationSpec) DeepCopy() *DataProtectionApplicationSpec { - if in == nil { - return nil - } - - out := new(DataProtectionApplicationSpec) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataProtectionApplicationStatus) DeepCopyInto(out *DataProtectionApplicationStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]metav1.Condition, len(*in)) - - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataProtectionApplicationStatus. -func (in *DataProtectionApplicationStatus) DeepCopy() *DataProtectionApplicationStatus { - if in == nil { - return nil - } - - out := new(DataProtectionApplicationStatus) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackupLocation) DeepCopyInto(out *BackupLocation) { - *out = *in - if in.Velero != nil { - in, out := &in.Velero, &out.Velero - *out = new(velero.BackupStorageLocationSpec) - (*in).DeepCopyInto(*out) - } - - if in.CloudStorage != nil { - in, out := &in.CloudStorage, &out.CloudStorage - *out = new(CloudStorageLocation) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupLocation. -func (in *BackupLocation) DeepCopy() *BackupLocation { - if in == nil { - return nil - } - - out := new(BackupLocation) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SnapshotLocation) DeepCopyInto(out *SnapshotLocation) { - *out = *in - if in.Velero != nil { - in, out := &in.Velero, &out.Velero - *out = new(velero.VolumeSnapshotLocationSpec) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotLocation. -func (in *SnapshotLocation) DeepCopy() *SnapshotLocation { - if in == nil { - return nil - } - - out := new(SnapshotLocation) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ApplicationConfig) DeepCopyInto(out *ApplicationConfig) { - *out = *in - if in.Velero != nil { - in, out := &in.Velero, &out.Velero - *out = new(VeleroConfig) - (*in).DeepCopyInto(*out) - } - - if in.Restic != nil { - in, out := &in.Restic, &out.Restic - *out = new(ResticConfig) - (*in).DeepCopyInto(*out) - } - - if in.NodeAgent != nil { - in, out := &in.NodeAgent, &out.NodeAgent - *out = new(NodeAgentConfig) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationConfig. -func (in *ApplicationConfig) DeepCopy() *ApplicationConfig { - if in == nil { - return nil - } - - out := new(ApplicationConfig) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Features) DeepCopyInto(out *Features) { - *out = *in - if in.DataMover != nil { - in, out := &in.DataMover, &out.DataMover - *out = new(DataMover) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Features. -func (in *Features) DeepCopy() *Features { - if in == nil { - return nil - } - - out := new(Features) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NonAdmin) DeepCopyInto(out *NonAdmin) { - *out = *in - if in.Enable != nil { - in, out := &in.Enable, &out.Enable - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NonAdmin. -func (in *NonAdmin) DeepCopy() *NonAdmin { - if in == nil { - return nil - } - - out := new(NonAdmin) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CloudStorageLocation) DeepCopyInto(out *CloudStorageLocation) { - *out = *in - out.CloudStorageRef = in.CloudStorageRef - - if in.Config != nil { - in, out := &in.Config, &out.Config - *out = make(map[string]string, len(*in)) - - for key, val := range *in { - (*out)[key] = val - } - } - - if in.Credential != nil { - in, out := &in.Credential, &out.Credential - *out = new(corev1.SecretKeySelector) - (*in).DeepCopyInto(*out) - } - - if in.BackupSyncPeriod != nil { - in, out := &in.BackupSyncPeriod, &out.BackupSyncPeriod - *out = new(metav1.Duration) - **out = **in - } - - if in.CACert != nil { - in, out := &in.CACert, &out.CACert - *out = make([]byte, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudStorageLocation. -func (in *CloudStorageLocation) DeepCopy() *CloudStorageLocation { - if in == nil { - return nil - } - - out := new(CloudStorageLocation) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VeleroConfig) DeepCopyInto(out *VeleroConfig) { - *out = *in - if in.FeatureFlags != nil { - in, out := &in.FeatureFlags, &out.FeatureFlags - *out = make([]string, len(*in)) - copy(*out, *in) - } - - if in.DefaultPlugins != nil { - in, out := &in.DefaultPlugins, &out.DefaultPlugins - *out = make([]DefaultPlugin, len(*in)) - copy(*out, *in) - } - - if in.CustomPlugins != nil { - in, out := &in.CustomPlugins, &out.CustomPlugins - *out = make([]CustomPlugin, len(*in)) - copy(*out, *in) - } - - if in.PodConfig != nil { - in, out := &in.PodConfig, &out.PodConfig - *out = new(PodConfig) - (*in).DeepCopyInto(*out) - } - - if in.DefaultVolumesToFSBackup != nil { - in, out := &in.DefaultVolumesToFSBackup, &out.DefaultVolumesToFSBackup - *out = new(bool) - **out = **in - } - - if in.DefaultSnapshotMoveData != nil { - in, out := &in.DefaultSnapshotMoveData, &out.DefaultSnapshotMoveData - *out = new(bool) - **out = **in - } - - if in.DisableInformerCache != nil { - in, out := &in.DisableInformerCache, &out.DisableInformerCache - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VeleroConfig. -// -//nolint:stylecheck -func (in *VeleroConfig) DeepCopy() *VeleroConfig { - if in == nil { - return nil - } - - out := new(VeleroConfig) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResticConfig) DeepCopyInto(out *ResticConfig) { - *out = *in - in.NodeAgentCommonFields.DeepCopyInto(&out.NodeAgentCommonFields) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResticConfig. -func (in *ResticConfig) DeepCopy() *ResticConfig { - if in == nil { - return nil - } - - out := new(ResticConfig) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeAgentConfig) DeepCopyInto(out *NodeAgentConfig) { - *out = *in - in.NodeAgentCommonFields.DeepCopyInto(&out.NodeAgentCommonFields) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAgentConfig. -func (in *NodeAgentConfig) DeepCopy() *NodeAgentConfig { - if in == nil { - return nil - } - - out := new(NodeAgentConfig) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataMover) DeepCopyInto(out *DataMover) { - *out = *in - if in.VolumeOptionsForStorageClasses != nil { - in, out := &in.VolumeOptionsForStorageClasses, &out.VolumeOptionsForStorageClasses - *out = make(map[string]DataMoverVolumeOptions, len(*in)) - - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - - if in.SnapshotRetainPolicy != nil { - in, out := &in.SnapshotRetainPolicy, &out.SnapshotRetainPolicy - *out = new(RetainPolicy) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataMover. -func (in *DataMover) DeepCopy() *DataMover { - if in == nil { - return nil - } - - out := new(DataMover) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataMoverVolumeOptions) DeepCopyInto(out *DataMoverVolumeOptions) { - *out = *in - if in.SourceVolumeOptions != nil { - in, out := &in.SourceVolumeOptions, &out.SourceVolumeOptions - *out = new(VolumeOptions) - **out = **in - } - - if in.DestinationVolumeOptions != nil { - in, out := &in.DestinationVolumeOptions, &out.DestinationVolumeOptions - *out = new(VolumeOptions) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataMoverVolumeOptions. -func (in *DataMoverVolumeOptions) DeepCopy() *DataMoverVolumeOptions { - if in == nil { - return nil - } - - out := new(DataMoverVolumeOptions) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodConfig) DeepCopyInto(out *PodConfig) { - *out = *in - if in.Labels != nil { - in, out := &in.Labels, &out.Labels - *out = make(map[string]string, len(*in)) - - for key, val := range *in { - (*out)[key] = val - } - } - - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = make(map[string]string, len(*in)) - - for key, val := range *in { - (*out)[key] = val - } - } - - if in.Tolerations != nil { - in, out := &in.Tolerations, &out.Tolerations - *out = make([]corev1.Toleration, len(*in)) - - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - - in.ResourceAllocations.DeepCopyInto(&out.ResourceAllocations) - - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]corev1.EnvVar, len(*in)) - - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodConfig. -func (in *PodConfig) DeepCopy() *PodConfig { - if in == nil { - return nil - } - - out := new(PodConfig) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeAgentCommonFields) DeepCopyInto(out *NodeAgentCommonFields) { - *out = *in - if in.Enable != nil { - in, out := &in.Enable, &out.Enable - *out = new(bool) - **out = **in - } - - if in.SupplementalGroups != nil { - in, out := &in.SupplementalGroups, &out.SupplementalGroups - *out = make([]int64, len(*in)) - copy(*out, *in) - } - - if in.PodConfig != nil { - in, out := &in.PodConfig, &out.PodConfig - *out = new(PodConfig) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAgentCommonFields. -func (in *NodeAgentCommonFields) DeepCopy() *NodeAgentCommonFields { - if in == nil { - return nil - } - - out := new(NodeAgentCommonFields) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataProtectionApplicationList) DeepCopyInto(out *DataProtectionApplicationList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]DataProtectionApplication, len(*in)) - - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataProtectionApplicationList. -func (in *DataProtectionApplicationList) DeepCopy() *DataProtectionApplicationList { - if in == nil { - return nil - } - - out := new(DataProtectionApplicationList) - in.DeepCopyInto(out) - - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -// -//nolint:ireturn -func (in *DataProtectionApplicationList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - - return nil -} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/ocm/kac.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/ocm/kac.go index ea08e2f0c..9d555b457 100644 --- a/vendor/github.com/openshift-kni/eco-goinfra/pkg/ocm/kac.go +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/ocm/kac.go @@ -180,6 +180,8 @@ func (builder *KACBuilder) Update(force bool) (*KACBuilder, error) { glog.V(100).Infof(msg.FailToUpdateNotification("klusterletAddonConfig", builder.Definition.Name)) err := builder.Delete() + builder.Definition.ResourceVersion = "" + if err != nil { glog.V(100).Infof(msg.FailToUpdateError("klusterletAddonConfig", builder.Definition.Name)) diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/olm/catalogsource.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/olm/catalogsource.go index d53610e76..bd9015e24 100644 --- a/vendor/github.com/openshift-kni/eco-goinfra/pkg/olm/catalogsource.go +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/olm/catalogsource.go @@ -4,10 +4,12 @@ import ( "context" "fmt" + oplmV1alpha1 "github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1" + runtimeClient "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/golang/glog" "github.com/openshift-kni/eco-goinfra/pkg/clients" "github.com/openshift-kni/eco-goinfra/pkg/msg" - oplmV1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -21,7 +23,7 @@ type CatalogSourceBuilder struct { // Created CatalogSource object on the cluster. Object *oplmV1alpha1.CatalogSource // api client to interact with the cluster. - apiClient *clients.Settings + apiClient runtimeClient.Client // errorMsg is processed before CatalogSourceBuilder object is created. errorMsg string } @@ -30,8 +32,21 @@ type CatalogSourceBuilder struct { func NewCatalogSourceBuilder(apiClient *clients.Settings, name, nsname string) *CatalogSourceBuilder { glog.V(100).Infof("Initializing new %s catalogsource structure", name) + if apiClient == nil { + glog.V(100).Infof("The apiClient cannot be nil") + + return nil + } + + err := apiClient.AttachScheme(oplmV1alpha1.AddToScheme) + if err != nil { + glog.V(100).Infof("Failed to add oplmV1alpha1 scheme to client schemes") + + return nil + } + builder := CatalogSourceBuilder{ - apiClient: apiClient, + apiClient: apiClient.Client, Definition: &oplmV1alpha1.CatalogSource{ ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -60,8 +75,21 @@ func PullCatalogSource(apiClient *clients.Settings, name, nsname string) (*Catal error) { glog.V(100).Infof("Pulling existing catalogsource name %s in namespace %s", name, nsname) + if apiClient == nil { + glog.V(100).Infof("The apiClient cannot be nil") + + return nil, fmt.Errorf("catalogsource 'apiClient' cannot be empty") + } + + err := apiClient.AttachScheme(oplmV1alpha1.AddToScheme) + if err != nil { + glog.V(100).Infof("Failed to add oplmV1alpha1 scheme to client schemes") + + return nil, err + } + builder := CatalogSourceBuilder{ - apiClient: apiClient, + apiClient: apiClient.Client, Definition: &oplmV1alpha1.CatalogSource{ ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -71,11 +99,15 @@ func PullCatalogSource(apiClient *clients.Settings, name, nsname string) (*Catal } if name == "" { - builder.errorMsg = "catalogsource 'name' cannot be empty" + glog.V(100).Infof("The name of the catalogsource is empty") + + return nil, fmt.Errorf("catalogsource 'name' cannot be empty") } if nsname == "" { - builder.errorMsg = "catalogsource 'namespace' cannot be empty" + glog.V(100).Infof("The namespace of the catalogsource is empty") + + return nil, fmt.Errorf("catalogsource 'namespace' cannot be empty") } if !builder.Exists() { @@ -98,8 +130,78 @@ func (builder *CatalogSourceBuilder) Create() (*CatalogSourceBuilder, error) { var err error if !builder.Exists() { - builder.Object, err = builder.apiClient.CatalogSources(builder.Definition.Namespace).Create(context.TODO(), - builder.Definition, metav1.CreateOptions{}) + err = builder.apiClient.Create(context.TODO(), builder.Definition) + + if err != nil { + glog.V(100).Infof("Failed to create CatalogSource") + + return nil, err + } + } + + builder.Object = builder.Definition + + return builder, err +} + +// Get returns CatalogSource object if found. +func (builder *CatalogSourceBuilder) Get() (*oplmV1alpha1.CatalogSource, error) { + if valid, err := builder.validate(); !valid { + return nil, err + } + + glog.V(100).Infof( + "Collecting CatalogSource object %s in namespace %s", + builder.Definition.Name, builder.Definition.Namespace) + + catalogSource := &oplmV1alpha1.CatalogSource{} + err := builder.apiClient.Get(context.TODO(), + runtimeClient.ObjectKey{Name: builder.Definition.Name, Namespace: builder.Definition.Namespace}, + catalogSource) + + if err != nil { + glog.V(100).Infof( + "CatalogSource object %s does not exist in namespace %s", + builder.Definition.Name, builder.Definition.Namespace) + + return nil, err + } + + return catalogSource, nil +} + +// Update renovates the existing CatalogSource object with the CatalogSource definition in builder. +func (builder *CatalogSourceBuilder) Update(force bool) (*CatalogSourceBuilder, error) { + if valid, err := builder.validate(); !valid { + return builder, err + } + + glog.V(100).Infof("Updating the CatalogSource object %s in namespace %s", + builder.Definition.Name, builder.Definition.Namespace, + ) + + if !builder.Exists() { + return nil, fmt.Errorf("failed to update CatalogSource, object does not exist on cluster") + } + + err := builder.apiClient.Update(context.TODO(), builder.Definition) + + if err != nil { + if force { + glog.V(100).Infof( + msg.FailToUpdateNotification("CatalogSource", builder.Definition.Name, builder.Definition.Namespace)) + + err := builder.Delete() + + if err != nil { + glog.V(100).Infof( + msg.FailToUpdateError("CatalogSource", builder.Definition.Name, builder.Definition.Namespace)) + + return nil, err + } + + return builder.Create() + } } return builder, err @@ -116,9 +218,7 @@ func (builder *CatalogSourceBuilder) Exists() bool { builder.Definition.Name) var err error - builder.Object, err = builder.apiClient.OperatorsV1alpha1Interface.CatalogSources( - builder.Definition.Namespace).Get( - context.TODO(), builder.Definition.Name, metav1.GetOptions{}) + builder.Object, err = builder.Get() return err == nil || !k8serrors.IsNotFound(err) } @@ -133,11 +233,12 @@ func (builder *CatalogSourceBuilder) Delete() error { builder.Definition.Namespace) if !builder.Exists() { + glog.V(100).Infof("catalogsource cannot be deleted because it does not exist") + return nil } - err := builder.apiClient.CatalogSources(builder.Definition.Namespace).Delete(context.TODO(), - builder.Object.Name, metav1.DeleteOptions{}) + err := builder.apiClient.Delete(context.TODO(), builder.Definition) if err != nil { return err diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/olm/catalogsourcelist.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/olm/catalogsourcelist.go index db542eea4..ce570092e 100644 --- a/vendor/github.com/openshift-kni/eco-goinfra/pkg/olm/catalogsourcelist.go +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/olm/catalogsourcelist.go @@ -4,23 +4,39 @@ import ( "context" "fmt" + "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/golang/glog" "github.com/openshift-kni/eco-goinfra/pkg/clients" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + oplmV1alpha1 "github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1" ) // ListCatalogSources returns catalogsource inventory in the given namespace. func ListCatalogSources( apiClient *clients.Settings, nsname string, - options ...metav1.ListOptions) ([]*CatalogSourceBuilder, error) { + options ...client.ListOptions) ([]*CatalogSourceBuilder, error) { + if apiClient == nil { + glog.V(100).Infof("The apiClient cannot be nil") + + return nil, fmt.Errorf("failed to list catalogSource, 'apiClient' parameter is empty") + } + + err := apiClient.AttachScheme(oplmV1alpha1.AddToScheme) + + if err != nil { + glog.V(100).Infof("Failed to add oplmV1alpha1 scheme to client schemes") + + return nil, err + } + if nsname == "" { - glog.V(100).Infof("catalogsource 'namespace' parameter can not be empty") + glog.V(100).Infof("catalogsource 'nsname' parameter can not be empty") - return nil, fmt.Errorf("failed to list catalogsource, 'namespace' parameter is empty") + return nil, fmt.Errorf("failed to list catalogsource, 'nsname' parameter is empty") } - passedOptions := metav1.ListOptions{} + passedOptions := client.ListOptions{} logMessage := fmt.Sprintf("Listing catalogsource in the namespace %s", nsname) if len(options) > 1 { @@ -36,8 +52,10 @@ func ListCatalogSources( glog.V(100).Infof(logMessage) - catalogSourceList, err := apiClient.OperatorsV1alpha1Interface.CatalogSources(nsname).List( - context.TODO(), passedOptions) + passedOptions.Namespace = nsname + + catalogSourceList := new(oplmV1alpha1.CatalogSourceList) + err = apiClient.List(context.TODO(), catalogSourceList, &passedOptions) if err != nil { glog.V(100).Infof("Failed to list catalogsources in the namespace %s due to %s", nsname, err.Error()) @@ -50,7 +68,7 @@ func ListCatalogSources( for _, existingCatalogSource := range catalogSourceList.Items { copiedCatalogSource := existingCatalogSource catalogSourceBuilder := &CatalogSourceBuilder{ - apiClient: apiClient, + apiClient: apiClient.Client, Object: &copiedCatalogSource, Definition: &copiedCatalogSource, } diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/assisted/pkg/validations/validations.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/assisted/pkg/validations/validations.go index bc58285a0..20b5811a2 100644 --- a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/assisted/pkg/validations/validations.go +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/assisted/pkg/validations/validations.go @@ -138,20 +138,6 @@ func ValidateHTTPProxyFormat(proxyURL string) error { if u.Scheme != "http" { return errors.Errorf("The URL scheme must be http and specified in the URL: '%s'", proxyURL) } - - userName := u.User.Username() - encodedUserName := url.QueryEscape(userName) - if userName != encodedUserName { - return errors.Errorf("The URL '%s' user name '%s' has to be encoded: '%s'", proxyURL, userName, encodedUserName) - } - - password, hasPassword := u.User.Password() - if hasPassword { - encodedPassword := url.QueryEscape(password) - if password != encodedPassword { - return errors.Errorf("The URL '%s' password '%s' has to be encoded: '%s'", proxyURL, password, encodedPassword) - } - } return nil } diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/cloud_storage_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/cloud_storage_types.go new file mode 100644 index 000000000..295be54ff --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/cloud_storage_types.go @@ -0,0 +1,65 @@ +package v1alpha1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CloudStorage types are APIs for automatic bucket creation at cloud providers if defined name do not exists. + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status + +type CloudStorage struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec CloudStorageSpec `json:"spec,omitempty"` + Status CloudStorageStatus `json:"status,omitempty"` +} + +type CloudStorageProvider string + +const ( + AWSBucketProvider CloudStorageProvider = CloudStorageProvider(DefaultPluginAWS) + AzureBucketProvider CloudStorageProvider = CloudStorageProvider(DefaultPluginMicrosoftAzure) + GCPBucketProvider CloudStorageProvider = CloudStorageProvider(DefaultPluginGCP) +) + +type CloudStorageSpec struct { + // name is the name requested for the bucket (aws, gcp) or container (azure) + Name string `json:"name"` + // creationSecret is the secret that is needed to be used while creating the bucket. + CreationSecret corev1.SecretKeySelector `json:"creationSecret"` + // enableSharedConfig enable the use of shared config loading for AWS Buckets + EnableSharedConfig *bool `json:"enableSharedConfig,omitempty"` + // tags for the bucket + // +kubebuilder:validation:Optional + Tags map[string]string `json:"tags,omitempty"` + // region for the bucket to be in, will be us-east-1 if not set. + Region string `json:"region,omitempty"` + // provider is the provider of the cloud storage + // +kubebuilder:validation:Enum=aws + Provider CloudStorageProvider `json:"provider"` + + // https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob@v0.2.0#section-readme + // azure blob primary endpoint + // az storage account show -g -n + // need storage account name and key to create azure container + // az storage container create -n --account-name --account-key + // azure account key will use CreationSecret to store key and account name + +} + +type CloudStorageStatus struct { + Name string `json:"name"` + LastSynced *metav1.Time `json:"lastSyncTimestamp,omitempty"` +} + +//+kubebuilder:object:root=true + +type CloudStorageList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []CloudStorage `json:"items"` +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/groupversion_info.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/groupversion_info.go new file mode 100644 index 000000000..636f70642 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/groupversion_info.go @@ -0,0 +1,38 @@ +/* +Copyright 2021. + +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 oadp v1alpha1 API group +// +kubebuilder:object:generate=true +// +groupName=oadp.openshift.io +package v1alpha1 + +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: "oadp.openshift.io", Version: "v1alpha1"} + + Kind = "DataProtectionApplication" + + // 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/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/oadp_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/oadp_types.go new file mode 100644 index 000000000..b63e0181f --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/oadp_types.go @@ -0,0 +1,443 @@ +/* +Copyright 2021. + +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 ( + "github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/pkg/common" + velero "github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Conditions +const ConditionReconciled = "Reconciled" +const ReconciledReasonComplete = "Complete" +const ReconciledReasonError = "Error" +const ReconcileCompleteMessage = "Reconcile complete" + +const OadpOperatorLabel = "openshift.io/oadp" +const RegistryDeploymentLabel = "openshift.io/oadp-registry" + +// +kubebuilder:validation:Enum=aws;gcp;azure;csi;vsm;openshift;kubevirt +type DefaultPlugin string + +const DefaultPluginAWS DefaultPlugin = "aws" +const DefaultPluginGCP DefaultPlugin = "gcp" +const DefaultPluginMicrosoftAzure DefaultPlugin = "azure" +const DefaultPluginCSI DefaultPlugin = "csi" +const DefaultPluginVSM DefaultPlugin = "vsm" +const DefaultPluginOpenShift DefaultPlugin = "openshift" +const DefaultPluginKubeVirt DefaultPlugin = "kubevirt" + +type CustomPlugin struct { + Name string `json:"name"` + Image string `json:"image"` +} + +// Field does not have enum validation for development flexibility +type UnsupportedImageKey string + +const VeleroImageKey UnsupportedImageKey = "veleroImageFqin" +const AWSPluginImageKey UnsupportedImageKey = "awsPluginImageFqin" +const OpenShiftPluginImageKey UnsupportedImageKey = "openshiftPluginImageFqin" +const AzurePluginImageKey UnsupportedImageKey = "azurePluginImageFqin" +const GCPPluginImageKey UnsupportedImageKey = "gcpPluginImageFqin" +const ResticRestoreImageKey UnsupportedImageKey = "resticRestoreImageFqin" +const KubeVirtPluginImageKey UnsupportedImageKey = "kubevirtPluginImageFqin" +const OperatorTypeKey UnsupportedImageKey = "operator-type" + +const OperatorTypeMTC = "mtc" + +type VeleroConfig struct { + // featureFlags defines the list of features to enable for Velero instance + // +optional + FeatureFlags []string `json:"featureFlags,omitempty"` + DefaultPlugins []DefaultPlugin `json:"defaultPlugins,omitempty"` + // customPlugins defines the custom plugin to be installed with Velero + // +optional + CustomPlugins []CustomPlugin `json:"customPlugins,omitempty"` + // restoreResourceVersionPriority represents a configmap that will be created if defined for use in conjunction with EnableAPIGroupVersions feature flag + // Defining this field automatically add EnableAPIGroupVersions to the velero server feature flag + // +optional + RestoreResourcesVersionPriority string `json:"restoreResourcesVersionPriority,omitempty"` + // If you need to install Velero without a default backup storage location noDefaultBackupLocation flag is required for confirmation + // +optional + NoDefaultBackupLocation bool `json:"noDefaultBackupLocation,omitempty"` + // Pod specific configuration + PodConfig *PodConfig `json:"podConfig,omitempty"` + // Velero server’s log level (use debug for the most logging, leave unset for velero default) + // +optional + // +kubebuilder:validation:Enum=trace;debug;info;warning;error;fatal;panic + LogLevel string `json:"logLevel,omitempty"` + // How often to check status on async backup/restore operations after backup processing. Default value is 2m. + // +optional + ItemOperationSyncFrequency string `json:"itemOperationSyncFrequency,omitempty"` + // How long to wait on asynchronous BackupItemActions and RestoreItemActions to complete before timing out. Default value is 1h. + // +optional + DefaultItemOperationTimeout string `json:"defaultItemOperationTimeout,omitempty"` + // Use pod volume file system backup by default for volumes + // +optional + DefaultVolumesToFSBackup *bool `json:"defaultVolumesToFSBackup,omitempty"` + // Specify whether CSI snapshot data should be moved to backup storage by default + // +optional + DefaultSnapshotMoveData *bool `json:"defaultSnapshotMoveData,omitempty"` + // Disable informer cache for Get calls on restore. With this enabled, it will speed up restore in cases where there are backup resources which already exist in the cluster, but for very large clusters this will increase velero memory usage. Default is false. + // +optional + DisableInformerCache *bool `json:"disableInformerCache,omitempty"` + // resourceTimeout defines how long to wait for several Velero resources before timeout occurs, + // such as Velero CRD availability, volumeSnapshot deletion, and repo availability. + // Default is 10m + // +optional + ResourceTimeout string `json:"resourceTimeout,omitempty"` +} + +// PodConfig defines the pod configuration options +type PodConfig struct { + // labels to add to pods + // +optional + Labels map[string]string `json:"labels,omitempty"` + // nodeSelector defines the nodeSelector to be supplied to podSpec + // +optional + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + // tolerations defines the list of tolerations to be applied to daemonset + // +optional + Tolerations []corev1.Toleration `json:"tolerations,omitempty"` + // resourceAllocations defines the CPU and Memory resource allocations for the Pod + // +optional + // +nullable + ResourceAllocations corev1.ResourceRequirements `json:"resourceAllocations,omitempty"` + // env defines the list of environment variables to be supplied to podSpec + // +optional + Env []corev1.EnvVar `json:"env,omitempty"` +} + +type NodeAgentCommonFields struct { + // enable defines a boolean pointer whether we want the daemonset to + // exist or not + // +optional + Enable *bool `json:"enable,omitempty"` + // supplementalGroups defines the linux groups to be applied to the NodeAgent Pod + // +optional + SupplementalGroups []int64 `json:"supplementalGroups,omitempty"` + // timeout defines the NodeAgent timeout, default value is 1h + // +optional + Timeout string `json:"timeout,omitempty"` + // Pod specific configuration + PodConfig *PodConfig `json:"podConfig,omitempty"` +} + +// NodeAgentConfig is the configuration for node server +type NodeAgentConfig struct { + // Embedding NodeAgentCommonFields + // +optional + NodeAgentCommonFields `json:",inline"` + + // The type of uploader to transfer the data of pod volumes, the supported values are 'restic' or 'kopia' + // +kubebuilder:validation:Enum=restic;kopia + // +kubebuilder:validation:Required + UploaderType string `json:"uploaderType"` +} + +// ResticConfig is the configuration for restic server +type ResticConfig struct { + // Embedding NodeAgentCommonFields + // +optional + NodeAgentCommonFields `json:",inline"` +} + +// ApplicationConfig defines the configuration for the Data Protection Application +type ApplicationConfig struct { + Velero *VeleroConfig `json:"velero,omitempty"` + // (deprecation warning) ResticConfig is the configuration for restic DaemonSet. + // restic is for backwards compatibility and is replaced by the nodeAgent + // restic will be removed in the future + // +kubebuilder:deprecatedversion:warning=1.3 + // +optional + Restic *ResticConfig `json:"restic,omitempty"` + + // NodeAgent is needed to allow selection between kopia or restic + // +optional + NodeAgent *NodeAgentConfig `json:"nodeAgent,omitempty"` +} + +// CloudStorageLocation defines BackupStorageLocation using bucket referenced by CloudStorage CR. +type CloudStorageLocation struct { + CloudStorageRef corev1.LocalObjectReference `json:"cloudStorageRef"` + + // config is for provider-specific configuration fields. + // +optional + Config map[string]string `json:"config,omitempty"` + + // credential contains the credential information intended to be used with this location + // +optional + Credential *corev1.SecretKeySelector `json:"credential,omitempty"` + + // default indicates this location is the default backup storage location. + // +optional + Default bool `json:"default,omitempty"` + + // backupSyncPeriod defines how frequently to sync backup API objects from object storage. A value of 0 disables sync. + // +optional + // +nullable + BackupSyncPeriod *metav1.Duration `json:"backupSyncPeriod,omitempty"` + + // Prefix and CACert are copied from velero/pkg/apis/v1/backupstoragelocation_types.go under ObjectStorageLocation + + // Prefix is the path inside a bucket to use for Velero storage. Optional. + // +optional + Prefix string `json:"prefix,omitempty"` + + // CACert defines a CA bundle to use when verifying TLS connections to the provider. + // +optional + CACert []byte `json:"caCert,omitempty"` +} + +// BackupLocation defines the configuration for the DPA backup storage +type BackupLocation struct { + // TODO: Add name/annotations/labels support + + // +optional + Name string `json:"name,omitempty"` + // +optional + Velero *velero.BackupStorageLocationSpec `json:"velero,omitempty"` + // +optional + CloudStorage *CloudStorageLocation `json:"bucket,omitempty"` +} + +// SnapshotLocation defines the configuration for the DPA snapshot store +type SnapshotLocation struct { + // TODO: Add name/annotations/labels support + + Velero *velero.VolumeSnapshotLocationSpec `json:"velero"` +} + +// DataMover defines the various config for DPA data mover +type DataMover struct { + // enable flag is used to specify whether you want to deploy the volume snapshot mover controller + // +optional + Enable bool `json:"enable,omitempty"` + // User supplied Restic Secret name + // +optional + CredentialName string `json:"credentialName,omitempty"` + // User supplied timeout to be used for VolumeSnapshotBackup and VolumeSnapshotRestore to complete, default value is 10m + // +optional + Timeout string `json:"timeout,omitempty"` + // the number of batched volumeSnapshotBackups that can be inProgress at once, default value is 10 + // +optional + MaxConcurrentBackupVolumes string `json:"maxConcurrentBackupVolumes,omitempty"` + // the number of batched volumeSnapshotRestores that can be inProgress at once, default value is 10 + // +optional + MaxConcurrentRestoreVolumes string `json:"maxConcurrentRestoreVolumes,omitempty"` + // defines how often (in days) to prune the datamover snapshots from the repository + // +optional + PruneInterval string `json:"pruneInterval,omitempty"` + // defines configurations for data mover volume options for a storageClass + // +optional + VolumeOptionsForStorageClasses map[string]DataMoverVolumeOptions `json:"volumeOptionsForStorageClasses,omitempty"` + // defines the parameters that can be specified for retention of datamover snapshots + // +optional + SnapshotRetainPolicy *RetainPolicy `json:"snapshotRetainPolicy,omitempty"` + // schedule is a cronspec (https://en.wikipedia.org/wiki/Cron#Overview) that + // can be used to schedule datamover(volsync) synchronization to occur at regular, time-based + // intervals. For example, in order to enforce datamover SnapshotRetainPolicy at a regular interval you need to + // specify this Schedule trigger as a cron expression, by default the trigger is a manual trigger. For more details + // on Volsync triggers, refer: https://volsync.readthedocs.io/en/stable/usage/triggers.html + //+kubebuilder:validation:Pattern=`^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$` + //+optional + Schedule string `json:"schedule,omitempty"` +} + +// RetainPolicy defines the fields for retention of datamover snapshots +type RetainPolicy struct { + // Hourly defines the number of snapshots to be kept hourly + //+optional + Hourly string `json:"hourly,omitempty"` + // Daily defines the number of snapshots to be kept daily + //+optional + Daily string `json:"daily,omitempty"` + // Weekly defines the number of snapshots to be kept weekly + //+optional + Weekly string `json:"weekly,omitempty"` + // Monthly defines the number of snapshots to be kept monthly + //+optional + Monthly string `json:"monthly,omitempty"` + // Yearly defines the number of snapshots to be kept yearly + //+optional + Yearly string `json:"yearly,omitempty"` + // Within defines the number of snapshots to be kept Within the given time period + //+optional + Within string `json:"within,omitempty"` +} + +type DataMoverVolumeOptions struct { + SourceVolumeOptions *VolumeOptions `json:"sourceVolumeOptions,omitempty"` + DestinationVolumeOptions *VolumeOptions `json:"destinationVolumeOptions,omitempty"` +} + +// VolumeOptions defines configurations for VolSync options +type VolumeOptions struct { + // storageClassName can be used to override the StorageClass of the source + // or destination PVC + //+optional + StorageClassName string `json:"storageClassName,omitempty"` + // accessMode can be used to override the accessMode of the source or + // destination PVC + //+optional + AccessMode corev1.PersistentVolumeAccessMode `json:"accessMode,omitempty"` + // cacheStorageClassName is the storageClass that should be used when provisioning + // the data mover cache volume + //+optional + CacheStorageClassName string `json:"cacheStorageClassName,omitempty"` + // cacheCapacity determines the size of the restic metadata cache volume + //+optional + CacheCapacity string `json:"cacheCapacity,omitempty"` + // cacheAccessMode is the access mode to be used to provision the cache volume + //+optional + CacheAccessMode string `json:"cacheAccessMode,omitempty"` +} + +// Features defines the configuration for the DPA to enable the tech preview features +type Features struct { + // (do not use warning) Contains data mover specific configurations + // dataMover is for backwards compatibility and is not necessary in OADP 1.3 + // dataMover will be removed with the OADP 1.4 + // +optional + DataMover *DataMover `json:"dataMover,omitempty"` +} + +// DataProtectionApplicationSpec defines the desired state of Velero +type DataProtectionApplicationSpec struct { + // backupLocations defines the list of desired configuration to use for BackupStorageLocations + // +optional + BackupLocations []BackupLocation `json:"backupLocations"` + // snapshotLocations defines the list of desired configuration to use for VolumeSnapshotLocations + // +optional + SnapshotLocations []SnapshotLocation `json:"snapshotLocations"` + // unsupportedOverrides can be used to override images used in deployments. + // Available keys are: + // - veleroImageFqin + // - awsPluginImageFqin + // - openshiftPluginImageFqin + // - azurePluginImageFqin + // - gcpPluginImageFqin + // - resticRestoreImageFqin + // - kubevirtPluginImageFqin + // - operator-type + // +optional + UnsupportedOverrides map[UnsupportedImageKey]string `json:"unsupportedOverrides,omitempty"` + // add annotations to pods deployed by operator + // +optional + PodAnnotations map[string]string `json:"podAnnotations,omitempty"` + // podDnsPolicy defines how a pod's DNS will be configured. + // https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy + // +optional + PodDnsPolicy corev1.DNSPolicy `json:"podDnsPolicy,omitempty"` + // podDnsConfig defines the DNS parameters of a pod in addition to + // those generated from DNSPolicy. + // https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config + // +optional + PodDnsConfig corev1.PodDNSConfig `json:"podDnsConfig,omitempty"` + // backupImages is used to specify whether you want to deploy a registry for enabling backup and restore of images + // +optional + BackupImages *bool `json:"backupImages,omitempty"` + // configuration is used to configure the data protection application's server config + Configuration *ApplicationConfig `json:"configuration"` + // features defines the configuration for the DPA to enable the OADP tech preview features + // +optional + Features *Features `json:"features"` +} + +// DataProtectionApplicationStatus defines the observed state of DataProtectionApplication +type DataProtectionApplicationStatus struct { + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +//+kubebuilder:resource:path=dataprotectionapplications,shortName=dpa + +// DataProtectionApplication is the Schema for the dpa API +type DataProtectionApplication struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DataProtectionApplicationSpec `json:"spec,omitempty"` + Status DataProtectionApplicationStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// DataProtectionApplicationList contains a list of Velero +type DataProtectionApplicationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DataProtectionApplication `json:"items"` +} + +// Default BackupImages behavior when nil to true +func (dpa *DataProtectionApplication) BackupImages() bool { + return dpa.Spec.BackupImages == nil || *dpa.Spec.BackupImages +} + +// Default DisableInformerCache behavior when nil to false +func (dpa *DataProtectionApplication) GetDisableInformerCache() bool { + if dpa.Spec.Configuration.Velero.DisableInformerCache == nil { + return false + } + return *dpa.Spec.Configuration.Velero.DisableInformerCache +} + +func (veleroConfig *VeleroConfig) HasFeatureFlag(flag string) bool { + for _, featureFlag := range veleroConfig.FeatureFlags { + if featureFlag == flag { + return true + } + } + return false +} + +func init() { + SchemeBuilder.Register(&DataProtectionApplication{}, &DataProtectionApplicationList{}, &CloudStorage{}, &CloudStorageList{}) +} + +// AutoCorrect is a collection of auto-correction functions for the DPA CR +// These auto corrects are in-memory only and do not persist to the CR +// There should not be another place where these auto-corrects are done +func (dpa *DataProtectionApplication) AutoCorrect() { + //check if CSI plugin is added in spec + if hasCSIPlugin(dpa.Spec.Configuration.Velero.DefaultPlugins) { + dpa.Spec.Configuration.Velero.FeatureFlags = append(dpa.Spec.Configuration.Velero.FeatureFlags, velero.CSIFeatureFlag) + } + if dpa.Spec.Configuration.Velero.RestoreResourcesVersionPriority != "" { + // if the RestoreResourcesVersionPriority is specified then ensure feature flag is enabled for enableApiGroupVersions + // duplicate feature flag checks are done in ReconcileVeleroDeployment + dpa.Spec.Configuration.Velero.FeatureFlags = append(dpa.Spec.Configuration.Velero.FeatureFlags, velero.APIGroupVersionsFeatureFlag) + } + + dpa.Spec.Configuration.Velero.DefaultPlugins = common.RemoveDuplicateValues(dpa.Spec.Configuration.Velero.DefaultPlugins) + dpa.Spec.Configuration.Velero.FeatureFlags = common.RemoveDuplicateValues(dpa.Spec.Configuration.Velero.FeatureFlags) +} + +func hasCSIPlugin(plugins []DefaultPlugin) bool { + for _, plugin := range plugins { + if plugin == DefaultPluginCSI { + // CSI plugin is added so ensure that CSI feature flags is set + return true + } + } + return false +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..89dee71f6 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,660 @@ +//go:build !ignore_autogenerated + +/* +Copyright 2021. + +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 v1alpha1 + +import ( + velerov1 "github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/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 *ApplicationConfig) DeepCopyInto(out *ApplicationConfig) { + *out = *in + if in.Velero != nil { + in, out := &in.Velero, &out.Velero + *out = new(VeleroConfig) + (*in).DeepCopyInto(*out) + } + if in.Restic != nil { + in, out := &in.Restic, &out.Restic + *out = new(ResticConfig) + (*in).DeepCopyInto(*out) + } + if in.NodeAgent != nil { + in, out := &in.NodeAgent, &out.NodeAgent + *out = new(NodeAgentConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationConfig. +func (in *ApplicationConfig) DeepCopy() *ApplicationConfig { + if in == nil { + return nil + } + out := new(ApplicationConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupLocation) DeepCopyInto(out *BackupLocation) { + *out = *in + if in.Velero != nil { + in, out := &in.Velero, &out.Velero + *out = new(velerov1.BackupStorageLocationSpec) + (*in).DeepCopyInto(*out) + } + if in.CloudStorage != nil { + in, out := &in.CloudStorage, &out.CloudStorage + *out = new(CloudStorageLocation) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupLocation. +func (in *BackupLocation) DeepCopy() *BackupLocation { + if in == nil { + return nil + } + out := new(BackupLocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CloudStorage) DeepCopyInto(out *CloudStorage) { + *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 CloudStorage. +func (in *CloudStorage) DeepCopy() *CloudStorage { + if in == nil { + return nil + } + out := new(CloudStorage) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CloudStorage) 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 *CloudStorageList) DeepCopyInto(out *CloudStorageList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CloudStorage, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudStorageList. +func (in *CloudStorageList) DeepCopy() *CloudStorageList { + if in == nil { + return nil + } + out := new(CloudStorageList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CloudStorageList) 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 *CloudStorageLocation) DeepCopyInto(out *CloudStorageLocation) { + *out = *in + out.CloudStorageRef = in.CloudStorageRef + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Credential != nil { + in, out := &in.Credential, &out.Credential + *out = new(v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + if in.BackupSyncPeriod != nil { + in, out := &in.BackupSyncPeriod, &out.BackupSyncPeriod + *out = new(metav1.Duration) + **out = **in + } + if in.CACert != nil { + in, out := &in.CACert, &out.CACert + *out = make([]byte, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudStorageLocation. +func (in *CloudStorageLocation) DeepCopy() *CloudStorageLocation { + if in == nil { + return nil + } + out := new(CloudStorageLocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CloudStorageSpec) DeepCopyInto(out *CloudStorageSpec) { + *out = *in + in.CreationSecret.DeepCopyInto(&out.CreationSecret) + if in.EnableSharedConfig != nil { + in, out := &in.EnableSharedConfig, &out.EnableSharedConfig + *out = new(bool) + **out = **in + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *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 CloudStorageSpec. +func (in *CloudStorageSpec) DeepCopy() *CloudStorageSpec { + if in == nil { + return nil + } + out := new(CloudStorageSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CloudStorageStatus) DeepCopyInto(out *CloudStorageStatus) { + *out = *in + if in.LastSynced != nil { + in, out := &in.LastSynced, &out.LastSynced + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudStorageStatus. +func (in *CloudStorageStatus) DeepCopy() *CloudStorageStatus { + if in == nil { + return nil + } + out := new(CloudStorageStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomPlugin) DeepCopyInto(out *CustomPlugin) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomPlugin. +func (in *CustomPlugin) DeepCopy() *CustomPlugin { + if in == nil { + return nil + } + out := new(CustomPlugin) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataMover) DeepCopyInto(out *DataMover) { + *out = *in + if in.VolumeOptionsForStorageClasses != nil { + in, out := &in.VolumeOptionsForStorageClasses, &out.VolumeOptionsForStorageClasses + *out = make(map[string]DataMoverVolumeOptions, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.SnapshotRetainPolicy != nil { + in, out := &in.SnapshotRetainPolicy, &out.SnapshotRetainPolicy + *out = new(RetainPolicy) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataMover. +func (in *DataMover) DeepCopy() *DataMover { + if in == nil { + return nil + } + out := new(DataMover) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataMoverVolumeOptions) DeepCopyInto(out *DataMoverVolumeOptions) { + *out = *in + if in.SourceVolumeOptions != nil { + in, out := &in.SourceVolumeOptions, &out.SourceVolumeOptions + *out = new(VolumeOptions) + **out = **in + } + if in.DestinationVolumeOptions != nil { + in, out := &in.DestinationVolumeOptions, &out.DestinationVolumeOptions + *out = new(VolumeOptions) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataMoverVolumeOptions. +func (in *DataMoverVolumeOptions) DeepCopy() *DataMoverVolumeOptions { + if in == nil { + return nil + } + out := new(DataMoverVolumeOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataProtectionApplication) DeepCopyInto(out *DataProtectionApplication) { + *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 DataProtectionApplication. +func (in *DataProtectionApplication) DeepCopy() *DataProtectionApplication { + if in == nil { + return nil + } + out := new(DataProtectionApplication) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DataProtectionApplication) 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 *DataProtectionApplicationList) DeepCopyInto(out *DataProtectionApplicationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DataProtectionApplication, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataProtectionApplicationList. +func (in *DataProtectionApplicationList) DeepCopy() *DataProtectionApplicationList { + if in == nil { + return nil + } + out := new(DataProtectionApplicationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DataProtectionApplicationList) 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 *DataProtectionApplicationSpec) DeepCopyInto(out *DataProtectionApplicationSpec) { + *out = *in + if in.BackupLocations != nil { + in, out := &in.BackupLocations, &out.BackupLocations + *out = make([]BackupLocation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SnapshotLocations != nil { + in, out := &in.SnapshotLocations, &out.SnapshotLocations + *out = make([]SnapshotLocation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.UnsupportedOverrides != nil { + in, out := &in.UnsupportedOverrides, &out.UnsupportedOverrides + *out = make(map[UnsupportedImageKey]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.PodAnnotations != nil { + in, out := &in.PodAnnotations, &out.PodAnnotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + in.PodDnsConfig.DeepCopyInto(&out.PodDnsConfig) + if in.BackupImages != nil { + in, out := &in.BackupImages, &out.BackupImages + *out = new(bool) + **out = **in + } + if in.Configuration != nil { + in, out := &in.Configuration, &out.Configuration + *out = new(ApplicationConfig) + (*in).DeepCopyInto(*out) + } + if in.Features != nil { + in, out := &in.Features, &out.Features + *out = new(Features) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataProtectionApplicationSpec. +func (in *DataProtectionApplicationSpec) DeepCopy() *DataProtectionApplicationSpec { + if in == nil { + return nil + } + out := new(DataProtectionApplicationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataProtectionApplicationStatus) DeepCopyInto(out *DataProtectionApplicationStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataProtectionApplicationStatus. +func (in *DataProtectionApplicationStatus) DeepCopy() *DataProtectionApplicationStatus { + if in == nil { + return nil + } + out := new(DataProtectionApplicationStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Features) DeepCopyInto(out *Features) { + *out = *in + if in.DataMover != nil { + in, out := &in.DataMover, &out.DataMover + *out = new(DataMover) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Features. +func (in *Features) DeepCopy() *Features { + if in == nil { + return nil + } + out := new(Features) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAgentCommonFields) DeepCopyInto(out *NodeAgentCommonFields) { + *out = *in + if in.Enable != nil { + in, out := &in.Enable, &out.Enable + *out = new(bool) + **out = **in + } + if in.SupplementalGroups != nil { + in, out := &in.SupplementalGroups, &out.SupplementalGroups + *out = make([]int64, len(*in)) + copy(*out, *in) + } + if in.PodConfig != nil { + in, out := &in.PodConfig, &out.PodConfig + *out = new(PodConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAgentCommonFields. +func (in *NodeAgentCommonFields) DeepCopy() *NodeAgentCommonFields { + if in == nil { + return nil + } + out := new(NodeAgentCommonFields) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAgentConfig) DeepCopyInto(out *NodeAgentConfig) { + *out = *in + in.NodeAgentCommonFields.DeepCopyInto(&out.NodeAgentCommonFields) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAgentConfig. +func (in *NodeAgentConfig) DeepCopy() *NodeAgentConfig { + if in == nil { + return nil + } + out := new(NodeAgentConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodConfig) DeepCopyInto(out *PodConfig) { + *out = *in + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.ResourceAllocations.DeepCopyInto(&out.ResourceAllocations) + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]v1.EnvVar, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodConfig. +func (in *PodConfig) DeepCopy() *PodConfig { + if in == nil { + return nil + } + out := new(PodConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResticConfig) DeepCopyInto(out *ResticConfig) { + *out = *in + in.NodeAgentCommonFields.DeepCopyInto(&out.NodeAgentCommonFields) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResticConfig. +func (in *ResticConfig) DeepCopy() *ResticConfig { + if in == nil { + return nil + } + out := new(ResticConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RetainPolicy) DeepCopyInto(out *RetainPolicy) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetainPolicy. +func (in *RetainPolicy) DeepCopy() *RetainPolicy { + if in == nil { + return nil + } + out := new(RetainPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotLocation) DeepCopyInto(out *SnapshotLocation) { + *out = *in + if in.Velero != nil { + in, out := &in.Velero, &out.Velero + *out = new(velerov1.VolumeSnapshotLocationSpec) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotLocation. +func (in *SnapshotLocation) DeepCopy() *SnapshotLocation { + if in == nil { + return nil + } + out := new(SnapshotLocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VeleroConfig) DeepCopyInto(out *VeleroConfig) { + *out = *in + if in.FeatureFlags != nil { + in, out := &in.FeatureFlags, &out.FeatureFlags + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.DefaultPlugins != nil { + in, out := &in.DefaultPlugins, &out.DefaultPlugins + *out = make([]DefaultPlugin, len(*in)) + copy(*out, *in) + } + if in.CustomPlugins != nil { + in, out := &in.CustomPlugins, &out.CustomPlugins + *out = make([]CustomPlugin, len(*in)) + copy(*out, *in) + } + if in.PodConfig != nil { + in, out := &in.PodConfig, &out.PodConfig + *out = new(PodConfig) + (*in).DeepCopyInto(*out) + } + if in.DefaultVolumesToFSBackup != nil { + in, out := &in.DefaultVolumesToFSBackup, &out.DefaultVolumesToFSBackup + *out = new(bool) + **out = **in + } + if in.DefaultSnapshotMoveData != nil { + in, out := &in.DefaultSnapshotMoveData, &out.DefaultSnapshotMoveData + *out = new(bool) + **out = **in + } + if in.DisableInformerCache != nil { + in, out := &in.DisableInformerCache, &out.DisableInformerCache + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VeleroConfig. +func (in *VeleroConfig) DeepCopy() *VeleroConfig { + if in == nil { + return nil + } + out := new(VeleroConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeOptions) DeepCopyInto(out *VolumeOptions) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeOptions. +func (in *VolumeOptions) DeepCopy() *VolumeOptions { + if in == nil { + return nil + } + out := new(VolumeOptions) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/pkg/common/common.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/pkg/common/common.go new file mode 100644 index 000000000..dd716d4a2 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/pkg/common/common.go @@ -0,0 +1,292 @@ +package common + +import ( + "fmt" + "os" + "regexp" + "sort" + "strings" + + "github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/pkg/restore" + corev1 "k8s.io/api/core/v1" +) + +const ( + Velero = "velero" + NodeAgent = "node-agent" + VeleroNamespace = "oadp-operator" + OADPOperator = "oadp-operator" + OADPOperatorVelero = "oadp-operator-velero" + OADPOperatorServiceAccount = "openshift-adp-controller-manager" +) + +var DefaultRestoreResourcePriorities = restore.Priorities{ + HighPriorities: []string{ + "securitycontextconstraints", + "customresourcedefinitions", + "klusterletconfigs.config.open-cluster-management.io", + "managedcluster.cluster.open-cluster-management.io", + "namespaces", + "roles", + "rolebindings", + "clusterrolebindings", + "klusterletaddonconfig.agent.open-cluster-management.io", + "managedclusteraddon.addon.open-cluster-management.io", + "storageclasses", + "volumesnapshotclass.snapshot.storage.k8s.io", + "volumesnapshotcontents.snapshot.storage.k8s.io", + "volumesnapshots.snapshot.storage.k8s.io", + "datauploads.velero.io", + "persistentvolumes", + "persistentvolumeclaims", + "serviceaccounts", + "secrets", + "configmaps", + "limitranges", + "pods", + "replicasets.apps", + "clusterclasses.cluster.x-k8s.io", + "endpoints", + "services", + }, + LowPriorities: []string{ + "clusterbootstraps.run.tanzu.vmware.com", + "clusters.cluster.x-k8s.io", + "clusterresourcesets.addons.cluster.x-k8s.io", + }, +} + +// Images +const ( + VeleroImage = "quay.io/konveyor/velero:latest" + OpenshiftPluginImage = "quay.io/konveyor/openshift-velero-plugin:latest" + AWSPluginImage = "quay.io/konveyor/velero-plugin-for-aws:latest" + AzurePluginImage = "quay.io/konveyor/velero-plugin-for-microsoft-azure:latest" + GCPPluginImage = "quay.io/konveyor/velero-plugin-for-gcp:latest" + RegistryImage = "quay.io/konveyor/registry:latest" + KubeVirtPluginImage = "quay.io/konveyor/kubevirt-velero-plugin:v0.7.0" +) + +// Plugin names +const ( + VeleroPluginForAWS = "velero-plugin-for-aws" + VeleroPluginForAzure = "velero-plugin-for-microsoft-azure" + VeleroPluginForGCP = "velero-plugin-for-gcp" + VeleroPluginForOpenshift = "openshift-velero-plugin" + KubeVirtPlugin = "kubevirt-velero-plugin" +) + +// Environment Vars keys +const ( + LDLibraryPathEnvKey = "LD_LIBRARY_PATH" + VeleroNamespaceEnvKey = "VELERO_NAMESPACE" + VeleroScratchDirEnvKey = "VELERO_SCRATCH_DIR" + AWSSharedCredentialsFileEnvKey = "AWS_SHARED_CREDENTIALS_FILE" + AzureCredentialsFileEnvKey = "AZURE_CREDENTIALS_FILE" + GCPCredentialsEnvKey = "GOOGLE_APPLICATION_CREDENTIALS" + HTTPProxyEnvVar = "HTTP_PROXY" + HTTPSProxyEnvVar = "HTTPS_PROXY" + NoProxyEnvVar = "NO_PROXY" +) + +// Unsupported Server Args annotation keys +const ( + UnsupportedVeleroServerArgsAnnotation = "oadp.openshift.io/unsupported-velero-server-args" + UnsupportedNodeAgentServerArgsAnnotation = "oadp.openshift.io/unsupported-node-agent-server-args" +) + +const defaultMode = int32(420) + +func DefaultModePtr() *int32 { + var mode int32 = defaultMode + return &mode +} + +func AppendUniqueKeyTOfTMaps[T comparable](userLabels ...map[T]T) (map[T]T, error) { + var base map[T]T + for _, labels := range userLabels { + if labels == nil { + continue + } + if base == nil { + base = make(map[T]T) + } + for k, v := range labels { + if _, found := base[k]; !found { + base[k] = v + } else if base[k] != v { + return nil, fmt.Errorf("conflicting key %v with value %v may not override %v", k, v, base[k]) + } + } + } + return base, nil +} + +// append env vars together where the first one wins +func AppendUniqueEnvVars(userEnvVars ...[]corev1.EnvVar) []corev1.EnvVar { + base := []corev1.EnvVar{} + for _, envVars := range userEnvVars { + if envVars == nil { + continue + } + for _, envVar := range envVars { + if !containsEnvVar(base, envVar) { + base = append(base, envVar) + } + } + } + return base +} + +func containsEnvVar(envVars []corev1.EnvVar, envVar corev1.EnvVar) bool { + for _, e := range envVars { + if e.Name == envVar.Name { + return true + } + } + return false +} + +func AppendUniqueValues[T comparable](slice []T, values ...T) []T { + if values == nil || len(values) == 0 { + return slice + } + slice = append(slice, values...) + return RemoveDuplicateValues(slice) +} + +type e struct{} // empty struct + +func RemoveDuplicateValues[T comparable](slice []T) []T { + if slice == nil { + return nil + } + keys := make(map[T]e) + list := []T{} + for _, entry := range slice { + if _, found := keys[entry]; !found { //add entry to list if not found in keys already + keys[entry] = e{} + list = append(list, entry) + } + } + return list // return the result through the passed in argument +} + +func AppendTTMapAsCopy[T comparable](add ...map[T]T) map[T]T { + if add == nil || len(add) == 0 { + return nil + } + base := map[T]T{} + for k, v := range add[0] { + base[k] = v + } + if len(add) == 1 { + return base + } + for i := 1; i < len(add); i++ { + for k, v := range add[i] { + base[k] = v + } + } + return base +} + +// CCOWorkflow checks if the AWS STS secret is to be obtained from Cloud Credentials Operator (CCO) +// if the user provides role ARN during installation then the ARN gets set as env var on operator deployment +// during installation via OLM +func CCOWorkflow() bool { + roleARN := os.Getenv("ROLEARN") + if len(roleARN) > 0 { + return true + } + return false +} + +// GetImagePullPolicy get imagePullPolicy for a container, based on its image. +// If image contains a sha256 or sha512 digest, use IfNotPresent; otherwise, Always. +// If an error occurs, Always is used. +// Reference: https://github.com/distribution/distribution/blob/v2.7.1/reference/reference.go +func GetImagePullPolicy(image string) (corev1.PullPolicy, error) { + sha256regex, err := regexp.Compile("@sha256:[a-f0-9]{64}") + if err != nil { + return corev1.PullAlways, err + } + if sha256regex.Match([]byte(image)) { + // image contains a sha256 digest + return corev1.PullIfNotPresent, nil + } + sha512regex, err := regexp.Compile("@sha512:[a-f0-9]{128}") + if err != nil { + return corev1.PullAlways, err + } + if sha512regex.Match([]byte(image)) { + // image contains a sha512 digest + return corev1.PullIfNotPresent, nil + } + return corev1.PullAlways, nil +} + +// GenerateCliArgsFromConfigMap generates CLI arguments from a ConfigMap. +// +// This function takes a ConfigMap and a CLI subcommand(s), and returns a slice of strings representing +// the CLI arguments from the subcommand(s) followed by the arguments from the ConfigMap. +// The function processes each key-value pair in the ConfigMap as follows: +// +// 1. If the ConfigMaps' key starts with single '-' or double '--', it is left unchanged. +// 2. If the key name does not start with `-` or `--`, then `--` is added as a prefix to the key. +// 3. If the ConfigMap value is "true" or "false" (case-insensitive), it is converted to lowercase +// and used without single quotes surroundings (boolean value). +// 4. The formatted key-value pair is added to the result that is alphabetically sorted. +// +// Args: +// +// configMap: A pointer to a corev1.ConfigMap containing key-value pairs. +// cliSubCommand: The CLI subcommand(s) as a string, for example 'server' +// or 'node-agent', 'server' +// +// Returns: +// +// A slice of strings representing the CLI arguments. +func GenerateCliArgsFromConfigMap(configMap *corev1.ConfigMap, cliSubCommand ...string) []string { + + var keyValueArgs []string + + // Iterate through each key-value pair in the ConfigMap + for key, value := range configMap.Data { + // Ensure the key is prefixed by "--" if it doesn't start with "--" or "-" + if !strings.HasPrefix(key, "-") { + key = fmt.Sprintf("--%s", key) + } + + if strings.EqualFold(value, "true") || strings.EqualFold(value, "false") { + // Convert true/false to lowercase if not surrounded by quotes - boolean + value = strings.ToLower(value) + } + + keyValueArgs = append(keyValueArgs, fmt.Sprintf("%s=%s", key, value)) + + } + // We ensure the flags are alphabetically sorted, so they + // are always added to the cliSubCommand(s) the same way + sort.Strings(keyValueArgs) + + // Append the formatted key-value pair to args + cliSubCommand = append(cliSubCommand, keyValueArgs...) + + return cliSubCommand +} + +// Apply Override unsupported Node agent Server Args +func ApplyUnsupportedServerArgsOverride(container *corev1.Container, unsupportedServerArgsCM corev1.ConfigMap, serverType string) error { + + switch serverType { + case NodeAgent: + // if server args is set, override the default server args + container.Args = GenerateCliArgsFromConfigMap(&unsupportedServerArgsCM, "node-agent", "server") + + case Velero: + // if server args is set, override the default server args + container.Args = GenerateCliArgsFromConfigMap(&unsupportedServerArgsCM, "server") + } + return nil +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/backup_repository_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/backup_repository_types.go new file mode 100644 index 000000000..6a062c4fe --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/backup_repository_types.go @@ -0,0 +1,114 @@ +/* +Copyright 2018 the Velero contributors. + +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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// BackupRepositorySpec is the specification for a BackupRepository. +type BackupRepositorySpec struct { + // VolumeNamespace is the namespace this backup repository contains + // pod volume backups for. + VolumeNamespace string `json:"volumeNamespace"` + + // BackupStorageLocation is the name of the BackupStorageLocation + // that should contain this repository. + BackupStorageLocation string `json:"backupStorageLocation"` + + // RepositoryType indicates the type of the backend repository + // +kubebuilder:validation:Enum=kopia;restic;"" + // +optional + RepositoryType string `json:"repositoryType"` + + // ResticIdentifier is the full restic-compatible string for identifying + // this repository. + ResticIdentifier string `json:"resticIdentifier"` + + // MaintenanceFrequency is how often maintenance should be run. + MaintenanceFrequency metav1.Duration `json:"maintenanceFrequency"` +} + +// BackupRepositoryPhase represents the lifecycle phase of a BackupRepository. +// +kubebuilder:validation:Enum=New;Ready;NotReady +type BackupRepositoryPhase string + +const ( + BackupRepositoryPhaseNew BackupRepositoryPhase = "New" + BackupRepositoryPhaseReady BackupRepositoryPhase = "Ready" + BackupRepositoryPhaseNotReady BackupRepositoryPhase = "NotReady" + + BackupRepositoryTypeRestic string = "restic" + BackupRepositoryTypeKopia string = "kopia" +) + +// BackupRepositoryStatus is the current status of a BackupRepository. +type BackupRepositoryStatus struct { + // Phase is the current state of the BackupRepository. + // +optional + Phase BackupRepositoryPhase `json:"phase,omitempty"` + + // Message is a message about the current status of the BackupRepository. + // +optional + Message string `json:"message,omitempty"` + + // LastMaintenanceTime is the last time maintenance was run. + // +optional + // +nullable + LastMaintenanceTime *metav1.Time `json:"lastMaintenanceTime,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runtime-controller client, +// the genclient and k8s:deepcopy markers will no longer be needed and should be removed. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:object:generate=true +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:printcolumn:name="Repository Type",type="string",JSONPath=".spec.repositoryType" +// + +type BackupRepository struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec BackupRepositorySpec `json:"spec,omitempty"` + + // +optional + Status BackupRepositoryStatus `json:"status,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runtime-controller client, +// the k8s:deepcopy marker will no longer be needed and should be removed. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:rbac:groups=velero.io,resources=backuprepositories,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=velero.io,resources=backuprepositories/status,verbs=get;update;patch + +// BackupRepositoryList is a list of BackupRepositories. +type BackupRepositoryList struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + Items []BackupRepository `json:"items"` +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/backup_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/backup_types.go new file mode 100644 index 000000000..858894dc7 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/backup_types.go @@ -0,0 +1,517 @@ +/* +Copyright 2020 the Velero contributors. + +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 v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type Metadata struct { + Labels map[string]string `json:"labels,omitempty"` +} + +// BackupSpec defines the specification for a Velero backup. +type BackupSpec struct { + // +optional + Metadata `json:"metadata,omitempty"` + // IncludedNamespaces is a slice of namespace names to include objects + // from. If empty, all namespaces are included. + // +optional + // +nullable + IncludedNamespaces []string `json:"includedNamespaces,omitempty"` + + // ExcludedNamespaces contains a list of namespaces that are not + // included in the backup. + // +optional + // +nullable + ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"` + + // IncludedResources is a slice of resource names to include + // in the backup. If empty, all resources are included. + // +optional + // +nullable + IncludedResources []string `json:"includedResources,omitempty"` + + // ExcludedResources is a slice of resource names that are not + // included in the backup. + // +optional + // +nullable + ExcludedResources []string `json:"excludedResources,omitempty"` + + // IncludedClusterScopedResources is a slice of cluster-scoped + // resource type names to include in the backup. + // If set to "*", all cluster-scoped resource types are included. + // The default value is empty, which means only related + // cluster-scoped resources are included. + // +optional + // +nullable + IncludedClusterScopedResources []string `json:"includedClusterScopedResources,omitempty"` + + // ExcludedClusterScopedResources is a slice of cluster-scoped + // resource type names to exclude from the backup. + // If set to "*", all cluster-scoped resource types are excluded. + // The default value is empty. + // +optional + // +nullable + ExcludedClusterScopedResources []string `json:"excludedClusterScopedResources,omitempty"` + + // IncludedNamespaceScopedResources is a slice of namespace-scoped + // resource type names to include in the backup. + // The default value is "*". + // +optional + // +nullable + IncludedNamespaceScopedResources []string `json:"includedNamespaceScopedResources,omitempty"` + + // ExcludedNamespaceScopedResources is a slice of namespace-scoped + // resource type names to exclude from the backup. + // If set to "*", all namespace-scoped resource types are excluded. + // The default value is empty. + // +optional + // +nullable + ExcludedNamespaceScopedResources []string `json:"excludedNamespaceScopedResources,omitempty"` + + // LabelSelector is a metav1.LabelSelector to filter with + // when adding individual objects to the backup. If empty + // or nil, all objects are included. Optional. + // +optional + // +nullable + LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"` + + // OrLabelSelectors is list of metav1.LabelSelector to filter with + // when adding individual objects to the backup. If multiple provided + // they will be joined by the OR operator. LabelSelector as well as + // OrLabelSelectors cannot co-exist in backup request, only one of them + // can be used. + // +optional + // +nullable + OrLabelSelectors []*metav1.LabelSelector `json:"orLabelSelectors,omitempty"` + + // SnapshotVolumes specifies whether to take snapshots + // of any PV's referenced in the set of objects included + // in the Backup. + // +optional + // +nullable + SnapshotVolumes *bool `json:"snapshotVolumes,omitempty"` + + // TTL is a time.Duration-parseable string describing how long + // the Backup should be retained for. + // +optional + TTL metav1.Duration `json:"ttl,omitempty"` + + // IncludeClusterResources specifies whether cluster-scoped resources + // should be included for consideration in the backup. + // +optional + // +nullable + IncludeClusterResources *bool `json:"includeClusterResources,omitempty"` + + // Hooks represent custom behaviors that should be executed at different phases of the backup. + // +optional + Hooks BackupHooks `json:"hooks,omitempty"` + + // StorageLocation is a string containing the name of a BackupStorageLocation where the backup should be stored. + // +optional + StorageLocation string `json:"storageLocation,omitempty"` + + // VolumeSnapshotLocations is a list containing names of VolumeSnapshotLocations associated with this backup. + // +optional + VolumeSnapshotLocations []string `json:"volumeSnapshotLocations,omitempty"` + + // DefaultVolumesToRestic specifies whether restic should be used to take a + // backup of all pod volumes by default. + // + // Deprecated: this field is no longer used and will be removed entirely in future. Use DefaultVolumesToFsBackup instead. + // +optional + // +nullable + DefaultVolumesToRestic *bool `json:"defaultVolumesToRestic,omitempty"` + + // DefaultVolumesToFsBackup specifies whether pod volume file system backup should be used + // for all volumes by default. + // +optional + // +nullable + DefaultVolumesToFsBackup *bool `json:"defaultVolumesToFsBackup,omitempty"` + + // OrderedResources specifies the backup order of resources of specific Kind. + // The map key is the resource name and value is a list of object names separated by commas. + // Each resource name has format "namespace/objectname". For cluster resources, simply use "objectname". + // +optional + // +nullable + OrderedResources map[string]string `json:"orderedResources,omitempty"` + + // CSISnapshotTimeout specifies the time used to wait for CSI VolumeSnapshot status turns to + // ReadyToUse during creation, before returning error as timeout. + // The default value is 10 minute. + // +optional + CSISnapshotTimeout metav1.Duration `json:"csiSnapshotTimeout,omitempty"` + + // ItemOperationTimeout specifies the time used to wait for asynchronous BackupItemAction operations + // The default value is 4 hour. + // +optional + ItemOperationTimeout metav1.Duration `json:"itemOperationTimeout,omitempty"` + // ResourcePolicy specifies the referenced resource policies that backup should follow + // +optional + ResourcePolicy *v1.TypedLocalObjectReference `json:"resourcePolicy,omitempty"` + + // SnapshotMoveData specifies whether snapshot data should be moved + // +optional + // +nullable + SnapshotMoveData *bool `json:"snapshotMoveData,omitempty"` + + // DataMover specifies the data mover to be used by the backup. + // If DataMover is "" or "velero", the built-in data mover will be used. + // +optional + DataMover string `json:"datamover,omitempty"` + + // UploaderConfig specifies the configuration for the uploader. + // +optional + // +nullable + UploaderConfig *UploaderConfigForBackup `json:"uploaderConfig,omitempty"` +} + +// UploaderConfigForBackup defines the configuration for the uploader when doing backup. +type UploaderConfigForBackup struct { + // ParallelFilesUpload is the number of files parallel uploads to perform when using the uploader. + // +optional + ParallelFilesUpload int `json:"parallelFilesUpload,omitempty"` +} + +// BackupHooks contains custom behaviors that should be executed at different phases of the backup. +type BackupHooks struct { + // Resources are hooks that should be executed when backing up individual instances of a resource. + // +optional + // +nullable + Resources []BackupResourceHookSpec `json:"resources,omitempty"` +} + +// BackupResourceHookSpec defines one or more BackupResourceHooks that should be executed based on +// the rules defined for namespaces, resources, and label selector. +type BackupResourceHookSpec struct { + // Name is the name of this hook. + Name string `json:"name"` + + // IncludedNamespaces specifies the namespaces to which this hook spec applies. If empty, it applies + // to all namespaces. + // +optional + // +nullable + IncludedNamespaces []string `json:"includedNamespaces,omitempty"` + + // ExcludedNamespaces specifies the namespaces to which this hook spec does not apply. + // +optional + // +nullable + ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"` + + // IncludedResources specifies the resources to which this hook spec applies. If empty, it applies + // to all resources. + // +optional + // +nullable + IncludedResources []string `json:"includedResources,omitempty"` + + // ExcludedResources specifies the resources to which this hook spec does not apply. + // +optional + // +nullable + ExcludedResources []string `json:"excludedResources,omitempty"` + + // LabelSelector, if specified, filters the resources to which this hook spec applies. + // +optional + // +nullable + LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"` + + // PreHooks is a list of BackupResourceHooks to execute prior to storing the item in the backup. + // These are executed before any "additional items" from item actions are processed. + // +optional + PreHooks []BackupResourceHook `json:"pre,omitempty"` + + // PostHooks is a list of BackupResourceHooks to execute after storing the item in the backup. + // These are executed after all "additional items" from item actions are processed. + // +optional + PostHooks []BackupResourceHook `json:"post,omitempty"` +} + +// BackupResourceHook defines a hook for a resource. +type BackupResourceHook struct { + // Exec defines an exec hook. + Exec *ExecHook `json:"exec"` +} + +// ExecHook is a hook that uses the pod exec API to execute a command in a container in a pod. +type ExecHook struct { + // Container is the container in the pod where the command should be executed. If not specified, + // the pod's first container is used. + // +optional + Container string `json:"container,omitempty"` + + // Command is the command and arguments to execute. + // +kubebuilder:validation:MinItems=1 + Command []string `json:"command"` + + // OnError specifies how Velero should behave if it encounters an error executing this hook. + // +optional + OnError HookErrorMode `json:"onError,omitempty"` + + // Timeout defines the maximum amount of time Velero should wait for the hook to complete before + // considering the execution a failure. + // +optional + Timeout metav1.Duration `json:"timeout,omitempty"` +} + +// HookErrorMode defines how Velero should treat an error from a hook. +// +kubebuilder:validation:Enum=Continue;Fail +type HookErrorMode string + +const ( + // HookErrorModeContinue means that an error from a hook is acceptable and the backup/restore can + // proceed with the rest of hooks' execution. This backup/restore should be in `PartiallyFailed` status. + HookErrorModeContinue HookErrorMode = "Continue" + + // HookErrorModeFail means that an error from a hook is problematic and Velero should stop executing following hooks. + // This backup/restore should be in `PartiallyFailed` status. + HookErrorModeFail HookErrorMode = "Fail" +) + +// BackupPhase is a string representation of the lifecycle phase +// of a Velero backup. +// +kubebuilder:validation:Enum=New;FailedValidation;InProgress;WaitingForPluginOperations;WaitingForPluginOperationsPartiallyFailed;Finalizing;FinalizingPartiallyFailed;Completed;PartiallyFailed;Failed;Deleting +type BackupPhase string + +const ( + // BackupPhaseNew means the backup has been created but not + // yet processed by the BackupController. + BackupPhaseNew BackupPhase = "New" + + // BackupPhaseFailedValidation means the backup has failed + // the controller's validations and therefore will not run. + BackupPhaseFailedValidation BackupPhase = "FailedValidation" + + // BackupPhaseInProgress means the backup is currently executing. + BackupPhaseInProgress BackupPhase = "InProgress" + + // BackupPhaseWaitingForPluginOperations means the backup of + // Kubernetes resources, creation of snapshots, and other + // async plugin operations was successful and snapshot data is + // currently uploading or other plugin operations are still + // ongoing. The backup is not usable yet. + BackupPhaseWaitingForPluginOperations BackupPhase = "WaitingForPluginOperations" + + // BackupPhaseWaitingForPluginOperationsPartiallyFailed means + // the backup of Kubernetes resources, creation of snapshots, + // and other async plugin operations partially failed (final + // phase will be PartiallyFailed) and snapshot data is + // currently uploading or other plugin operations are still + // ongoing. The backup is not usable yet. + BackupPhaseWaitingForPluginOperationsPartiallyFailed BackupPhase = "WaitingForPluginOperationsPartiallyFailed" + + // BackupPhaseFinalizing means the backup of + // Kubernetes resources, creation of snapshots, and other + // async plugin operations were successful and snapshot upload and + // other plugin operations are now complete, but the Backup is awaiting + // final update of resources modified during async operations. + // The backup is not usable yet. + BackupPhaseFinalizing BackupPhase = "Finalizing" + + // BackupPhaseFinalizingPartiallyFailed means the backup of + // Kubernetes resources, creation of snapshots, and other + // async plugin operations were successful and snapshot upload and + // other plugin operations are now complete, but one or more errors + // occurred during backup or async operation processing, and the + // Backup is awaiting final update of resources modified during async + // operations. The backup is not usable yet. + BackupPhaseFinalizingPartiallyFailed BackupPhase = "FinalizingPartiallyFailed" + + // BackupPhaseCompleted means the backup has run successfully without + // errors. + BackupPhaseCompleted BackupPhase = "Completed" + + // BackupPhasePartiallyFailed means the backup has run to completion + // but encountered 1+ errors backing up individual items. + BackupPhasePartiallyFailed BackupPhase = "PartiallyFailed" + + // BackupPhaseFailed means the backup ran but encountered an error that + // prevented it from completing successfully. + BackupPhaseFailed BackupPhase = "Failed" + + // BackupPhaseDeleting means the backup and all its associated data are being deleted. + BackupPhaseDeleting BackupPhase = "Deleting" +) + +// BackupStatus captures the current status of a Velero backup. +type BackupStatus struct { + // Version is the backup format major version. + // Deprecated: Please see FormatVersion + // +optional + Version int `json:"version,omitempty"` + + // FormatVersion is the backup format version, including major, minor, and patch version. + // +optional + FormatVersion string `json:"formatVersion,omitempty"` + + // Expiration is when this Backup is eligible for garbage-collection. + // +optional + // +nullable + Expiration *metav1.Time `json:"expiration,omitempty"` + + // Phase is the current state of the Backup. + // +optional + Phase BackupPhase `json:"phase,omitempty"` + + // ValidationErrors is a slice of all validation errors (if + // applicable). + // +optional + // +nullable + ValidationErrors []string `json:"validationErrors,omitempty"` + + // StartTimestamp records the time a backup was started. + // Separate from CreationTimestamp, since that value changes + // on restores. + // The server's time is used for StartTimestamps + // +optional + // +nullable + StartTimestamp *metav1.Time `json:"startTimestamp,omitempty"` + + // CompletionTimestamp records the time a backup was completed. + // Completion time is recorded even on failed backups. + // Completion time is recorded before uploading the backup object. + // The server's time is used for CompletionTimestamps + // +optional + // +nullable + CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"` + + // VolumeSnapshotsAttempted is the total number of attempted + // volume snapshots for this backup. + // +optional + VolumeSnapshotsAttempted int `json:"volumeSnapshotsAttempted,omitempty"` + + // VolumeSnapshotsCompleted is the total number of successfully + // completed volume snapshots for this backup. + // +optional + VolumeSnapshotsCompleted int `json:"volumeSnapshotsCompleted,omitempty"` + + // FailureReason is an error that caused the entire backup to fail. + // +optional + FailureReason string `json:"failureReason,omitempty"` + + // Warnings is a count of all warning messages that were generated during + // execution of the backup. The actual warnings are in the backup's log + // file in object storage. + // +optional + Warnings int `json:"warnings,omitempty"` + + // Errors is a count of all error messages that were generated during + // execution of the backup. The actual errors are in the backup's log + // file in object storage. + // +optional + Errors int `json:"errors,omitempty"` + + // Progress contains information about the backup's execution progress. Note + // that this information is best-effort only -- if Velero fails to update it + // during a backup for any reason, it may be inaccurate/stale. + // +optional + // +nullable + Progress *BackupProgress `json:"progress,omitempty"` + + // CSIVolumeSnapshotsAttempted is the total number of attempted + // CSI VolumeSnapshots for this backup. + // +optional + CSIVolumeSnapshotsAttempted int `json:"csiVolumeSnapshotsAttempted,omitempty"` + + // CSIVolumeSnapshotsCompleted is the total number of successfully + // completed CSI VolumeSnapshots for this backup. + // +optional + CSIVolumeSnapshotsCompleted int `json:"csiVolumeSnapshotsCompleted,omitempty"` + + // BackupItemOperationsAttempted is the total number of attempted + // async BackupItemAction operations for this backup. + // +optional + BackupItemOperationsAttempted int `json:"backupItemOperationsAttempted,omitempty"` + + // BackupItemOperationsCompleted is the total number of successfully completed + // async BackupItemAction operations for this backup. + // +optional + BackupItemOperationsCompleted int `json:"backupItemOperationsCompleted,omitempty"` + + // BackupItemOperationsFailed is the total number of async + // BackupItemAction operations for this backup which ended with an error. + // +optional + BackupItemOperationsFailed int `json:"backupItemOperationsFailed,omitempty"` + + // HookStatus contains information about the status of the hooks. + // +optional + // +nullable + HookStatus *HookStatus `json:"hookStatus,omitempty"` +} + +// BackupProgress stores information about the progress of a Backup's execution. +type BackupProgress struct { + // TotalItems is the total number of items to be backed up. This number may change + // throughout the execution of the backup due to plugins that return additional related + // items to back up, the velero.io/exclude-from-backup label, and various other + // filters that happen as items are processed. + // +optional + TotalItems int `json:"totalItems,omitempty"` + + // ItemsBackedUp is the number of items that have actually been written to the + // backup tarball so far. + // +optional + ItemsBackedUp int `json:"itemsBackedUp,omitempty"` +} + +// HookStatus stores information about the status of the hooks. +type HookStatus struct { + // HooksAttempted is the total number of attempted hooks + // Specifically, HooksAttempted represents the number of hooks that failed to execute + // and the number of hooks that executed successfully. + // +optional + HooksAttempted int `json:"hooksAttempted,omitempty"` + + // HooksFailed is the total number of hooks which ended with an error + // +optional + HooksFailed int `json:"hooksFailed,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:object:generate=true +// +kubebuilder:storageversion +// +kubebuilder:rbac:groups=velero.io,resources=backups,verbs=create;delete;get;list;patch;update;watch +// +kubebuilder:rbac:groups=velero.io,resources=backups/status,verbs=get;update;patch + +// Backup is a Velero resource that represents the capture of Kubernetes +// cluster state at a point in time (API objects and associated volume state). +type Backup struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec BackupSpec `json:"spec,omitempty"` + + // +optional + Status BackupStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// BackupList is a list of Backups. +type BackupList struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + Items []Backup `json:"items"` +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/backupstoragelocation_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/backupstoragelocation_types.go new file mode 100644 index 000000000..e44671222 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/backupstoragelocation_types.go @@ -0,0 +1,179 @@ +/* +Copyright 2017, 2020 the Velero contributors. + +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 v1 + +import ( + corev1api "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// BackupStorageLocationSpec defines the desired state of a Velero BackupStorageLocation +type BackupStorageLocationSpec struct { + // Provider is the provider of the backup storage. + Provider string `json:"provider"` + + // Config is for provider-specific configuration fields. + // +optional + Config map[string]string `json:"config,omitempty"` + + // Credential contains the credential information intended to be used with this location + // +optional + Credential *corev1api.SecretKeySelector `json:"credential,omitempty"` + + StorageType `json:",inline"` + + // Default indicates this location is the default backup storage location. + // +optional + Default bool `json:"default,omitempty"` + + // AccessMode defines the permissions for the backup storage location. + // +optional + AccessMode BackupStorageLocationAccessMode `json:"accessMode,omitempty"` + + // BackupSyncPeriod defines how frequently to sync backup API objects from object storage. A value of 0 disables sync. + // +optional + // +nullable + BackupSyncPeriod *metav1.Duration `json:"backupSyncPeriod,omitempty"` + + // ValidationFrequency defines how frequently to validate the corresponding object storage. A value of 0 disables validation. + // +optional + // +nullable + ValidationFrequency *metav1.Duration `json:"validationFrequency,omitempty"` +} + +// BackupStorageLocationStatus defines the observed state of BackupStorageLocation +type BackupStorageLocationStatus struct { + // Phase is the current state of the BackupStorageLocation. + // +optional + Phase BackupStorageLocationPhase `json:"phase,omitempty"` + + // LastSyncedTime is the last time the contents of the location were synced into + // the cluster. + // +optional + // +nullable + LastSyncedTime *metav1.Time `json:"lastSyncedTime,omitempty"` + + // LastValidationTime is the last time the backup store location was validated + // the cluster. + // +optional + // +nullable + LastValidationTime *metav1.Time `json:"lastValidationTime,omitempty"` + + // Message is a message about the backup storage location's status. + // +optional + Message string `json:"message,omitempty"` + + // LastSyncedRevision is the value of the `metadata/revision` file in the backup + // storage location the last time the BSL's contents were synced into the cluster. + // + // Deprecated: this field is no longer updated or used for detecting changes to + // the location's contents and will be removed entirely in v2.0. + // +optional + LastSyncedRevision types.UID `json:"lastSyncedRevision,omitempty"` + + // AccessMode is an unused field. + // + // Deprecated: there is now an AccessMode field on the Spec and this field + // will be removed entirely as of v2.0. + // +optional + AccessMode BackupStorageLocationAccessMode `json:"accessMode,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runtime-controller client, +// the genclient and k8s:deepcopy markers will no longer be needed and should be removed. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:resource:shortName=bsl +// +kubebuilder:object:generate=true +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Backup Storage Location status such as Available/Unavailable" +// +kubebuilder:printcolumn:name="Last Validated",type="date",JSONPath=".status.lastValidationTime",description="LastValidationTime is the last time the backup store location was validated" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:printcolumn:name="Default",type="boolean",JSONPath=".spec.default",description="Default backup storage location" + +// BackupStorageLocation is a location where Velero stores backup objects +type BackupStorageLocation struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec BackupStorageLocationSpec `json:"spec,omitempty"` + Status BackupStorageLocationStatus `json:"status,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runtime-controller client, +// the k8s:deepcopy marker will no longer be needed and should be removed. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:rbac:groups=velero.io,resources=backupstoragelocations,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=velero.io,resources=backupstoragelocations/status,verbs=get;update;patch + +// BackupStorageLocationList contains a list of BackupStorageLocation +type BackupStorageLocationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []BackupStorageLocation `json:"items"` +} + +// StorageType represents the type of storage that a backup location uses. +// ObjectStorage must be non-nil, since it is currently the only supported StorageType. +type StorageType struct { + ObjectStorage *ObjectStorageLocation `json:"objectStorage"` +} + +// ObjectStorageLocation specifies the settings necessary to connect to a provider's object storage. +type ObjectStorageLocation struct { + // Bucket is the bucket to use for object storage. + Bucket string `json:"bucket"` + + // Prefix is the path inside a bucket to use for Velero storage. Optional. + // +optional + Prefix string `json:"prefix,omitempty"` + + // CACert defines a CA bundle to use when verifying TLS connections to the provider. + // +optional + CACert []byte `json:"caCert,omitempty"` +} + +// BackupStorageLocationPhase is the lifecycle phase of a Velero BackupStorageLocation. +// +kubebuilder:validation:Enum=Available;Unavailable +// +kubebuilder:default=Unavailable +type BackupStorageLocationPhase string + +const ( + // BackupStorageLocationPhaseAvailable means the location is available to read and write from. + BackupStorageLocationPhaseAvailable BackupStorageLocationPhase = "Available" + + // BackupStorageLocationPhaseUnavailable means the location is unavailable to read and write from. + BackupStorageLocationPhaseUnavailable BackupStorageLocationPhase = "Unavailable" +) + +// BackupStorageLocationAccessMode represents the permissions for a BackupStorageLocation. +// +kubebuilder:validation:Enum=ReadOnly;ReadWrite +type BackupStorageLocationAccessMode string + +const ( + // BackupStorageLocationAccessModeReadOnly represents read-only access to a BackupStorageLocation. + BackupStorageLocationAccessModeReadOnly BackupStorageLocationAccessMode = "ReadOnly" + + // BackupStorageLocationAccessModeReadWrite represents read and write access to a BackupStorageLocation. + BackupStorageLocationAccessModeReadWrite BackupStorageLocationAccessMode = "ReadWrite" +) + +// TODO(2.0): remove the AccessMode field from BackupStorageLocationStatus. +// TODO(2.0): remove the LastSyncedRevision field from BackupStorageLocationStatus. diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/constants.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/constants.go new file mode 100644 index 000000000..a7292d568 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/constants.go @@ -0,0 +1,49 @@ +/* +Copyright 2017 the Velero contributors. + +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 v1 + +const ( + // DefaultNamespace is the Kubernetes namespace that is used by default for + // the Velero server and API objects. + DefaultNamespace = "velero" + + // ResourcesDir is a top-level directory expected in backups which contains sub-directories + // for each resource type in the backup. + ResourcesDir = "resources" + + // MetadataDir is a top-level directory expected in backups which contains + // files that store metadata about the backup, such as the backup version. + MetadataDir = "metadata" + + // ClusterScopedDir is the name of the directory containing cluster-scoped + // resources within a Velero backup. + ClusterScopedDir = "cluster" + + // NamespaceScopedDir is the name of the directory containing namespace-scoped + // resource within a Velero backup. + NamespaceScopedDir = "namespaces" + + // CSIFeatureFlag is the feature flag string that defines whether or not CSI features are being used. + CSIFeatureFlag = "EnableCSI" + + // PreferredVersionDir is the suffix name of the directory containing the preferred version of the API group + // resource within a Velero backup. + PreferredVersionDir = "-preferredversion" + + // APIGroupVersionsFeatureFlag is the feature flag string that defines whether or not to handle multiple API Group Versions + APIGroupVersionsFeatureFlag = "EnableAPIGroupVersions" +) diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/delete_backup_request_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/delete_backup_request_types.go new file mode 100644 index 000000000..8c7b1fa09 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/delete_backup_request_types.go @@ -0,0 +1,87 @@ +/* +Copyright 2018 the Velero contributors. + +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 v1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// DeleteBackupRequestSpec is the specification for which backups to delete. +type DeleteBackupRequestSpec struct { + BackupName string `json:"backupName"` +} + +// DeleteBackupRequestPhase represents the lifecycle phase of a DeleteBackupRequest. +// +kubebuilder:validation:Enum=New;InProgress;Processed +type DeleteBackupRequestPhase string + +const ( + // DeleteBackupRequestPhaseNew means the DeleteBackupRequest has not been processed yet. + DeleteBackupRequestPhaseNew DeleteBackupRequestPhase = "New" + + // DeleteBackupRequestPhaseInProgress means the DeleteBackupRequest is being processed. + DeleteBackupRequestPhaseInProgress DeleteBackupRequestPhase = "InProgress" + + // DeleteBackupRequestPhaseProcessed means the DeleteBackupRequest has been processed. + DeleteBackupRequestPhaseProcessed DeleteBackupRequestPhase = "Processed" +) + +// DeleteBackupRequestStatus is the current status of a DeleteBackupRequest. +type DeleteBackupRequestStatus struct { + // Phase is the current state of the DeleteBackupRequest. + // +optional + Phase DeleteBackupRequestPhase `json:"phase,omitempty"` + + // Errors contains any errors that were encountered during the deletion process. + // +optional + // +nullable + Errors []string `json:"errors,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runtime-controller client, the genclient and k8s:deepcopy markers will no longer be needed and should be removed. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:object:generate=true +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="BackupName",type="string",JSONPath=".spec.backupName",description="The name of the backup to be deleted" +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="The status of the deletion request" + +// DeleteBackupRequest is a request to delete one or more backups. +type DeleteBackupRequest struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec DeleteBackupRequestSpec `json:"spec,omitempty"` + + // +optional + Status DeleteBackupRequestStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// DeleteBackupRequestList is a list of DeleteBackupRequests. +type DeleteBackupRequestList struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + Items []DeleteBackupRequest `json:"items"` +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/doc.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/doc.go new file mode 100644 index 000000000..4431315c2 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2017 the Velero contributors. + +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. +*/ + +// +k8s:deepcopy-gen=package + +// Package v1 is the v1 version of the API. +// +groupName=velero.io +package v1 diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/download_request_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/download_request_types.go new file mode 100644 index 000000000..f23118fe5 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/download_request_types.go @@ -0,0 +1,126 @@ +/* +Copyright The Velero Contributors. + +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 v1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// DownloadRequestSpec is the specification for a download request. +type DownloadRequestSpec struct { + // Target is what to download (e.g. logs for a backup). + Target DownloadTarget `json:"target"` +} + +// DownloadTargetKind represents what type of file to download. +// +kubebuilder:validation:Enum=BackupLog;BackupContents;BackupVolumeSnapshots;BackupItemOperations;BackupResourceList;BackupResults;RestoreLog;RestoreResults;RestoreResourceList;RestoreItemOperations;CSIBackupVolumeSnapshots;CSIBackupVolumeSnapshotContents;BackupVolumeInfos;RestoreVolumeInfo +type DownloadTargetKind string + +const ( + DownloadTargetKindBackupLog DownloadTargetKind = "BackupLog" + DownloadTargetKindBackupContents DownloadTargetKind = "BackupContents" + DownloadTargetKindBackupVolumeSnapshots DownloadTargetKind = "BackupVolumeSnapshots" + DownloadTargetKindBackupItemOperations DownloadTargetKind = "BackupItemOperations" + DownloadTargetKindBackupResourceList DownloadTargetKind = "BackupResourceList" + DownloadTargetKindBackupResults DownloadTargetKind = "BackupResults" + DownloadTargetKindRestoreLog DownloadTargetKind = "RestoreLog" + DownloadTargetKindRestoreResults DownloadTargetKind = "RestoreResults" + DownloadTargetKindRestoreResourceList DownloadTargetKind = "RestoreResourceList" + DownloadTargetKindRestoreItemOperations DownloadTargetKind = "RestoreItemOperations" + DownloadTargetKindCSIBackupVolumeSnapshots DownloadTargetKind = "CSIBackupVolumeSnapshots" + DownloadTargetKindCSIBackupVolumeSnapshotContents DownloadTargetKind = "CSIBackupVolumeSnapshotContents" + DownloadTargetKindBackupVolumeInfos DownloadTargetKind = "BackupVolumeInfos" + DownloadTargetKindRestoreVolumeInfo DownloadTargetKind = "RestoreVolumeInfo" +) + +// DownloadTarget is the specification for what kind of file to download, and the name of the +// resource with which it's associated. +type DownloadTarget struct { + // Kind is the type of file to download. + Kind DownloadTargetKind `json:"kind"` + + // Name is the name of the Kubernetes resource with which the file is associated. + Name string `json:"name"` +} + +// DownloadRequestPhase represents the lifecycle phase of a DownloadRequest. +// +kubebuilder:validation:Enum=New;Processed +type DownloadRequestPhase string + +const ( + // DownloadRequestPhaseNew means the DownloadRequest has not been processed by the + // DownloadRequestController yet. + DownloadRequestPhaseNew DownloadRequestPhase = "New" + + // DownloadRequestPhaseProcessed means the DownloadRequest has been processed by the + // DownloadRequestController. + DownloadRequestPhaseProcessed DownloadRequestPhase = "Processed" +) + +// DownloadRequestStatus is the current status of a DownloadRequest. +type DownloadRequestStatus struct { + // Phase is the current state of the DownloadRequest. + // +optional + Phase DownloadRequestPhase `json:"phase,omitempty"` + + // DownloadURL contains the pre-signed URL for the target file. + // +optional + DownloadURL string `json:"downloadURL,omitempty"` + + // Expiration is when this DownloadRequest expires and can be deleted by the system. + // +optional + // +nullable + Expiration *metav1.Time `json:"expiration,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runtime-controller client, +// the k8s:deepcopy marker will no longer be needed and should be removed. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:object:generate=true +// +kubebuilder:storageversion + +// DownloadRequest is a request to download an artifact from backup object storage, such as a backup +// log file. +type DownloadRequest struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec DownloadRequestSpec `json:"spec,omitempty"` + + // +optional + Status DownloadRequestStatus `json:"status,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runtime-controller client, +// the k8s:deepcopy marker will no longer be needed and should be removed. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:rbac:groups=velero.io,resources=downloadrequests,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=velero.io,resources=downloadrequests/status,verbs=get;update;patch + +// DownloadRequestList is a list of DownloadRequests. +type DownloadRequestList struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + Items []DownloadRequest `json:"items"` +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/groupversion_info.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/groupversion_info.go new file mode 100644 index 000000000..ab5b20433 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/groupversion_info.go @@ -0,0 +1,36 @@ +/* +Copyright 2020 the Velero contributors. + +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 v1 contains API Schema definitions for the velero v1 API group +// +kubebuilder:object:generate=true +// +groupName=velero.io +package v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "velero.io", Version: "v1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/labels_annotations.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/labels_annotations.go new file mode 100644 index 000000000..c86b4e91b --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/labels_annotations.go @@ -0,0 +1,151 @@ +/* +Copyright 2018 the Velero contributors. + +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 v1 + +const ( + // BackupNameLabel is the label key used to identify a backup by name. + BackupNameLabel = "velero.io/backup-name" + + // BackupUIDLabel is the label key used to identify a backup by uid. + BackupUIDLabel = "velero.io/backup-uid" + + // RestoreNameLabel is the label key used to identify a restore by name. + RestoreNameLabel = "velero.io/restore-name" + + // ScheduleNameLabel is the label key used to identify a schedule by name. + ScheduleNameLabel = "velero.io/schedule-name" + + // RestoreUIDLabel is the label key used to identify a restore by uid. + RestoreUIDLabel = "velero.io/restore-uid" + + // PodUIDLabel is the label key used to identify a pod by uid. + PodUIDLabel = "velero.io/pod-uid" + + // PVCUIDLabel is the label key used to identify a PVC by uid. + PVCUIDLabel = "velero.io/pvc-uid" + + // PodVolumeOperationTimeoutAnnotation is the annotation key used to apply + // a backup/restore-specific timeout value for pod volume operations (i.e. + // pod volume backups/restores). + PodVolumeOperationTimeoutAnnotation = "velero.io/pod-volume-timeout" + + // StorageLocationLabel is the label key used to identify the storage + // location of a backup. + StorageLocationLabel = "velero.io/storage-location" + + // VolumeNamespaceLabel is the label key used to identify which + // namespace a repository stores backups for. + VolumeNamespaceLabel = "velero.io/volume-namespace" + + // RepositoryTypeLabel is the label key used to identify the type of a repository + RepositoryTypeLabel = "velero.io/repository-type" + + // DataUploadLabel is the label key used to identify the dataupload for snapshot backup pod + DataUploadLabel = "velero.io/data-upload" + + // DataUploadSnapshotInfoLabel is used to identify the configmap that contains the snapshot info of a data upload + // normally the value of the label should the "true" or "false" + DataUploadSnapshotInfoLabel = "velero.io/data-upload-snapshot-info" + + // DataDownloadLabel is the label key used to identify the datadownload for snapshot restore pod + DataDownloadLabel = "velero.io/data-download" + + // SourceClusterK8sVersionAnnotation is the label key used to identify the k8s + // git version of the backup , i.e. v1.16.4 + SourceClusterK8sGitVersionAnnotation = "velero.io/source-cluster-k8s-gitversion" + + // SourceClusterK8sMajorVersionAnnotation is the label key used to identify the k8s + // major version of the backup , i.e. 1 + SourceClusterK8sMajorVersionAnnotation = "velero.io/source-cluster-k8s-major-version" + + // SourceClusterK8sMajorVersionAnnotation is the label key used to identify the k8s + // minor version of the backup , i.e. 16 + SourceClusterK8sMinorVersionAnnotation = "velero.io/source-cluster-k8s-minor-version" + + // ResourceTimeoutAnnotation is the annotation key used to carry the global resource + // timeout value for backup to plugins. + ResourceTimeoutAnnotation = "velero.io/resource-timeout" + + // AsyncOperationIDLabel is the label key used to identify the async operation ID + AsyncOperationIDLabel = "velero.io/async-operation-id" + + // PVCNameLabel is the label key used to identify the PVC's namespace and name. + // The format is /. + PVCNamespaceNameLabel = "velero.io/pvc-namespace-name" + + // ResourceUsageLabel is the label key to explain the Velero resource usage. + ResourceUsageLabel = "velero.io/resource-usage" + + // VolumesToBackupAnnotation is the annotation on a pod whose mounted volumes + // need to be backed up using pod volume backup. + VolumesToBackupAnnotation = "backup.velero.io/backup-volumes" + + // VolumesToExcludeAnnotation is the annotation on a pod whose mounted volumes + // should be excluded from pod volume backup. + VolumesToExcludeAnnotation = "backup.velero.io/backup-volumes-excludes" + + // ExcludeFromBackupLabel is the label to exclude k8s resource from backup, + // even if the resource contains a matching selector label. + ExcludeFromBackupLabel = "velero.io/exclude-from-backup" +) + +type AsyncOperationIDPrefix string + +const ( + AsyncOperationIDPrefixDataDownload AsyncOperationIDPrefix = "dd-" + AsyncOperationIDPrefixDataUpload AsyncOperationIDPrefix = "du-" +) + +type VeleroResourceUsage string + +const ( + VeleroResourceUsageDataUploadResult VeleroResourceUsage = "DataUpload" +) + +// CSI related plugin actions' constant variable +const ( + VolumeSnapshotLabel = "velero.io/volume-snapshot-name" + VolumeSnapshotHandleAnnotation = "velero.io/csi-volumesnapshot-handle" + VolumeSnapshotRestoreSize = "velero.io/csi-volumesnapshot-restore-size" + DriverNameAnnotation = "velero.io/csi-driver-name" + VSCDeletionPolicyAnnotation = "velero.io/csi-vsc-deletion-policy" + VolumeSnapshotClassSelectorLabel = "velero.io/csi-volumesnapshot-class" + VolumeSnapshotClassDriverBackupAnnotationPrefix = "velero.io/csi-volumesnapshot-class" + VolumeSnapshotClassDriverPVCAnnotation = "velero.io/csi-volumesnapshot-class" + + // There is no release w/ these constants exported. Using the strings for now. + // CSI Annotation volumesnapshotclass + // https://github.com/kubernetes-csi/external-snapshotter/blob/master/pkg/utils/util.go#L59-L60 + PrefixedListSecretNameAnnotation = "csi.storage.k8s.io/snapshotter-list-secret-name" // #nosec G101 + PrefixedListSecretNamespaceAnnotation = "csi.storage.k8s.io/snapshotter-list-secret-namespace" // #nosec G101 + + // CSI Annotation volumesnapshotcontents + PrefixedSecretNameAnnotation = "csi.storage.k8s.io/snapshotter-secret-name" // #nosec G101 + PrefixedSecretNamespaceAnnotation = "csi.storage.k8s.io/snapshotter-secret-namespace" // #nosec G101 + + // Velero checks this annotation to determine whether to skip resource excluding check. + MustIncludeAdditionalItemAnnotation = "backup.velero.io/must-include-additional-items" + // SkippedNoCSIPVAnnotation - Velero checks this annotation on processed PVC to + // find out if the snapshot was skipped b/c the PV is not provisioned via CSI + SkippedNoCSIPVAnnotation = "backup.velero.io/skipped-no-csi-pv" + + // DynamicPVRestoreLabel is the label key for dynamic PV restore + DynamicPVRestoreLabel = "velero.io/dynamic-pv-restore" + + // DataUploadNameAnnotation is the label key for the DataUpload name + DataUploadNameAnnotation = "velero.io/data-upload-name" +) diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/pod_volume_backup_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/pod_volume_backup_types.go new file mode 100644 index 000000000..b3070e3dd --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/pod_volume_backup_types.go @@ -0,0 +1,157 @@ +/* +Copyright The Velero Contributors. + +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 v1 + +import ( + corev1api "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/vmware-tanzu/velero/pkg/apis/velero/shared" +) + +// PodVolumeBackupSpec is the specification for a PodVolumeBackup. +type PodVolumeBackupSpec struct { + // Node is the name of the node that the Pod is running on. + Node string `json:"node"` + + // Pod is a reference to the pod containing the volume to be backed up. + Pod corev1api.ObjectReference `json:"pod"` + + // Volume is the name of the volume within the Pod to be backed + // up. + Volume string `json:"volume"` + + // BackupStorageLocation is the name of the backup storage location + // where the backup repository is stored. + BackupStorageLocation string `json:"backupStorageLocation"` + + // RepoIdentifier is the backup repository identifier. + RepoIdentifier string `json:"repoIdentifier"` + + // UploaderType is the type of the uploader to handle the data transfer. + // +kubebuilder:validation:Enum=kopia;restic;"" + // +optional + UploaderType string `json:"uploaderType"` + + // Tags are a map of key-value pairs that should be applied to the + // volume backup as tags. + // +optional + Tags map[string]string `json:"tags,omitempty"` + + // UploaderSettings are a map of key-value pairs that should be applied to the + // uploader configuration. + // +optional + // +nullable + UploaderSettings map[string]string `json:"uploaderSettings,omitempty"` +} + +// PodVolumeBackupPhase represents the lifecycle phase of a PodVolumeBackup. +// +kubebuilder:validation:Enum=New;InProgress;Completed;Failed +type PodVolumeBackupPhase string + +const ( + PodVolumeBackupPhaseNew PodVolumeBackupPhase = "New" + PodVolumeBackupPhaseInProgress PodVolumeBackupPhase = "InProgress" + PodVolumeBackupPhaseCompleted PodVolumeBackupPhase = "Completed" + PodVolumeBackupPhaseFailed PodVolumeBackupPhase = "Failed" +) + +// PodVolumeBackupStatus is the current status of a PodVolumeBackup. +type PodVolumeBackupStatus struct { + // Phase is the current state of the PodVolumeBackup. + // +optional + Phase PodVolumeBackupPhase `json:"phase,omitempty"` + + // Path is the full path within the controller pod being backed up. + // +optional + Path string `json:"path,omitempty"` + + // SnapshotID is the identifier for the snapshot of the pod volume. + // +optional + SnapshotID string `json:"snapshotID,omitempty"` + + // Message is a message about the pod volume backup's status. + // +optional + Message string `json:"message,omitempty"` + + // StartTimestamp records the time a backup was started. + // Separate from CreationTimestamp, since that value changes + // on restores. + // The server's time is used for StartTimestamps + // +optional + // +nullable + StartTimestamp *metav1.Time `json:"startTimestamp,omitempty"` + + // CompletionTimestamp records the time a backup was completed. + // Completion time is recorded even on failed backups. + // Completion time is recorded before uploading the backup object. + // The server's time is used for CompletionTimestamps + // +optional + // +nullable + CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"` + + // Progress holds the total number of bytes of the volume and the current + // number of backed up bytes. This can be used to display progress information + // about the backup operation. + // +optional + Progress shared.DataMoveOperationProgress `json:"progress,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runttime-controller client, +// the genclient and k8s:deepcopy markers will no longer be needed and should be removed. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Pod Volume Backup status such as New/InProgress" +// +kubebuilder:printcolumn:name="Created",type="date",JSONPath=".status.startTimestamp",description="Time when this backup was started" +// +kubebuilder:printcolumn:name="Namespace",type="string",JSONPath=".spec.pod.namespace",description="Namespace of the pod containing the volume to be backed up" +// +kubebuilder:printcolumn:name="Pod",type="string",JSONPath=".spec.pod.name",description="Name of the pod containing the volume to be backed up" +// +kubebuilder:printcolumn:name="Volume",type="string",JSONPath=".spec.volume",description="Name of the volume to be backed up" +// +kubebuilder:printcolumn:name="Uploader Type",type="string",JSONPath=".spec.uploaderType",description="The type of the uploader to handle data transfer" +// +kubebuilder:printcolumn:name="Storage Location",type="string",JSONPath=".spec.backupStorageLocation",description="Name of the Backup Storage Location where this backup should be stored" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:object:root=true +// +kubebuilder:object:generate=true + +type PodVolumeBackup struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec PodVolumeBackupSpec `json:"spec,omitempty"` + + // +optional + Status PodVolumeBackupStatus `json:"status,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runtime-controller client, +// the k8s:deepcopy marker will no longer be needed and should be removed. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:rbac:groups=velero.io,resources=podvolumebackups,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=velero.io,resources=podvolumebackups/status,verbs=get;update;patch + +// PodVolumeBackupList is a list of PodVolumeBackups. +type PodVolumeBackupList struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + Items []PodVolumeBackup `json:"items"` +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/pod_volume_restore_type.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/pod_volume_restore_type.go new file mode 100644 index 000000000..34bc7e530 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/pod_volume_restore_type.go @@ -0,0 +1,140 @@ +/* +Copyright 2018 the Velero contributors. + +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 v1 + +import ( + corev1api "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/vmware-tanzu/velero/pkg/apis/velero/shared" +) + +// PodVolumeRestoreSpec is the specification for a PodVolumeRestore. +type PodVolumeRestoreSpec struct { + // Pod is a reference to the pod containing the volume to be restored. + Pod corev1api.ObjectReference `json:"pod"` + + // Volume is the name of the volume within the Pod to be restored. + Volume string `json:"volume"` + + // BackupStorageLocation is the name of the backup storage location + // where the backup repository is stored. + BackupStorageLocation string `json:"backupStorageLocation"` + + // RepoIdentifier is the backup repository identifier. + RepoIdentifier string `json:"repoIdentifier"` + + // UploaderType is the type of the uploader to handle the data transfer. + // +kubebuilder:validation:Enum=kopia;restic;"" + // +optional + UploaderType string `json:"uploaderType"` + + // SnapshotID is the ID of the volume snapshot to be restored. + SnapshotID string `json:"snapshotID"` + + // SourceNamespace is the original namespace for namaspace mapping. + SourceNamespace string `json:"sourceNamespace"` + + // UploaderSettings are a map of key-value pairs that should be applied to the + // uploader configuration. + // +optional + // +nullable + UploaderSettings map[string]string `json:"uploaderSettings,omitempty"` +} + +// PodVolumeRestorePhase represents the lifecycle phase of a PodVolumeRestore. +// +kubebuilder:validation:Enum=New;InProgress;Completed;Failed +type PodVolumeRestorePhase string + +const ( + PodVolumeRestorePhaseNew PodVolumeRestorePhase = "New" + PodVolumeRestorePhaseInProgress PodVolumeRestorePhase = "InProgress" + PodVolumeRestorePhaseCompleted PodVolumeRestorePhase = "Completed" + PodVolumeRestorePhaseFailed PodVolumeRestorePhase = "Failed" +) + +// PodVolumeRestoreStatus is the current status of a PodVolumeRestore. +type PodVolumeRestoreStatus struct { + // Phase is the current state of the PodVolumeRestore. + // +optional + Phase PodVolumeRestorePhase `json:"phase,omitempty"` + + // Message is a message about the pod volume restore's status. + // +optional + Message string `json:"message,omitempty"` + + // StartTimestamp records the time a restore was started. + // The server's time is used for StartTimestamps + // +optional + // +nullable + StartTimestamp *metav1.Time `json:"startTimestamp,omitempty"` + + // CompletionTimestamp records the time a restore was completed. + // Completion time is recorded even on failed restores. + // The server's time is used for CompletionTimestamps + // +optional + // +nullable + CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"` + + // Progress holds the total number of bytes of the snapshot and the current + // number of restored bytes. This can be used to display progress information + // about the restore operation. + // +optional + Progress shared.DataMoveOperationProgress `json:"progress,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runtime-controller client, the genclient and k8s:deepcopy markers will no longer be needed and should be removed. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:generate=true +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Namespace",type="string",JSONPath=".spec.pod.namespace",description="Namespace of the pod containing the volume to be restored" +// +kubebuilder:printcolumn:name="Pod",type="string",JSONPath=".spec.pod.name",description="Name of the pod containing the volume to be restored" +// +kubebuilder:printcolumn:name="Uploader Type",type="string",JSONPath=".spec.uploaderType",description="The type of the uploader to handle data transfer" +// +kubebuilder:printcolumn:name="Volume",type="string",JSONPath=".spec.volume",description="Name of the volume to be restored" +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Pod Volume Restore status such as New/InProgress" +// +kubebuilder:printcolumn:name="TotalBytes",type="integer",format="int64",JSONPath=".status.progress.totalBytes",description="Pod Volume Restore status such as New/InProgress" +// +kubebuilder:printcolumn:name="BytesDone",type="integer",format="int64",JSONPath=".status.progress.bytesDone",description="Pod Volume Restore status such as New/InProgress" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" + +type PodVolumeRestore struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec PodVolumeRestoreSpec `json:"spec,omitempty"` + + // +optional + Status PodVolumeRestoreStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:generate=true +// +kubebuilder:object:root=true + +// PodVolumeRestoreList is a list of PodVolumeRestores. +type PodVolumeRestoreList struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + Items []PodVolumeRestore `json:"items"` +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/register.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/register.go new file mode 100644 index 000000000..cfcff670c --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/register.go @@ -0,0 +1,82 @@ +/* +Copyright 2017 the Velero contributors. + +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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/sets" +) + +// Resource gets a Velero GroupResource for a specified resource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +type typeInfo struct { + PluralName string + ItemType runtime.Object + ItemListType runtime.Object +} + +func newTypeInfo(pluralName string, itemType, itemListType runtime.Object) typeInfo { + return typeInfo{ + PluralName: pluralName, + ItemType: itemType, + ItemListType: itemListType, + } +} + +// CustomResources returns a map of all custom resources within the Velero +// API group, keyed on Kind. +func CustomResources() map[string]typeInfo { + return map[string]typeInfo{ + "Backup": newTypeInfo("backups", &Backup{}, &BackupList{}), + "Restore": newTypeInfo("restores", &Restore{}, &RestoreList{}), + "Schedule": newTypeInfo("schedules", &Schedule{}, &ScheduleList{}), + "DownloadRequest": newTypeInfo("downloadrequests", &DownloadRequest{}, &DownloadRequestList{}), + "DeleteBackupRequest": newTypeInfo("deletebackuprequests", &DeleteBackupRequest{}, &DeleteBackupRequestList{}), + "PodVolumeBackup": newTypeInfo("podvolumebackups", &PodVolumeBackup{}, &PodVolumeBackupList{}), + "PodVolumeRestore": newTypeInfo("podvolumerestores", &PodVolumeRestore{}, &PodVolumeRestoreList{}), + "BackupRepository": newTypeInfo("backuprepositories", &BackupRepository{}, &BackupRepositoryList{}), + "BackupStorageLocation": newTypeInfo("backupstoragelocations", &BackupStorageLocation{}, &BackupStorageLocationList{}), + "VolumeSnapshotLocation": newTypeInfo("volumesnapshotlocations", &VolumeSnapshotLocation{}, &VolumeSnapshotLocationList{}), + "ServerStatusRequest": newTypeInfo("serverstatusrequests", &ServerStatusRequest{}, &ServerStatusRequestList{}), + } +} + +// CustomResourceKinds returns a list of all custom resources kinds within the Velero +func CustomResourceKinds() sets.Set[string] { + kinds := sets.New[string]() + + resources := CustomResources() + for kind := range resources { + kinds.Insert(kind) + } + + return kinds +} + +func addKnownTypes(scheme *runtime.Scheme) error { + for _, typeInfo := range CustomResources() { + scheme.AddKnownTypes(SchemeGroupVersion, typeInfo.ItemType, typeInfo.ItemListType) + } + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/restore_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/restore_types.go new file mode 100644 index 000000000..377a92737 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/restore_types.go @@ -0,0 +1,433 @@ +/* +Copyright 2017, 2019 the Velero contributors. + +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 v1 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// RestoreSpec defines the specification for a Velero restore. +type RestoreSpec struct { + // BackupName is the unique name of the Velero backup to restore + // from. + // +optional + BackupName string `json:"backupName,omitempty"` + + // ScheduleName is the unique name of the Velero schedule to restore + // from. If specified, and BackupName is empty, Velero will restore + // from the most recent successful backup created from this schedule. + // +optional + ScheduleName string `json:"scheduleName,omitempty"` + + // IncludedNamespaces is a slice of namespace names to include objects + // from. If empty, all namespaces are included. + // +optional + // +nullable + IncludedNamespaces []string `json:"includedNamespaces,omitempty"` + + // ExcludedNamespaces contains a list of namespaces that are not + // included in the restore. + // +optional + // +nullable + ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"` + + // IncludedResources is a slice of resource names to include + // in the restore. If empty, all resources in the backup are included. + // +optional + // +nullable + IncludedResources []string `json:"includedResources,omitempty"` + + // ExcludedResources is a slice of resource names that are not + // included in the restore. + // +optional + // +nullable + ExcludedResources []string `json:"excludedResources,omitempty"` + + // NamespaceMapping is a map of source namespace names + // to target namespace names to restore into. Any source + // namespaces not included in the map will be restored into + // namespaces of the same name. + // +optional + NamespaceMapping map[string]string `json:"namespaceMapping,omitempty"` + + // LabelSelector is a metav1.LabelSelector to filter with + // when restoring individual objects from the backup. If empty + // or nil, all objects are included. Optional. + // +optional + // +nullable + LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"` + + // OrLabelSelectors is list of metav1.LabelSelector to filter with + // when restoring individual objects from the backup. If multiple provided + // they will be joined by the OR operator. LabelSelector as well as + // OrLabelSelectors cannot co-exist in restore request, only one of them + // can be used + // +optional + // +nullable + OrLabelSelectors []*metav1.LabelSelector `json:"orLabelSelectors,omitempty"` + + // RestorePVs specifies whether to restore all included + // PVs from snapshot + // +optional + // +nullable + RestorePVs *bool `json:"restorePVs,omitempty"` + + // RestoreStatus specifies which resources we should restore the status + // field. If nil, no objects are included. Optional. + // +optional + // +nullable + RestoreStatus *RestoreStatusSpec `json:"restoreStatus,omitempty"` + + // PreserveNodePorts specifies whether to restore old nodePorts from backup. + // +optional + // +nullable + PreserveNodePorts *bool `json:"preserveNodePorts,omitempty"` + + // IncludeClusterResources specifies whether cluster-scoped resources + // should be included for consideration in the restore. If null, defaults + // to true. + // +optional + // +nullable + IncludeClusterResources *bool `json:"includeClusterResources,omitempty"` + + // Hooks represent custom behaviors that should be executed during or post restore. + // +optional + Hooks RestoreHooks `json:"hooks,omitempty"` + + // ExistingResourcePolicy specifies the restore behavior for the Kubernetes resource to be restored + // +optional + // +nullable + ExistingResourcePolicy PolicyType `json:"existingResourcePolicy,omitempty"` + + // ItemOperationTimeout specifies the time used to wait for RestoreItemAction operations + // The default value is 4 hour. + // +optional + ItemOperationTimeout metav1.Duration `json:"itemOperationTimeout,omitempty"` + + // ResourceModifier specifies the reference to JSON resource patches that should be applied to resources before restoration. + // +optional + // +nullable + ResourceModifier *v1.TypedLocalObjectReference `json:"resourceModifier,omitempty"` + + // UploaderConfig specifies the configuration for the restore. + // +optional + // +nullable + UploaderConfig *UploaderConfigForRestore `json:"uploaderConfig,omitempty"` +} + +// UploaderConfigForRestore defines the configuration for the restore. +type UploaderConfigForRestore struct { + // WriteSparseFiles is a flag to indicate whether write files sparsely or not. + // +optional + // +nullable + WriteSparseFiles *bool `json:"writeSparseFiles,omitempty"` + // ParallelFilesDownload is the concurrency number setting for restore. + // +optional + ParallelFilesDownload int `json:"parallelFilesDownload,omitempty"` +} + +// RestoreHooks contains custom behaviors that should be executed during or post restore. +type RestoreHooks struct { + Resources []RestoreResourceHookSpec `json:"resources,omitempty"` +} + +type RestoreStatusSpec struct { + // IncludedResources specifies the resources to which will restore the status. + // If empty, it applies to all resources. + // +optional + // +nullable + IncludedResources []string `json:"includedResources,omitempty"` + + // ExcludedResources specifies the resources to which will not restore the status. + // +optional + // +nullable + ExcludedResources []string `json:"excludedResources,omitempty"` +} + +// RestoreResourceHookSpec defines one or more RestoreResrouceHooks that should be executed based on +// the rules defined for namespaces, resources, and label selector. +type RestoreResourceHookSpec struct { + // Name is the name of this hook. + Name string `json:"name"` + + // IncludedNamespaces specifies the namespaces to which this hook spec applies. If empty, it applies + // to all namespaces. + // +optional + // +nullable + IncludedNamespaces []string `json:"includedNamespaces,omitempty"` + + // ExcludedNamespaces specifies the namespaces to which this hook spec does not apply. + // +optional + // +nullable + ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"` + + // IncludedResources specifies the resources to which this hook spec applies. If empty, it applies + // to all resources. + // +optional + // +nullable + IncludedResources []string `json:"includedResources,omitempty"` + + // ExcludedResources specifies the resources to which this hook spec does not apply. + // +optional + // +nullable + ExcludedResources []string `json:"excludedResources,omitempty"` + + // LabelSelector, if specified, filters the resources to which this hook spec applies. + // +optional + // +nullable + LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"` + + // PostHooks is a list of RestoreResourceHooks to execute during and after restoring a resource. + // +optional + PostHooks []RestoreResourceHook `json:"postHooks,omitempty"` +} + +// RestoreResourceHook defines a restore hook for a resource. +type RestoreResourceHook struct { + // Exec defines an exec restore hook. + Exec *ExecRestoreHook `json:"exec,omitempty"` + + // Init defines an init restore hook. + Init *InitRestoreHook `json:"init,omitempty"` +} + +// ExecRestoreHook is a hook that uses pod exec API to execute a command inside a container in a pod +type ExecRestoreHook struct { + // Container is the container in the pod where the command should be executed. If not specified, + // the pod's first container is used. + // +optional + Container string `json:"container,omitempty"` + + // Command is the command and arguments to execute from within a container after a pod has been restored. + // +kubebuilder:validation:MinItems=1 + Command []string `json:"command"` + + // OnError specifies how Velero should behave if it encounters an error executing this hook. + // +optional + OnError HookErrorMode `json:"onError,omitempty"` + + // ExecTimeout defines the maximum amount of time Velero should wait for the hook to complete before + // considering the execution a failure. + // +optional + ExecTimeout metav1.Duration `json:"execTimeout,omitempty"` + + // WaitTimeout defines the maximum amount of time Velero should wait for the container to be Ready + // before attempting to run the command. + // +optional + WaitTimeout metav1.Duration `json:"waitTimeout,omitempty"` + + // WaitForReady ensures command will be launched when container is Ready instead of Running. + // +optional + // +nullable + WaitForReady *bool `json:"waitForReady,omitempty"` +} + +// InitRestoreHook is a hook that adds an init container to a PodSpec to run commands before the +// workload pod is able to start. +type InitRestoreHook struct { + // +kubebuilder:pruning:PreserveUnknownFields + // InitContainers is list of init containers to be added to a pod during its restore. + // +optional + InitContainers []runtime.RawExtension `json:"initContainers"` + + // Timeout defines the maximum amount of time Velero should wait for the initContainers to complete. + // +optional + Timeout metav1.Duration `json:"timeout,omitempty"` +} + +// RestorePhase is a string representation of the lifecycle phase +// of a Velero restore +// +kubebuilder:validation:Enum=New;FailedValidation;InProgress;WaitingForPluginOperations;WaitingForPluginOperationsPartiallyFailed;Completed;PartiallyFailed;Failed;Finalizing;FinalizingPartiallyFailed +type RestorePhase string + +const ( + // RestorePhaseNew means the restore has been created but not + // yet processed by the RestoreController + RestorePhaseNew RestorePhase = "New" + + // RestorePhaseFailedValidation means the restore has failed + // the controller's validations and therefore will not run. + RestorePhaseFailedValidation RestorePhase = "FailedValidation" + + // RestorePhaseInProgress means the restore is currently executing. + RestorePhaseInProgress RestorePhase = "InProgress" + + // RestorePhaseWaitingForPluginOperations means the restore of + // Kubernetes resources and other async plugin operations was + // successful and plugin operations are still ongoing. The + // restore is not complete yet. + RestorePhaseWaitingForPluginOperations RestorePhase = "WaitingForPluginOperations" + + // RestorePhaseWaitingForPluginOperationsPartiallyFailed means + // the restore of Kubernetes resources and other async plugin + // operations partially failed (final phase will be + // PartiallyFailed) and other plugin operations are still + // ongoing. The restore is not complete yet. + RestorePhaseWaitingForPluginOperationsPartiallyFailed RestorePhase = "WaitingForPluginOperationsPartiallyFailed" + + // RestorePhaseFinalizing means the restore of + // Kubernetes resources and other async plugin operations were successful and + // other plugin operations are now complete, but the restore is awaiting + // the completion of wrap-up tasks before the restore process enters terminal phase. + RestorePhaseFinalizing RestorePhase = "Finalizing" + + // RestorePhaseFinalizingPartiallyFailed means the restore of + // Kubernetes resources and other async plugin operations were successful and + // other plugin operations are now complete, but one or more errors + // occurred during restore or async operation processing. The restore is awaiting + // the completion of wrap-up tasks before the restore process enters terminal phase. + RestorePhaseFinalizingPartiallyFailed RestorePhase = "FinalizingPartiallyFailed" + + // RestorePhaseCompleted means the restore has run successfully + // without errors. + RestorePhaseCompleted RestorePhase = "Completed" + + // RestorePhasePartiallyFailed means the restore has run to completion + // but encountered 1+ errors restoring individual items. + RestorePhasePartiallyFailed RestorePhase = "PartiallyFailed" + + // RestorePhaseFailed means the restore was unable to execute. + // The failing error is recorded in status.FailureReason. + RestorePhaseFailed RestorePhase = "Failed" + + // PolicyTypeNone means velero will not overwrite the resource + // in cluster with the one in backup whether changed/unchanged. + PolicyTypeNone PolicyType = "none" + + // PolicyTypeUpdate means velero will try to attempt a patch on + // the changed resources. + PolicyTypeUpdate PolicyType = "update" +) + +// RestoreStatus captures the current status of a Velero restore +type RestoreStatus struct { + // Phase is the current state of the Restore + // +optional + Phase RestorePhase `json:"phase,omitempty"` + + // ValidationErrors is a slice of all validation errors (if + // applicable) + // +optional + // +nullable + ValidationErrors []string `json:"validationErrors,omitempty"` + + // Warnings is a count of all warning messages that were generated during + // execution of the restore. The actual warnings are stored in object storage. + // +optional + Warnings int `json:"warnings,omitempty"` + + // Errors is a count of all error messages that were generated during + // execution of the restore. The actual errors are stored in object storage. + // +optional + Errors int `json:"errors,omitempty"` + + // FailureReason is an error that caused the entire restore to fail. + // +optional + FailureReason string `json:"failureReason,omitempty"` + + // StartTimestamp records the time the restore operation was started. + // The server's time is used for StartTimestamps + // +optional + // +nullable + StartTimestamp *metav1.Time `json:"startTimestamp,omitempty"` + + // CompletionTimestamp records the time the restore operation was completed. + // Completion time is recorded even on failed restore. + // The server's time is used for StartTimestamps + // +optional + // +nullable + CompletionTimestamp *metav1.Time `json:"completionTimestamp,omitempty"` + + // Progress contains information about the restore's execution progress. Note + // that this information is best-effort only -- if Velero fails to update it + // during a restore for any reason, it may be inaccurate/stale. + // +optional + // +nullable + Progress *RestoreProgress `json:"progress,omitempty"` + + // RestoreItemOperationsAttempted is the total number of attempted + // async RestoreItemAction operations for this restore. + // +optional + RestoreItemOperationsAttempted int `json:"restoreItemOperationsAttempted,omitempty"` + + // RestoreItemOperationsCompleted is the total number of successfully completed + // async RestoreItemAction operations for this restore. + // +optional + RestoreItemOperationsCompleted int `json:"restoreItemOperationsCompleted,omitempty"` + + // RestoreItemOperationsFailed is the total number of async + // RestoreItemAction operations for this restore which ended with an error. + // +optional + RestoreItemOperationsFailed int `json:"restoreItemOperationsFailed,omitempty"` + + // HookStatus contains information about the status of the hooks. + // +optional + // +nullable + HookStatus *HookStatus `json:"hookStatus,omitempty"` +} + +// RestoreProgress stores information about the restore's execution progress +type RestoreProgress struct { + // TotalItems is the total number of items to be restored. This number may change + // throughout the execution of the restore due to plugins that return additional related + // items to restore + // +optional + TotalItems int `json:"totalItems,omitempty"` + // ItemsRestored is the number of items that have actually been restored so far + // +optional + ItemsRestored int `json:"itemsRestored,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:object:generate=true +// +kubebuilder:storageversion +// +kubebuilder:rbac:groups=velero.io,resources=restores,verbs=create;delete;get;list;patch;update;watch +// +kubebuilder:rbac:groups=velero.io,resources=restores/status,verbs=get;update;patch + +// Restore is a Velero resource that represents the application of +// resources from a Velero backup to a target Kubernetes cluster. +type Restore struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec RestoreSpec `json:"spec,omitempty"` + + // +optional + Status RestoreStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// RestoreList is a list of Restores. +type RestoreList struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ListMeta `json:"metadata"` + + Items []Restore `json:"items"` +} + +// PolicyType helps specify the ExistingResourcePolicy +type PolicyType string diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/schedule_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/schedule_types.go new file mode 100644 index 000000000..6a5f885ab --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/schedule_types.go @@ -0,0 +1,140 @@ +/* +Copyright 2020 the Velero contributors. + +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 v1 + +import ( + "fmt" + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ScheduleSpec defines the specification for a Velero schedule +type ScheduleSpec struct { + // Template is the definition of the Backup to be run + // on the provided schedule + Template BackupSpec `json:"template"` + + // Schedule is a Cron expression defining when to run + // the Backup. + Schedule string `json:"schedule"` + + // UseOwnerReferencesBackup specifies whether to use + // OwnerReferences on backups created by this Schedule. + // +optional + // +nullable + UseOwnerReferencesInBackup *bool `json:"useOwnerReferencesInBackup,omitempty"` + + // Paused specifies whether the schedule is paused or not + // +optional + Paused bool `json:"paused,omitempty"` + + // SkipImmediately specifies whether to skip backup if schedule is due immediately from `schedule.status.lastBackup` timestamp when schedule is unpaused or if schedule is new. + // If true, backup will be skipped immediately when schedule is unpaused if it is due based on .Status.LastBackupTimestamp or schedule is new, and will run at next schedule time. + // If false, backup will not be skipped immediately when schedule is unpaused, but will run at next schedule time. + // If empty, will follow server configuration (default: false). + // +optional + SkipImmediately *bool `json:"skipImmediately,omitempty"` +} + +// SchedulePhase is a string representation of the lifecycle phase +// of a Velero schedule +// +kubebuilder:validation:Enum=New;Enabled;FailedValidation +type SchedulePhase string + +const ( + // SchedulePhaseNew means the schedule has been created but not + // yet processed by the ScheduleController + SchedulePhaseNew SchedulePhase = "New" + + // SchedulePhaseEnabled means the schedule has been validated and + // will now be triggering backups according to the schedule spec. + SchedulePhaseEnabled SchedulePhase = "Enabled" + + // SchedulePhaseFailedValidation means the schedule has failed + // the controller's validations and therefore will not trigger backups. + SchedulePhaseFailedValidation SchedulePhase = "FailedValidation" +) + +// ScheduleStatus captures the current state of a Velero schedule +type ScheduleStatus struct { + // Phase is the current phase of the Schedule + // +optional + Phase SchedulePhase `json:"phase,omitempty"` + + // LastBackup is the last time a Backup was run for this + // Schedule schedule + // +optional + // +nullable + LastBackup *metav1.Time `json:"lastBackup,omitempty"` + + // LastSkipped is the last time a Schedule was skipped + // +optional + // +nullable + LastSkipped *metav1.Time `json:"lastSkipped,omitempty"` + + // ValidationErrors is a slice of all validation errors (if + // applicable) + // +optional + ValidationErrors []string `json:"validationErrors,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runtime-controller client, the genclient and k8s:deepcopy markers will no longer be needed and should be removed. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:generate=true +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Status of the schedule" +// +kubebuilder:printcolumn:name="Schedule",type="string",JSONPath=".spec.schedule",description="A Cron expression defining when to run the Backup" +// +kubebuilder:printcolumn:name="LastBackup",type="date",JSONPath=".status.lastBackup",description="The last time a Backup was run for this schedule" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:printcolumn:name="Paused",type="boolean",JSONPath=".spec.paused" + +// Schedule is a Velero resource that represents a pre-scheduled or +// periodic Backup that should be run. +type Schedule struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata"` + + // +optional + Spec ScheduleSpec `json:"spec,omitempty"` + + // +optional + Status ScheduleStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:generate=true +// +kubebuilder:object:root=true + +// ScheduleList is a list of Schedules. +type ScheduleList struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + Items []Schedule `json:"items"` +} + +// TimestampedName returns the default backup name format based on the schedule +func (s *Schedule) TimestampedName(timestamp time.Time) string { + return fmt.Sprintf("%s-%s", s.Name, timestamp.Format("20060102150405")) +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/server_status_request_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/server_status_request_types.go new file mode 100644 index 000000000..98e15a0b5 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/server_status_request_types.go @@ -0,0 +1,105 @@ +/* +Copyright 2020 the Velero contributors. + +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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TODO(2.0) After converting all resources to use the runtime-controller client, +// the genclient and k8s:deepcopy markers will no longer be needed and should be removed. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:resource:shortName=ssr +// +kubebuilder:object:generate=true +// +kubebuilder:storageversion + +// ServerStatusRequest is a request to access current status information about +// the Velero server. +type ServerStatusRequest struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec ServerStatusRequestSpec `json:"spec,omitempty"` + + // +optional + Status ServerStatusRequestStatus `json:"status,omitempty"` +} + +// ServerStatusRequestSpec is the specification for a ServerStatusRequest. +type ServerStatusRequestSpec struct { +} + +// ServerStatusRequestPhase represents the lifecycle phase of a ServerStatusRequest. +// +kubebuilder:validation:Enum=New;Processed +type ServerStatusRequestPhase string + +const ( + // ServerStatusRequestPhaseNew means the ServerStatusRequest has not been processed yet. + ServerStatusRequestPhaseNew ServerStatusRequestPhase = "New" + // ServerStatusRequestPhaseProcessed means the ServerStatusRequest has been processed. + ServerStatusRequestPhaseProcessed ServerStatusRequestPhase = "Processed" +) + +// PluginInfo contains attributes of a Velero plugin +type PluginInfo struct { + Name string `json:"name"` + Kind string `json:"kind"` +} + +// ServerStatusRequestStatus is the current status of a ServerStatusRequest. +type ServerStatusRequestStatus struct { + // Phase is the current lifecycle phase of the ServerStatusRequest. + // +optional + Phase ServerStatusRequestPhase `json:"phase,omitempty"` + + // ProcessedTimestamp is when the ServerStatusRequest was processed + // by the ServerStatusRequestController. + // +optional + // +nullable + ProcessedTimestamp *metav1.Time `json:"processedTimestamp,omitempty"` + + // ServerVersion is the Velero server version. + // +optional + ServerVersion string `json:"serverVersion,omitempty"` + + // Plugins list information about the plugins running on the Velero server + // +optional + // +nullable + Plugins []PluginInfo `json:"plugins,omitempty"` +} + +// TODO(2.0) After converting all resources to use the runtime-controller client, +// the k8s:deepcopy marker will no longer be needed and should be removed. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:rbac:groups=velero.io,resources=serverstatusrequests,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=velero.io,resources=serverstatusrequests/status,verbs=get;update;patch + +// ServerStatusRequestList is a list of ServerStatusRequests. +type ServerStatusRequestList struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + Items []ServerStatusRequest `json:"items"` +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/volume_snapshot_location_type.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/volume_snapshot_location_type.go new file mode 100644 index 000000000..836701b77 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/volume_snapshot_location_type.go @@ -0,0 +1,89 @@ +/* +Copyright the Velero contributors. + +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 v1 + +import ( + corev1api "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:resource:shortName=vsl +// +kubebuilder:object:generate=true +// +kubebuilder:storageversion + +// VolumeSnapshotLocation is a location where Velero stores volume snapshots. +type VolumeSnapshotLocation struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +optional + Spec VolumeSnapshotLocationSpec `json:"spec,omitempty"` + + // +optional + Status VolumeSnapshotLocationStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:rbac:groups=velero.io,resources=volumesnapshotlocations,verbs=get;list;watch;create;update;patch;delete + +// VolumeSnapshotLocationList is a list of VolumeSnapshotLocations. +type VolumeSnapshotLocationList struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ListMeta `json:"metadata,omitempty"` + + Items []VolumeSnapshotLocation `json:"items"` +} + +// VolumeSnapshotLocationSpec defines the specification for a Velero VolumeSnapshotLocation. +type VolumeSnapshotLocationSpec struct { + // Provider is the provider of the volume storage. + Provider string `json:"provider"` + + // Config is for provider-specific configuration fields. + // +optional + Config map[string]string `json:"config,omitempty"` + + // Credential contains the credential information intended to be used with this location + // +optional + Credential *corev1api.SecretKeySelector `json:"credential,omitempty"` +} + +// VolumeSnapshotLocationPhase is the lifecycle phase of a Velero VolumeSnapshotLocation. +// +kubebuilder:validation:Enum=Available;Unavailable +type VolumeSnapshotLocationPhase string + +const ( + // VolumeSnapshotLocationPhaseAvailable means the location is available to read and write from. + VolumeSnapshotLocationPhaseAvailable VolumeSnapshotLocationPhase = "Available" + + // VolumeSnapshotLocationPhaseUnavailable means the location is unavailable to read and write from. + VolumeSnapshotLocationPhaseUnavailable VolumeSnapshotLocationPhase = "Unavailable" +) + +// VolumeSnapshotLocationStatus describes the current status of a Velero VolumeSnapshotLocation. +type VolumeSnapshotLocationStatus struct { + // +optional + Phase VolumeSnapshotLocationPhase `json:"phase,omitempty"` +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/zz_generated.deepcopy.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/zz_generated.deepcopy.go new file mode 100644 index 000000000..522e15105 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1/zz_generated.deepcopy.go @@ -0,0 +1,1813 @@ +//go:build !ignore_autogenerated + +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Backup) DeepCopyInto(out *Backup) { + *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 Backup. +func (in *Backup) DeepCopy() *Backup { + if in == nil { + return nil + } + out := new(Backup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Backup) 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 *BackupHooks) DeepCopyInto(out *BackupHooks) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]BackupResourceHookSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupHooks. +func (in *BackupHooks) DeepCopy() *BackupHooks { + if in == nil { + return nil + } + out := new(BackupHooks) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupList) DeepCopyInto(out *BackupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Backup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupList. +func (in *BackupList) DeepCopy() *BackupList { + if in == nil { + return nil + } + out := new(BackupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackupList) 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 *BackupProgress) DeepCopyInto(out *BackupProgress) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupProgress. +func (in *BackupProgress) DeepCopy() *BackupProgress { + if in == nil { + return nil + } + out := new(BackupProgress) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupRepository) DeepCopyInto(out *BackupRepository) { + *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 BackupRepository. +func (in *BackupRepository) DeepCopy() *BackupRepository { + if in == nil { + return nil + } + out := new(BackupRepository) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackupRepository) 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 *BackupRepositoryList) DeepCopyInto(out *BackupRepositoryList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BackupRepository, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupRepositoryList. +func (in *BackupRepositoryList) DeepCopy() *BackupRepositoryList { + if in == nil { + return nil + } + out := new(BackupRepositoryList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackupRepositoryList) 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 *BackupRepositorySpec) DeepCopyInto(out *BackupRepositorySpec) { + *out = *in + out.MaintenanceFrequency = in.MaintenanceFrequency +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupRepositorySpec. +func (in *BackupRepositorySpec) DeepCopy() *BackupRepositorySpec { + if in == nil { + return nil + } + out := new(BackupRepositorySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupRepositoryStatus) DeepCopyInto(out *BackupRepositoryStatus) { + *out = *in + if in.LastMaintenanceTime != nil { + in, out := &in.LastMaintenanceTime, &out.LastMaintenanceTime + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupRepositoryStatus. +func (in *BackupRepositoryStatus) DeepCopy() *BackupRepositoryStatus { + if in == nil { + return nil + } + out := new(BackupRepositoryStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupResourceHook) DeepCopyInto(out *BackupResourceHook) { + *out = *in + if in.Exec != nil { + in, out := &in.Exec, &out.Exec + *out = new(ExecHook) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupResourceHook. +func (in *BackupResourceHook) DeepCopy() *BackupResourceHook { + if in == nil { + return nil + } + out := new(BackupResourceHook) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupResourceHookSpec) DeepCopyInto(out *BackupResourceHookSpec) { + *out = *in + if in.IncludedNamespaces != nil { + in, out := &in.IncludedNamespaces, &out.IncludedNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedNamespaces != nil { + in, out := &in.ExcludedNamespaces, &out.ExcludedNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.IncludedResources != nil { + in, out := &in.IncludedResources, &out.IncludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedResources != nil { + in, out := &in.ExcludedResources, &out.ExcludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.LabelSelector != nil { + in, out := &in.LabelSelector, &out.LabelSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.PreHooks != nil { + in, out := &in.PreHooks, &out.PreHooks + *out = make([]BackupResourceHook, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PostHooks != nil { + in, out := &in.PostHooks, &out.PostHooks + *out = make([]BackupResourceHook, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupResourceHookSpec. +func (in *BackupResourceHookSpec) DeepCopy() *BackupResourceHookSpec { + if in == nil { + return nil + } + out := new(BackupResourceHookSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupSpec) DeepCopyInto(out *BackupSpec) { + *out = *in + in.Metadata.DeepCopyInto(&out.Metadata) + if in.IncludedNamespaces != nil { + in, out := &in.IncludedNamespaces, &out.IncludedNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedNamespaces != nil { + in, out := &in.ExcludedNamespaces, &out.ExcludedNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.IncludedResources != nil { + in, out := &in.IncludedResources, &out.IncludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedResources != nil { + in, out := &in.ExcludedResources, &out.ExcludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.IncludedClusterScopedResources != nil { + in, out := &in.IncludedClusterScopedResources, &out.IncludedClusterScopedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedClusterScopedResources != nil { + in, out := &in.ExcludedClusterScopedResources, &out.ExcludedClusterScopedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.IncludedNamespaceScopedResources != nil { + in, out := &in.IncludedNamespaceScopedResources, &out.IncludedNamespaceScopedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedNamespaceScopedResources != nil { + in, out := &in.ExcludedNamespaceScopedResources, &out.ExcludedNamespaceScopedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.LabelSelector != nil { + in, out := &in.LabelSelector, &out.LabelSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.OrLabelSelectors != nil { + in, out := &in.OrLabelSelectors, &out.OrLabelSelectors + *out = make([]*metav1.LabelSelector, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + } + if in.SnapshotVolumes != nil { + in, out := &in.SnapshotVolumes, &out.SnapshotVolumes + *out = new(bool) + **out = **in + } + out.TTL = in.TTL + if in.IncludeClusterResources != nil { + in, out := &in.IncludeClusterResources, &out.IncludeClusterResources + *out = new(bool) + **out = **in + } + in.Hooks.DeepCopyInto(&out.Hooks) + if in.VolumeSnapshotLocations != nil { + in, out := &in.VolumeSnapshotLocations, &out.VolumeSnapshotLocations + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.DefaultVolumesToRestic != nil { + in, out := &in.DefaultVolumesToRestic, &out.DefaultVolumesToRestic + *out = new(bool) + **out = **in + } + if in.DefaultVolumesToFsBackup != nil { + in, out := &in.DefaultVolumesToFsBackup, &out.DefaultVolumesToFsBackup + *out = new(bool) + **out = **in + } + if in.OrderedResources != nil { + in, out := &in.OrderedResources, &out.OrderedResources + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + out.CSISnapshotTimeout = in.CSISnapshotTimeout + out.ItemOperationTimeout = in.ItemOperationTimeout + if in.ResourcePolicy != nil { + in, out := &in.ResourcePolicy, &out.ResourcePolicy + *out = new(corev1.TypedLocalObjectReference) + (*in).DeepCopyInto(*out) + } + if in.SnapshotMoveData != nil { + in, out := &in.SnapshotMoveData, &out.SnapshotMoveData + *out = new(bool) + **out = **in + } + if in.UploaderConfig != nil { + in, out := &in.UploaderConfig, &out.UploaderConfig + *out = new(UploaderConfigForBackup) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupSpec. +func (in *BackupSpec) DeepCopy() *BackupSpec { + if in == nil { + return nil + } + out := new(BackupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupStatus) DeepCopyInto(out *BackupStatus) { + *out = *in + if in.Expiration != nil { + in, out := &in.Expiration, &out.Expiration + *out = (*in).DeepCopy() + } + if in.ValidationErrors != nil { + in, out := &in.ValidationErrors, &out.ValidationErrors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.StartTimestamp != nil { + in, out := &in.StartTimestamp, &out.StartTimestamp + *out = (*in).DeepCopy() + } + if in.CompletionTimestamp != nil { + in, out := &in.CompletionTimestamp, &out.CompletionTimestamp + *out = (*in).DeepCopy() + } + if in.Progress != nil { + in, out := &in.Progress, &out.Progress + *out = new(BackupProgress) + **out = **in + } + if in.HookStatus != nil { + in, out := &in.HookStatus, &out.HookStatus + *out = new(HookStatus) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupStatus. +func (in *BackupStatus) DeepCopy() *BackupStatus { + if in == nil { + return nil + } + out := new(BackupStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupStorageLocation) DeepCopyInto(out *BackupStorageLocation) { + *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 BackupStorageLocation. +func (in *BackupStorageLocation) DeepCopy() *BackupStorageLocation { + if in == nil { + return nil + } + out := new(BackupStorageLocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackupStorageLocation) 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 *BackupStorageLocationList) DeepCopyInto(out *BackupStorageLocationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BackupStorageLocation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupStorageLocationList. +func (in *BackupStorageLocationList) DeepCopy() *BackupStorageLocationList { + if in == nil { + return nil + } + out := new(BackupStorageLocationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackupStorageLocationList) 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 *BackupStorageLocationSpec) DeepCopyInto(out *BackupStorageLocationSpec) { + *out = *in + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Credential != nil { + in, out := &in.Credential, &out.Credential + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + in.StorageType.DeepCopyInto(&out.StorageType) + if in.BackupSyncPeriod != nil { + in, out := &in.BackupSyncPeriod, &out.BackupSyncPeriod + *out = new(metav1.Duration) + **out = **in + } + if in.ValidationFrequency != nil { + in, out := &in.ValidationFrequency, &out.ValidationFrequency + *out = new(metav1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupStorageLocationSpec. +func (in *BackupStorageLocationSpec) DeepCopy() *BackupStorageLocationSpec { + if in == nil { + return nil + } + out := new(BackupStorageLocationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupStorageLocationStatus) DeepCopyInto(out *BackupStorageLocationStatus) { + *out = *in + if in.LastSyncedTime != nil { + in, out := &in.LastSyncedTime, &out.LastSyncedTime + *out = (*in).DeepCopy() + } + if in.LastValidationTime != nil { + in, out := &in.LastValidationTime, &out.LastValidationTime + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupStorageLocationStatus. +func (in *BackupStorageLocationStatus) DeepCopy() *BackupStorageLocationStatus { + if in == nil { + return nil + } + out := new(BackupStorageLocationStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeleteBackupRequest) DeepCopyInto(out *DeleteBackupRequest) { + *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 DeleteBackupRequest. +func (in *DeleteBackupRequest) DeepCopy() *DeleteBackupRequest { + if in == nil { + return nil + } + out := new(DeleteBackupRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeleteBackupRequest) 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 *DeleteBackupRequestList) DeepCopyInto(out *DeleteBackupRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DeleteBackupRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeleteBackupRequestList. +func (in *DeleteBackupRequestList) DeepCopy() *DeleteBackupRequestList { + if in == nil { + return nil + } + out := new(DeleteBackupRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeleteBackupRequestList) 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 *DeleteBackupRequestSpec) DeepCopyInto(out *DeleteBackupRequestSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeleteBackupRequestSpec. +func (in *DeleteBackupRequestSpec) DeepCopy() *DeleteBackupRequestSpec { + if in == nil { + return nil + } + out := new(DeleteBackupRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeleteBackupRequestStatus) DeepCopyInto(out *DeleteBackupRequestStatus) { + *out = *in + if in.Errors != nil { + in, out := &in.Errors, &out.Errors + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeleteBackupRequestStatus. +func (in *DeleteBackupRequestStatus) DeepCopy() *DeleteBackupRequestStatus { + if in == nil { + return nil + } + out := new(DeleteBackupRequestStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DownloadRequest) DeepCopyInto(out *DownloadRequest) { + *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 DownloadRequest. +func (in *DownloadRequest) DeepCopy() *DownloadRequest { + if in == nil { + return nil + } + out := new(DownloadRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DownloadRequest) 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 *DownloadRequestList) DeepCopyInto(out *DownloadRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DownloadRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DownloadRequestList. +func (in *DownloadRequestList) DeepCopy() *DownloadRequestList { + if in == nil { + return nil + } + out := new(DownloadRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DownloadRequestList) 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 *DownloadRequestSpec) DeepCopyInto(out *DownloadRequestSpec) { + *out = *in + out.Target = in.Target +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DownloadRequestSpec. +func (in *DownloadRequestSpec) DeepCopy() *DownloadRequestSpec { + if in == nil { + return nil + } + out := new(DownloadRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DownloadRequestStatus) DeepCopyInto(out *DownloadRequestStatus) { + *out = *in + if in.Expiration != nil { + in, out := &in.Expiration, &out.Expiration + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DownloadRequestStatus. +func (in *DownloadRequestStatus) DeepCopy() *DownloadRequestStatus { + if in == nil { + return nil + } + out := new(DownloadRequestStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DownloadTarget) DeepCopyInto(out *DownloadTarget) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DownloadTarget. +func (in *DownloadTarget) DeepCopy() *DownloadTarget { + if in == nil { + return nil + } + out := new(DownloadTarget) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecHook) DeepCopyInto(out *ExecHook) { + *out = *in + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = make([]string, len(*in)) + copy(*out, *in) + } + out.Timeout = in.Timeout +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecHook. +func (in *ExecHook) DeepCopy() *ExecHook { + if in == nil { + return nil + } + out := new(ExecHook) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecRestoreHook) DeepCopyInto(out *ExecRestoreHook) { + *out = *in + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = make([]string, len(*in)) + copy(*out, *in) + } + out.ExecTimeout = in.ExecTimeout + out.WaitTimeout = in.WaitTimeout + if in.WaitForReady != nil { + in, out := &in.WaitForReady, &out.WaitForReady + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecRestoreHook. +func (in *ExecRestoreHook) DeepCopy() *ExecRestoreHook { + if in == nil { + return nil + } + out := new(ExecRestoreHook) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HookStatus) DeepCopyInto(out *HookStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HookStatus. +func (in *HookStatus) DeepCopy() *HookStatus { + if in == nil { + return nil + } + out := new(HookStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InitRestoreHook) DeepCopyInto(out *InitRestoreHook) { + *out = *in + if in.InitContainers != nil { + in, out := &in.InitContainers, &out.InitContainers + *out = make([]runtime.RawExtension, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + out.Timeout = in.Timeout +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InitRestoreHook. +func (in *InitRestoreHook) DeepCopy() *InitRestoreHook { + if in == nil { + return nil + } + out := new(InitRestoreHook) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Metadata) DeepCopyInto(out *Metadata) { + *out = *in + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *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 Metadata. +func (in *Metadata) DeepCopy() *Metadata { + if in == nil { + return nil + } + out := new(Metadata) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ObjectStorageLocation) DeepCopyInto(out *ObjectStorageLocation) { + *out = *in + if in.CACert != nil { + in, out := &in.CACert, &out.CACert + *out = make([]byte, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectStorageLocation. +func (in *ObjectStorageLocation) DeepCopy() *ObjectStorageLocation { + if in == nil { + return nil + } + out := new(ObjectStorageLocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PluginInfo) DeepCopyInto(out *PluginInfo) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PluginInfo. +func (in *PluginInfo) DeepCopy() *PluginInfo { + if in == nil { + return nil + } + out := new(PluginInfo) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodVolumeBackup) DeepCopyInto(out *PodVolumeBackup) { + *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 PodVolumeBackup. +func (in *PodVolumeBackup) DeepCopy() *PodVolumeBackup { + if in == nil { + return nil + } + out := new(PodVolumeBackup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodVolumeBackup) 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 *PodVolumeBackupList) DeepCopyInto(out *PodVolumeBackupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PodVolumeBackup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodVolumeBackupList. +func (in *PodVolumeBackupList) DeepCopy() *PodVolumeBackupList { + if in == nil { + return nil + } + out := new(PodVolumeBackupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodVolumeBackupList) 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 *PodVolumeBackupSpec) DeepCopyInto(out *PodVolumeBackupSpec) { + *out = *in + out.Pod = in.Pod + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.UploaderSettings != nil { + in, out := &in.UploaderSettings, &out.UploaderSettings + *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 PodVolumeBackupSpec. +func (in *PodVolumeBackupSpec) DeepCopy() *PodVolumeBackupSpec { + if in == nil { + return nil + } + out := new(PodVolumeBackupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodVolumeBackupStatus) DeepCopyInto(out *PodVolumeBackupStatus) { + *out = *in + if in.StartTimestamp != nil { + in, out := &in.StartTimestamp, &out.StartTimestamp + *out = (*in).DeepCopy() + } + if in.CompletionTimestamp != nil { + in, out := &in.CompletionTimestamp, &out.CompletionTimestamp + *out = (*in).DeepCopy() + } + out.Progress = in.Progress +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodVolumeBackupStatus. +func (in *PodVolumeBackupStatus) DeepCopy() *PodVolumeBackupStatus { + if in == nil { + return nil + } + out := new(PodVolumeBackupStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodVolumeRestore) DeepCopyInto(out *PodVolumeRestore) { + *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 PodVolumeRestore. +func (in *PodVolumeRestore) DeepCopy() *PodVolumeRestore { + if in == nil { + return nil + } + out := new(PodVolumeRestore) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodVolumeRestore) 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 *PodVolumeRestoreList) DeepCopyInto(out *PodVolumeRestoreList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PodVolumeRestore, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodVolumeRestoreList. +func (in *PodVolumeRestoreList) DeepCopy() *PodVolumeRestoreList { + if in == nil { + return nil + } + out := new(PodVolumeRestoreList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodVolumeRestoreList) 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 *PodVolumeRestoreSpec) DeepCopyInto(out *PodVolumeRestoreSpec) { + *out = *in + out.Pod = in.Pod + if in.UploaderSettings != nil { + in, out := &in.UploaderSettings, &out.UploaderSettings + *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 PodVolumeRestoreSpec. +func (in *PodVolumeRestoreSpec) DeepCopy() *PodVolumeRestoreSpec { + if in == nil { + return nil + } + out := new(PodVolumeRestoreSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodVolumeRestoreStatus) DeepCopyInto(out *PodVolumeRestoreStatus) { + *out = *in + if in.StartTimestamp != nil { + in, out := &in.StartTimestamp, &out.StartTimestamp + *out = (*in).DeepCopy() + } + if in.CompletionTimestamp != nil { + in, out := &in.CompletionTimestamp, &out.CompletionTimestamp + *out = (*in).DeepCopy() + } + out.Progress = in.Progress +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodVolumeRestoreStatus. +func (in *PodVolumeRestoreStatus) DeepCopy() *PodVolumeRestoreStatus { + if in == nil { + return nil + } + out := new(PodVolumeRestoreStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Restore) DeepCopyInto(out *Restore) { + *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 Restore. +func (in *Restore) DeepCopy() *Restore { + if in == nil { + return nil + } + out := new(Restore) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Restore) 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 *RestoreHooks) DeepCopyInto(out *RestoreHooks) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]RestoreResourceHookSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreHooks. +func (in *RestoreHooks) DeepCopy() *RestoreHooks { + if in == nil { + return nil + } + out := new(RestoreHooks) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RestoreList) DeepCopyInto(out *RestoreList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Restore, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreList. +func (in *RestoreList) DeepCopy() *RestoreList { + if in == nil { + return nil + } + out := new(RestoreList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RestoreList) 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 *RestoreProgress) DeepCopyInto(out *RestoreProgress) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreProgress. +func (in *RestoreProgress) DeepCopy() *RestoreProgress { + if in == nil { + return nil + } + out := new(RestoreProgress) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RestoreResourceHook) DeepCopyInto(out *RestoreResourceHook) { + *out = *in + if in.Exec != nil { + in, out := &in.Exec, &out.Exec + *out = new(ExecRestoreHook) + (*in).DeepCopyInto(*out) + } + if in.Init != nil { + in, out := &in.Init, &out.Init + *out = new(InitRestoreHook) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreResourceHook. +func (in *RestoreResourceHook) DeepCopy() *RestoreResourceHook { + if in == nil { + return nil + } + out := new(RestoreResourceHook) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RestoreResourceHookSpec) DeepCopyInto(out *RestoreResourceHookSpec) { + *out = *in + if in.IncludedNamespaces != nil { + in, out := &in.IncludedNamespaces, &out.IncludedNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedNamespaces != nil { + in, out := &in.ExcludedNamespaces, &out.ExcludedNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.IncludedResources != nil { + in, out := &in.IncludedResources, &out.IncludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedResources != nil { + in, out := &in.ExcludedResources, &out.ExcludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.LabelSelector != nil { + in, out := &in.LabelSelector, &out.LabelSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.PostHooks != nil { + in, out := &in.PostHooks, &out.PostHooks + *out = make([]RestoreResourceHook, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreResourceHookSpec. +func (in *RestoreResourceHookSpec) DeepCopy() *RestoreResourceHookSpec { + if in == nil { + return nil + } + out := new(RestoreResourceHookSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RestoreSpec) DeepCopyInto(out *RestoreSpec) { + *out = *in + if in.IncludedNamespaces != nil { + in, out := &in.IncludedNamespaces, &out.IncludedNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedNamespaces != nil { + in, out := &in.ExcludedNamespaces, &out.ExcludedNamespaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.IncludedResources != nil { + in, out := &in.IncludedResources, &out.IncludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedResources != nil { + in, out := &in.ExcludedResources, &out.ExcludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.NamespaceMapping != nil { + in, out := &in.NamespaceMapping, &out.NamespaceMapping + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.LabelSelector != nil { + in, out := &in.LabelSelector, &out.LabelSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.OrLabelSelectors != nil { + in, out := &in.OrLabelSelectors, &out.OrLabelSelectors + *out = make([]*metav1.LabelSelector, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + } + if in.RestorePVs != nil { + in, out := &in.RestorePVs, &out.RestorePVs + *out = new(bool) + **out = **in + } + if in.RestoreStatus != nil { + in, out := &in.RestoreStatus, &out.RestoreStatus + *out = new(RestoreStatusSpec) + (*in).DeepCopyInto(*out) + } + if in.PreserveNodePorts != nil { + in, out := &in.PreserveNodePorts, &out.PreserveNodePorts + *out = new(bool) + **out = **in + } + if in.IncludeClusterResources != nil { + in, out := &in.IncludeClusterResources, &out.IncludeClusterResources + *out = new(bool) + **out = **in + } + in.Hooks.DeepCopyInto(&out.Hooks) + out.ItemOperationTimeout = in.ItemOperationTimeout + if in.ResourceModifier != nil { + in, out := &in.ResourceModifier, &out.ResourceModifier + *out = new(corev1.TypedLocalObjectReference) + (*in).DeepCopyInto(*out) + } + if in.UploaderConfig != nil { + in, out := &in.UploaderConfig, &out.UploaderConfig + *out = new(UploaderConfigForRestore) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreSpec. +func (in *RestoreSpec) DeepCopy() *RestoreSpec { + if in == nil { + return nil + } + out := new(RestoreSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RestoreStatus) DeepCopyInto(out *RestoreStatus) { + *out = *in + if in.ValidationErrors != nil { + in, out := &in.ValidationErrors, &out.ValidationErrors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.StartTimestamp != nil { + in, out := &in.StartTimestamp, &out.StartTimestamp + *out = (*in).DeepCopy() + } + if in.CompletionTimestamp != nil { + in, out := &in.CompletionTimestamp, &out.CompletionTimestamp + *out = (*in).DeepCopy() + } + if in.Progress != nil { + in, out := &in.Progress, &out.Progress + *out = new(RestoreProgress) + **out = **in + } + if in.HookStatus != nil { + in, out := &in.HookStatus, &out.HookStatus + *out = new(HookStatus) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreStatus. +func (in *RestoreStatus) DeepCopy() *RestoreStatus { + if in == nil { + return nil + } + out := new(RestoreStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RestoreStatusSpec) DeepCopyInto(out *RestoreStatusSpec) { + *out = *in + if in.IncludedResources != nil { + in, out := &in.IncludedResources, &out.IncludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedResources != nil { + in, out := &in.ExcludedResources, &out.ExcludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreStatusSpec. +func (in *RestoreStatusSpec) DeepCopy() *RestoreStatusSpec { + if in == nil { + return nil + } + out := new(RestoreStatusSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Schedule) DeepCopyInto(out *Schedule) { + *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 Schedule. +func (in *Schedule) DeepCopy() *Schedule { + if in == nil { + return nil + } + out := new(Schedule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Schedule) 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 *ScheduleList) DeepCopyInto(out *ScheduleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Schedule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduleList. +func (in *ScheduleList) DeepCopy() *ScheduleList { + if in == nil { + return nil + } + out := new(ScheduleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ScheduleList) 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 *ScheduleSpec) DeepCopyInto(out *ScheduleSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + if in.UseOwnerReferencesInBackup != nil { + in, out := &in.UseOwnerReferencesInBackup, &out.UseOwnerReferencesInBackup + *out = new(bool) + **out = **in + } + if in.SkipImmediately != nil { + in, out := &in.SkipImmediately, &out.SkipImmediately + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduleSpec. +func (in *ScheduleSpec) DeepCopy() *ScheduleSpec { + if in == nil { + return nil + } + out := new(ScheduleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScheduleStatus) DeepCopyInto(out *ScheduleStatus) { + *out = *in + if in.LastBackup != nil { + in, out := &in.LastBackup, &out.LastBackup + *out = (*in).DeepCopy() + } + if in.LastSkipped != nil { + in, out := &in.LastSkipped, &out.LastSkipped + *out = (*in).DeepCopy() + } + if in.ValidationErrors != nil { + in, out := &in.ValidationErrors, &out.ValidationErrors + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScheduleStatus. +func (in *ScheduleStatus) DeepCopy() *ScheduleStatus { + if in == nil { + return nil + } + out := new(ScheduleStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServerStatusRequest) DeepCopyInto(out *ServerStatusRequest) { + *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 ServerStatusRequest. +func (in *ServerStatusRequest) DeepCopy() *ServerStatusRequest { + if in == nil { + return nil + } + out := new(ServerStatusRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServerStatusRequest) 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 *ServerStatusRequestList) DeepCopyInto(out *ServerStatusRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ServerStatusRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerStatusRequestList. +func (in *ServerStatusRequestList) DeepCopy() *ServerStatusRequestList { + if in == nil { + return nil + } + out := new(ServerStatusRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServerStatusRequestList) 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 *ServerStatusRequestSpec) DeepCopyInto(out *ServerStatusRequestSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerStatusRequestSpec. +func (in *ServerStatusRequestSpec) DeepCopy() *ServerStatusRequestSpec { + if in == nil { + return nil + } + out := new(ServerStatusRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServerStatusRequestStatus) DeepCopyInto(out *ServerStatusRequestStatus) { + *out = *in + if in.ProcessedTimestamp != nil { + in, out := &in.ProcessedTimestamp, &out.ProcessedTimestamp + *out = (*in).DeepCopy() + } + if in.Plugins != nil { + in, out := &in.Plugins, &out.Plugins + *out = make([]PluginInfo, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerStatusRequestStatus. +func (in *ServerStatusRequestStatus) DeepCopy() *ServerStatusRequestStatus { + if in == nil { + return nil + } + out := new(ServerStatusRequestStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageType) DeepCopyInto(out *StorageType) { + *out = *in + if in.ObjectStorage != nil { + in, out := &in.ObjectStorage, &out.ObjectStorage + *out = new(ObjectStorageLocation) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageType. +func (in *StorageType) DeepCopy() *StorageType { + if in == nil { + return nil + } + out := new(StorageType) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UploaderConfigForBackup) DeepCopyInto(out *UploaderConfigForBackup) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UploaderConfigForBackup. +func (in *UploaderConfigForBackup) DeepCopy() *UploaderConfigForBackup { + if in == nil { + return nil + } + out := new(UploaderConfigForBackup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UploaderConfigForRestore) DeepCopyInto(out *UploaderConfigForRestore) { + *out = *in + if in.WriteSparseFiles != nil { + in, out := &in.WriteSparseFiles, &out.WriteSparseFiles + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UploaderConfigForRestore. +func (in *UploaderConfigForRestore) DeepCopy() *UploaderConfigForRestore { + if in == nil { + return nil + } + out := new(UploaderConfigForRestore) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeSnapshotLocation) DeepCopyInto(out *VolumeSnapshotLocation) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotLocation. +func (in *VolumeSnapshotLocation) DeepCopy() *VolumeSnapshotLocation { + if in == nil { + return nil + } + out := new(VolumeSnapshotLocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VolumeSnapshotLocation) 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 *VolumeSnapshotLocationList) DeepCopyInto(out *VolumeSnapshotLocationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VolumeSnapshotLocation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotLocationList. +func (in *VolumeSnapshotLocationList) DeepCopy() *VolumeSnapshotLocationList { + if in == nil { + return nil + } + out := new(VolumeSnapshotLocationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VolumeSnapshotLocationList) 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 *VolumeSnapshotLocationSpec) DeepCopyInto(out *VolumeSnapshotLocationSpec) { + *out = *in + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Credential != nil { + in, out := &in.Credential, &out.Credential + *out = new(corev1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotLocationSpec. +func (in *VolumeSnapshotLocationSpec) DeepCopy() *VolumeSnapshotLocationSpec { + if in == nil { + return nil + } + out := new(VolumeSnapshotLocationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeSnapshotLocationStatus) DeepCopyInto(out *VolumeSnapshotLocationStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotLocationStatus. +func (in *VolumeSnapshotLocationStatus) DeepCopy() *VolumeSnapshotLocationStatus { + if in == nil { + return nil + } + out := new(VolumeSnapshotLocationStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/pkg/restore/priority.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/pkg/restore/priority.go new file mode 100644 index 000000000..5897c3af7 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/pkg/restore/priority.go @@ -0,0 +1,92 @@ +/* +Copyright The Velero Contributors. + +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 restore + +import ( + "fmt" + "strings" +) + +const ( + prioritySeparator = "-" +) + +// Priorities defines the desired order of resource operations: +// Resources in the HighPriorities list will be handled first +// Resources in the LowPriorities list will be handled last +// Other resources will be handled alphabetically after the high prioritized resources and before the low prioritized resources +type Priorities struct { + HighPriorities []string + LowPriorities []string +} + +// String returns a string representation of Priority. +func (p *Priorities) String() string { + priorities := p.HighPriorities + if len(p.LowPriorities) > 0 { + priorities = append(priorities, prioritySeparator) + priorities = append(priorities, p.LowPriorities...) + } + return strings.Join(priorities, ",") +} + +// Set parses the provided string to the priority object +func (p *Priorities) Set(s string) error { + if len(s) == 0 { + return nil + } + strs := strings.Split(s, ",") + separatorIndex := -1 + for i, str := range strs { + if str == prioritySeparator { + if separatorIndex > -1 { + return fmt.Errorf("multiple priority separator %q found", prioritySeparator) + } + separatorIndex = i + } + } + // has no separator + if separatorIndex == -1 { + p.HighPriorities = strs + return nil + } + // start with separator + if separatorIndex == 0 { + // contain only separator + if len(strs) == 1 { + return nil + } + p.LowPriorities = strs[1:] + return nil + } + // end with separator + if separatorIndex == len(strs)-1 { + p.HighPriorities = strs[:len(strs)-1] + return nil + } + + // separator in the middle + p.HighPriorities = strs[:separatorIndex] + p.LowPriorities = strs[separatorIndex+1:] + + return nil +} + +// Type specifies the flag type +func (p *Priorities) Type() string { + return "stringArray" +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/doc.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/doc.go new file mode 100644 index 000000000..7eba79448 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/doc.go @@ -0,0 +1,4 @@ +// +kubebuilder:skip + +// Package operators contains all resource types of the operators.coreos.com API group. +package operators diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/register.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/register.go new file mode 100644 index 000000000..e3c31d51a --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/register.go @@ -0,0 +1,31 @@ +package operators + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + // GroupName is the group name used in this package. + GroupName = "operators.coreos.com" + // GroupVersion is the group version used in this package. + GroupVersion = runtime.APIVersionInternal + + // LEGACY: Exported kind names, remove after major version bump + + // ClusterServiceVersionKind is the kind name for ClusterServiceVersion resources. + ClusterServiceVersionKind = "ClusterServiceVersion" + // CatalogSourceKind is the kind name for CatalogSource resources. + CatalogSourceKind = "CatalogSource" + // InstallPlanKind is the kind name for InstallPlan resources. + InstallPlanKind = "InstallPlan" + // SubscriptionKind is the kind name for Subscription resources. + SubscriptionKind = "Subscription" + // OperatorKind is the kind name for Operator resources. + OperatorKind = "Operator" + // OperatorGroupKind is the kind name for OperatorGroup resources. + OperatorGroupKind = "OperatorGroup" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/catalogsource_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/catalogsource_types.go new file mode 100644 index 000000000..b5f5e3b7e --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/catalogsource_types.go @@ -0,0 +1,364 @@ +package v1alpha1 + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/sirupsen/logrus" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +const ( + CatalogSourceCRDAPIVersion = GroupName + "/" + GroupVersion + CatalogSourceKind = "CatalogSource" + DefaultRegistryPollDuration = 15 * time.Minute +) + +// SourceType indicates the type of backing store for a CatalogSource +type SourceType string + +const ( + // SourceTypeInternal (deprecated) specifies a CatalogSource of type SourceTypeConfigmap + SourceTypeInternal SourceType = "internal" + + // SourceTypeConfigmap specifies a CatalogSource that generates a configmap-server registry + SourceTypeConfigmap SourceType = "configmap" + + // SourceTypeGrpc specifies a CatalogSource that can use an operator registry image to generate a + // registry-server or connect to a pre-existing registry at an address. + SourceTypeGrpc SourceType = "grpc" +) + +const ( + // CatalogSourceSpecInvalidError denotes when fields on the spec of the CatalogSource are not valid. + CatalogSourceSpecInvalidError ConditionReason = "SpecInvalidError" + // CatalogSourceConfigMapError denotes when there is an issue extracting manifests from the specified ConfigMap. + CatalogSourceConfigMapError ConditionReason = "ConfigMapError" + // CatalogSourceRegistryServerError denotes when there is an issue querying the specified registry server. + CatalogSourceRegistryServerError ConditionReason = "RegistryServerError" + // CatalogSourceIntervalInvalidError denotes if the registry polling interval is invalid. + CatalogSourceIntervalInvalidError ConditionReason = "InvalidIntervalError" +) + +type CatalogSourceSpec struct { + // SourceType is the type of source + SourceType SourceType `json:"sourceType"` + + // Priority field assigns a weight to the catalog source to prioritize them so that it can be consumed by the dependency resolver. + // Usage: + // Higher weight indicates that this catalog source is preferred over lower weighted catalog sources during dependency resolution. + // The range of the priority value can go from positive to negative in the range of int32. + // The default value to a catalog source with unassigned priority would be 0. + // The catalog source with the same priority values will be ranked lexicographically based on its name. + // +optional + Priority int `json:"priority,omitempty"` + + // ConfigMap is the name of the ConfigMap to be used to back a configmap-server registry. + // Only used when SourceType = SourceTypeConfigmap or SourceTypeInternal. + // +optional + ConfigMap string `json:"configMap,omitempty"` + + // Address is a host that OLM can use to connect to a pre-existing registry. + // Format: : + // Only used when SourceType = SourceTypeGrpc. + // Ignored when the Image field is set. + // +optional + Address string `json:"address,omitempty"` + + // Image is an operator-registry container image to instantiate a registry-server with. + // Only used when SourceType = SourceTypeGrpc. + // If present, the address field is ignored. + // +optional + Image string `json:"image,omitempty"` + + // GrpcPodConfig exposes different overrides for the pod spec of the CatalogSource Pod. + // Only used when SourceType = SourceTypeGrpc and Image is set. + // +optional + GrpcPodConfig *GrpcPodConfig `json:"grpcPodConfig,omitempty"` + + // UpdateStrategy defines how updated catalog source images can be discovered + // Consists of an interval that defines polling duration and an embedded strategy type + // +optional + UpdateStrategy *UpdateStrategy `json:"updateStrategy,omitempty"` + + // Secrets represent set of secrets that can be used to access the contents of the catalog. + // It is best to keep this list small, since each will need to be tried for every catalog entry. + // +optional + Secrets []string `json:"secrets,omitempty"` + + // Metadata + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + Publisher string `json:"publisher,omitempty"` + Icon Icon `json:"icon,omitempty"` +} + +type SecurityConfig string + +const ( + Legacy SecurityConfig = "legacy" + Restricted SecurityConfig = "restricted" +) + +// GrpcPodConfig contains configuration specified for a catalog source +type GrpcPodConfig struct { + // NodeSelector is a selector which must be true for the pod to fit on a node. + // Selector which must match a node's labels for the pod to be scheduled on that node. + // +optional + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + + // Tolerations are the catalog source's pod's tolerations. + // +optional + Tolerations []corev1.Toleration `json:"tolerations,omitempty"` + + // Affinity is the catalog source's pod's affinity. + // +optional + Affinity *corev1.Affinity `json:"affinity,omitempty"` + + // If specified, indicates the pod's priority. + // If not specified, the pod priority will be default or zero if there is no + // default. + // +optional + PriorityClassName *string `json:"priorityClassName,omitempty"` + + // SecurityContextConfig can be one of `legacy` or `restricted`. The CatalogSource's pod is either injected with the + // right pod.spec.securityContext and pod.spec.container[*].securityContext values to allow the pod to run in Pod + // Security Admission (PSA) `restricted` mode, or doesn't set these values at all, in which case the pod can only be + // run in PSA `baseline` or `privileged` namespaces. If the SecurityContextConfig is unspecified, the mode will be + // determined by the namespace's PSA configuration. If the namespace is enforcing `restricted` mode, then the pod + // will be configured as if `restricted` was specified. Otherwise, it will be configured as if `legacy` was + // specified. Specifying a value other than `legacy` or `restricted` result in a validation error. When using older + // catalog images, which can not run in `restricted` mode, the SecurityContextConfig should be set to `legacy`. + // + // More information about PSA can be found here: https://kubernetes.io/docs/concepts/security/pod-security-admission/' + // +optional + // +kubebuilder:validation:Enum=legacy;restricted + SecurityContextConfig SecurityConfig `json:"securityContextConfig,omitempty"` + + // MemoryTarget configures the $GOMEMLIMIT value for the gRPC catalog Pod. This is a soft memory limit for the server, + // which the runtime will attempt to meet but makes no guarantees that it will do so. If this value is set, the Pod + // will have the following modifications made to the container running the server: + // - the $GOMEMLIMIT environment variable will be set to this value in bytes + // - the memory request will be set to this value + // + // This field should be set if it's desired to reduce the footprint of a catalog server as much as possible, or if + // a catalog being served is very large and needs more than the default allocation. If your index image has a file- + // system cache, determine a good approximation for this value by doubling the size of the package cache at + // /tmp/cache/cache/packages.json in the index image. + // + // This field is best-effort; if unset, no default will be used and no Pod memory limit or $GOMEMLIMIT value will be set. + // +optional + MemoryTarget *resource.Quantity `json:"memoryTarget,omitempty"` + + // ExtractContent configures the gRPC catalog Pod to extract catalog metadata from the provided index image and + // use a well-known version of the `opm` server to expose it. The catalog index image that this CatalogSource is + // configured to use *must* be using the file-based catalogs in order to utilize this feature. + // +optional + ExtractContent *ExtractContentConfig `json:"extractContent,omitempty"` +} + +// ExtractContentConfig configures context extraction from a file-based catalog index image. +type ExtractContentConfig struct { + // CacheDir is the directory storing the pre-calculated API cache. + CacheDir string `json:"cacheDir"` + // CatalogDir is the directory storing the file-based catalog contents. + CatalogDir string `json:"catalogDir"` +} + +// UpdateStrategy holds all the different types of catalog source update strategies +// Currently only registry polling strategy is implemented +type UpdateStrategy struct { + *RegistryPoll `json:"registryPoll,omitempty"` +} + +type RegistryPoll struct { + // Interval is used to determine the time interval between checks of the latest catalog source version. + // The catalog operator polls to see if a new version of the catalog source is available. + // If available, the latest image is pulled and gRPC traffic is directed to the latest catalog source. + RawInterval string `json:"interval,omitempty"` + Interval *metav1.Duration `json:"-"` + ParsingError string `json:"-"` +} + +// UnmarshalJSON implements the encoding/json.Unmarshaler interface. +func (u *UpdateStrategy) UnmarshalJSON(data []byte) (err error) { + type alias struct { + *RegistryPoll `json:"registryPoll,omitempty"` + } + us := alias{} + if err = json.Unmarshal(data, &us); err != nil { + return err + } + registryPoll := &RegistryPoll{ + RawInterval: us.RegistryPoll.RawInterval, + } + duration, err := time.ParseDuration(registryPoll.RawInterval) + if err != nil { + registryPoll.ParsingError = fmt.Sprintf("error parsing spec.updateStrategy.registryPoll.interval. Using the default value of %s instead. Error: %s", DefaultRegistryPollDuration, err) + registryPoll.Interval = &metav1.Duration{Duration: DefaultRegistryPollDuration} + } else { + registryPoll.Interval = &metav1.Duration{Duration: duration} + } + u.RegistryPoll = registryPoll + return nil +} + +type RegistryServiceStatus struct { + Protocol string `json:"protocol,omitempty"` + ServiceName string `json:"serviceName,omitempty"` + ServiceNamespace string `json:"serviceNamespace,omitempty"` + Port string `json:"port,omitempty"` + CreatedAt metav1.Time `json:"createdAt,omitempty"` +} + +func (s *RegistryServiceStatus) Address() string { + return fmt.Sprintf("%s.%s.svc:%s", s.ServiceName, s.ServiceNamespace, s.Port) +} + +type GRPCConnectionState struct { + Address string `json:"address,omitempty"` + LastObservedState string `json:"lastObservedState"` + LastConnectTime metav1.Time `json:"lastConnect,omitempty"` +} + +type CatalogSourceStatus struct { + // A human readable message indicating details about why the CatalogSource is in this condition. + // +optional + Message string `json:"message,omitempty"` + // Reason is the reason the CatalogSource was transitioned to its current state. + // +optional + Reason ConditionReason `json:"reason,omitempty"` + + // The last time the CatalogSource image registry has been polled to ensure the image is up-to-date + LatestImageRegistryPoll *metav1.Time `json:"latestImageRegistryPoll,omitempty"` + + // ConfigMapReference (deprecated) is the reference to the ConfigMap containing the catalog source's configuration, when the catalog source is a ConfigMap + ConfigMapResource *ConfigMapResourceReference `json:"configMapReference,omitempty"` + // RegistryService represents the current state of the GRPC service used to serve the catalog + RegistryServiceStatus *RegistryServiceStatus `json:"registryService,omitempty"` + // ConnectionState represents the current state of the CatalogSource's connection to the registry + GRPCConnectionState *GRPCConnectionState `json:"connectionState,omitempty"` + + // Represents the state of a CatalogSource. Note that Message and Reason represent the original + // status information, which may be migrated to be conditions based in the future. Any new features + // introduced will use conditions. + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` +} + +type ConfigMapResourceReference struct { + Name string `json:"name"` + Namespace string `json:"namespace"` + UID types.UID `json:"uid,omitempty"` + ResourceVersion string `json:"resourceVersion,omitempty"` + LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` +} + +func (r *ConfigMapResourceReference) IsAMatch(object *metav1.ObjectMeta) bool { + return r.UID == object.GetUID() && r.ResourceVersion == object.GetResourceVersion() +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient +// +kubebuilder:resource:shortName=catsrc,categories=olm +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Display",type=string,JSONPath=`.spec.displayName`,description="The pretty name of the catalog" +// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.sourceType`,description="The type of the catalog" +// +kubebuilder:printcolumn:name="Publisher",type=string,JSONPath=`.spec.publisher`,description="The publisher of the catalog" +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` + +// CatalogSource is a repository of CSVs, CRDs, and operator packages. +type CatalogSource struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec CatalogSourceSpec `json:"spec"` + // +optional + Status CatalogSourceStatus `json:"status"` +} + +func (c *CatalogSource) Address() string { + if c.Spec.Address != "" { + return c.Spec.Address + } + return c.Status.RegistryServiceStatus.Address() +} + +func (c *CatalogSource) SetError(reason ConditionReason, err error) { + c.Status.Reason = reason + c.Status.Message = "" + if err != nil { + c.Status.Message = err.Error() + } +} + +func (c *CatalogSource) SetLastUpdateTime() { + now := metav1.Now() + c.Status.LatestImageRegistryPoll = &now +} + +// Check if it is time to update based on polling setting +func (c *CatalogSource) Update() bool { + if !c.Poll() { + return false + } + interval := c.Spec.UpdateStrategy.Interval.Duration + latest := c.Status.LatestImageRegistryPoll + if latest == nil { + logrus.WithField("CatalogSource", c.Name).Debugf("latest poll %v", latest) + } else { + logrus.WithField("CatalogSource", c.Name).Debugf("latest poll %v", *c.Status.LatestImageRegistryPoll) + } + + if c.Status.LatestImageRegistryPoll.IsZero() { + logrus.WithField("CatalogSource", c.Name).Debugf("creation timestamp plus interval before now %t", c.CreationTimestamp.Add(interval).Before(time.Now())) + if c.CreationTimestamp.Add(interval).Before(time.Now()) { + return true + } + } else { + logrus.WithField("CatalogSource", c.Name).Debugf("latest poll plus interval before now %t", c.Status.LatestImageRegistryPoll.Add(interval).Before(time.Now())) + if c.Status.LatestImageRegistryPoll.Add(interval).Before(time.Now()) { + return true + } + } + + return false +} + +// Poll determines whether the polling feature is enabled on the particular catalog source +func (c *CatalogSource) Poll() bool { + if c.Spec.UpdateStrategy == nil { + return false + } + // if polling interval is zero polling will not be done + if c.Spec.UpdateStrategy.RegistryPoll == nil { + return false + } + // if catalog source is not backed by an image polling will not be done + if c.Spec.Image == "" { + return false + } + // if image is not type gRPC polling will not be done + if c.Spec.SourceType != SourceTypeGrpc { + return false + } + return true +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// CatalogSourceList is a repository of CSVs, CRDs, and operator packages. +type CatalogSourceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []CatalogSource `json:"items"` +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/clusterserviceversion.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/clusterserviceversion.go new file mode 100644 index 000000000..a4c8d1746 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/clusterserviceversion.go @@ -0,0 +1,215 @@ +package v1alpha1 + +import ( + "fmt" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/record" +) + +const ( + CopiedLabelKey = "olm.copiedFrom" + + // ConditionsLengthLimit is the maximum length of Status.Conditions of a + // given ClusterServiceVersion object. The oldest condition(s) are removed + // from the list as it grows over time to keep it at limit. + ConditionsLengthLimit = 20 +) + +// obsoleteReasons are the set of reasons that mean a CSV should no longer be processed as active +var obsoleteReasons = map[ConditionReason]struct{}{ + CSVReasonReplaced: {}, + CSVReasonBeingReplaced: {}, +} + +// uncopiableReasons are the set of reasons that should prevent a CSV from being copied to target namespaces +var uncopiableReasons = map[ConditionReason]struct{}{ + CSVReasonCopied: {}, + CSVReasonInvalidInstallModes: {}, + CSVReasonNoTargetNamespaces: {}, + CSVReasonUnsupportedOperatorGroup: {}, + CSVReasonNoOperatorGroup: {}, + CSVReasonTooManyOperatorGroups: {}, + CSVReasonInterOperatorGroupOwnerConflict: {}, + CSVReasonCannotModifyStaticOperatorGroupProvidedAPIs: {}, +} + +// safeToAnnotateOperatorGroupReasons are the set of reasons that it's safe to attempt to update the operatorgroup +// annotations +var safeToAnnotateOperatorGroupReasons = map[ConditionReason]struct{}{ + CSVReasonOwnerConflict: {}, + CSVReasonInstallSuccessful: {}, + CSVReasonInvalidInstallModes: {}, + CSVReasonNoTargetNamespaces: {}, + CSVReasonUnsupportedOperatorGroup: {}, + CSVReasonNoOperatorGroup: {}, + CSVReasonTooManyOperatorGroups: {}, + CSVReasonInterOperatorGroupOwnerConflict: {}, + CSVReasonCannotModifyStaticOperatorGroupProvidedAPIs: {}, +} + +// SetPhaseWithEventIfChanged emits a Kubernetes event with details of a phase change and sets the current phase if phase, reason, or message would changed +func (c *ClusterServiceVersion) SetPhaseWithEventIfChanged(phase ClusterServiceVersionPhase, reason ConditionReason, message string, now *metav1.Time, recorder record.EventRecorder) { + if c.Status.Phase == phase && c.Status.Reason == reason && c.Status.Message == message { + return + } + + c.SetPhaseWithEvent(phase, reason, message, now, recorder) +} + +// SetPhaseWithEvent generates a Kubernetes event with details about the phase change and sets the current phase +func (c *ClusterServiceVersion) SetPhaseWithEvent(phase ClusterServiceVersionPhase, reason ConditionReason, message string, now *metav1.Time, recorder record.EventRecorder) { + var eventtype string + if phase == CSVPhaseFailed { + eventtype = v1.EventTypeWarning + } else { + eventtype = v1.EventTypeNormal + } + go recorder.Event(c, eventtype, string(reason), message) + c.SetPhase(phase, reason, message, now) +} + +// SetPhase sets the current phase and adds a condition if necessary +func (c *ClusterServiceVersion) SetPhase(phase ClusterServiceVersionPhase, reason ConditionReason, message string, now *metav1.Time) { + newCondition := func() ClusterServiceVersionCondition { + return ClusterServiceVersionCondition{ + Phase: c.Status.Phase, + LastTransitionTime: c.Status.LastTransitionTime, + LastUpdateTime: c.Status.LastUpdateTime, + Message: message, + Reason: reason, + } + } + + defer c.TrimConditionsIfLimitExceeded() + + c.Status.LastUpdateTime = now + if c.Status.Phase != phase { + c.Status.Phase = phase + c.Status.LastTransitionTime = now + } + c.Status.Message = message + c.Status.Reason = reason + if len(c.Status.Conditions) == 0 { + c.Status.Conditions = append(c.Status.Conditions, newCondition()) + return + } + + previousCondition := c.Status.Conditions[len(c.Status.Conditions)-1] + if previousCondition.Phase != c.Status.Phase || previousCondition.Reason != c.Status.Reason { + c.Status.Conditions = append(c.Status.Conditions, newCondition()) + } +} + +// SetRequirementStatus adds the status of all requirements to the CSV status +func (c *ClusterServiceVersion) SetRequirementStatus(statuses []RequirementStatus) { + c.Status.RequirementStatus = statuses +} + +// IsObsolete returns if this CSV is being replaced or is marked for deletion +func (c *ClusterServiceVersion) IsObsolete() bool { + for _, condition := range c.Status.Conditions { + _, ok := obsoleteReasons[condition.Reason] + if ok { + return true + } + } + return false +} + +// IsCopied returns true if the CSV has been copied and false otherwise. +func (c *ClusterServiceVersion) IsCopied() bool { + return c.Status.Reason == CSVReasonCopied || IsCopied(c) +} + +func IsCopied(o metav1.Object) bool { + annotations := o.GetAnnotations() + if annotations != nil { + operatorNamespace, ok := annotations[OperatorGroupNamespaceAnnotationKey] + if ok && o.GetNamespace() != operatorNamespace { + return true + } + } + + if labels := o.GetLabels(); labels != nil { + if _, ok := labels[CopiedLabelKey]; ok { + return true + } + } + return false +} + +func (c *ClusterServiceVersion) IsUncopiable() bool { + if c.Status.Phase == CSVPhaseNone { + return true + } + _, ok := uncopiableReasons[c.Status.Reason] + return ok +} + +func (c *ClusterServiceVersion) IsSafeToUpdateOperatorGroupAnnotations() bool { + _, ok := safeToAnnotateOperatorGroupReasons[c.Status.Reason] + return ok +} + +// NewInstallModeSet returns an InstallModeSet instantiated from the given list of InstallModes. +// If the given list is not a set, an error is returned. +func NewInstallModeSet(modes []InstallMode) (InstallModeSet, error) { + set := InstallModeSet{} + for _, mode := range modes { + if _, exists := set[mode.Type]; exists { + return nil, fmt.Errorf("InstallMode list contains duplicates, cannot make set: %v", modes) + } + set[mode.Type] = mode.Supported + } + + return set, nil +} + +// Supports returns an error if the InstallModeSet does not support configuration for +// the given operatorNamespace and list of target namespaces. +func (set InstallModeSet) Supports(operatorNamespace string, namespaces []string) error { + numNamespaces := len(namespaces) + switch { + case numNamespaces == 0: + return fmt.Errorf("operatorgroup has invalid selected namespaces, cannot configure to watch zero namespaces") + case numNamespaces == 1: + switch namespaces[0] { + case operatorNamespace: + if !set[InstallModeTypeOwnNamespace] { + return fmt.Errorf("%s InstallModeType not supported, cannot configure to watch own namespace", InstallModeTypeOwnNamespace) + } + case v1.NamespaceAll: + if !set[InstallModeTypeAllNamespaces] { + return fmt.Errorf("%s InstallModeType not supported, cannot configure to watch all namespaces", InstallModeTypeAllNamespaces) + } + default: + if !set[InstallModeTypeSingleNamespace] { + return fmt.Errorf("%s InstallModeType not supported, cannot configure to watch one namespace", InstallModeTypeSingleNamespace) + } + } + case numNamespaces > 1 && !set[InstallModeTypeMultiNamespace]: + return fmt.Errorf("%s InstallModeType not supported, cannot configure to watch %d namespaces", InstallModeTypeMultiNamespace, numNamespaces) + case numNamespaces > 1: + for _, namespace := range namespaces { + if namespace == operatorNamespace && !set[InstallModeTypeOwnNamespace] { + return fmt.Errorf("%s InstallModeType not supported, cannot configure to watch own namespace", InstallModeTypeOwnNamespace) + } + if namespace == v1.NamespaceAll { + return fmt.Errorf("operatorgroup has invalid selected namespaces, NamespaceAll found when |selected namespaces| > 1") + } + } + } + + return nil +} + +func (c *ClusterServiceVersion) TrimConditionsIfLimitExceeded() { + if len(c.Status.Conditions) <= ConditionsLengthLimit { + return + } + + firstIndex := len(c.Status.Conditions) - ConditionsLengthLimit + c.Status.Conditions = c.Status.Conditions[firstIndex:len(c.Status.Conditions)] +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/clusterserviceversion_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/clusterserviceversion_types.go new file mode 100644 index 000000000..04c8c90c2 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/clusterserviceversion_types.go @@ -0,0 +1,737 @@ +package v1alpha1 + +import ( + "encoding/json" + "fmt" + "sort" + "strings" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + appsv1 "k8s.io/api/apps/v1" + rbac "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/util/intstr" + + "github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/version" +) + +const ( + ClusterServiceVersionAPIVersion = GroupName + "/" + GroupVersion + ClusterServiceVersionKind = "ClusterServiceVersion" + OperatorGroupNamespaceAnnotationKey = "olm.operatorNamespace" + InstallStrategyNameDeployment = "deployment" + SkipRangeAnnotationKey = "olm.skipRange" +) + +// InstallModeType is a supported type of install mode for CSV installation +type InstallModeType string + +const ( + // InstallModeTypeOwnNamespace indicates that the operator can be a member of an `OperatorGroup` that selects its own namespace. + InstallModeTypeOwnNamespace InstallModeType = "OwnNamespace" + // InstallModeTypeSingleNamespace indicates that the operator can be a member of an `OperatorGroup` that selects one namespace. + InstallModeTypeSingleNamespace InstallModeType = "SingleNamespace" + // InstallModeTypeMultiNamespace indicates that the operator can be a member of an `OperatorGroup` that selects more than one namespace. + InstallModeTypeMultiNamespace InstallModeType = "MultiNamespace" + // InstallModeTypeAllNamespaces indicates that the operator can be a member of an `OperatorGroup` that selects all namespaces (target namespace set is the empty string ""). + InstallModeTypeAllNamespaces InstallModeType = "AllNamespaces" +) + +// InstallMode associates an InstallModeType with a flag representing if the CSV supports it +// +k8s:openapi-gen=true +type InstallMode struct { + Type InstallModeType `json:"type"` + Supported bool `json:"supported"` +} + +// InstallModeSet is a mapping of unique InstallModeTypes to whether they are supported. +type InstallModeSet map[InstallModeType]bool + +// NamedInstallStrategy represents the block of an ClusterServiceVersion resource +// where the install strategy is specified. +// +k8s:openapi-gen=true +type NamedInstallStrategy struct { + StrategyName string `json:"strategy"` + StrategySpec StrategyDetailsDeployment `json:"spec,omitempty"` +} + +// StrategyDeploymentPermissions describe the rbac rules and service account needed by the install strategy +// +k8s:openapi-gen=true +type StrategyDeploymentPermissions struct { + ServiceAccountName string `json:"serviceAccountName"` + Rules []rbac.PolicyRule `json:"rules"` +} + +// StrategyDeploymentSpec contains the name, spec and labels for the deployment ALM should create +// +k8s:openapi-gen=true +type StrategyDeploymentSpec struct { + Name string `json:"name"` + Spec appsv1.DeploymentSpec `json:"spec"` + Label labels.Set `json:"label,omitempty"` +} + +// StrategyDetailsDeployment represents the parsed details of a Deployment +// InstallStrategy. +// +k8s:openapi-gen=true +type StrategyDetailsDeployment struct { + DeploymentSpecs []StrategyDeploymentSpec `json:"deployments"` + Permissions []StrategyDeploymentPermissions `json:"permissions,omitempty"` + ClusterPermissions []StrategyDeploymentPermissions `json:"clusterPermissions,omitempty"` +} + +func (d *StrategyDetailsDeployment) GetStrategyName() string { + return InstallStrategyNameDeployment +} + +// StatusDescriptor describes a field in a status block of a CRD so that OLM can consume it +// +k8s:openapi-gen=true +type StatusDescriptor struct { + Path string `json:"path"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + XDescriptors []string `json:"x-descriptors,omitempty"` + Value json.RawMessage `json:"value,omitempty"` +} + +// SpecDescriptor describes a field in a spec block of a CRD so that OLM can consume it +// +k8s:openapi-gen=true +type SpecDescriptor struct { + Path string `json:"path"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + XDescriptors []string `json:"x-descriptors,omitempty"` + Value json.RawMessage `json:"value,omitempty"` +} + +// ActionDescriptor describes a declarative action that can be performed on a custom resource instance +// +k8s:openapi-gen=true +type ActionDescriptor struct { + Path string `json:"path"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + XDescriptors []string `json:"x-descriptors,omitempty"` + Value json.RawMessage `json:"value,omitempty"` +} + +// CRDDescription provides details to OLM about the CRDs +// +k8s:openapi-gen=true +type CRDDescription struct { + Name string `json:"name"` + Version string `json:"version"` + Kind string `json:"kind"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + Resources []APIResourceReference `json:"resources,omitempty"` + StatusDescriptors []StatusDescriptor `json:"statusDescriptors,omitempty"` + SpecDescriptors []SpecDescriptor `json:"specDescriptors,omitempty"` + ActionDescriptor []ActionDescriptor `json:"actionDescriptors,omitempty"` +} + +// APIServiceDescription provides details to OLM about apis provided via aggregation +// +k8s:openapi-gen=true +type APIServiceDescription struct { + Name string `json:"name"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + DeploymentName string `json:"deploymentName,omitempty"` + ContainerPort int32 `json:"containerPort,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + Resources []APIResourceReference `json:"resources,omitempty"` + StatusDescriptors []StatusDescriptor `json:"statusDescriptors,omitempty"` + SpecDescriptors []SpecDescriptor `json:"specDescriptors,omitempty"` + ActionDescriptor []ActionDescriptor `json:"actionDescriptors,omitempty"` +} + +// APIResourceReference is a reference to a Kubernetes resource type that the referrer utilizes. +// +k8s:openapi-gen=true +type APIResourceReference struct { + // Plural name of the referenced resource type (CustomResourceDefinition.Spec.Names[].Plural). Empty string if the referenced resource type is not a custom resource. + Name string `json:"name"` + // Kind of the referenced resource type. + Kind string `json:"kind"` + // API Version of the referenced resource type. + Version string `json:"version"` +} + +// GetName returns the name of an APIService as derived from its group and version. +func (d APIServiceDescription) GetName() string { + return fmt.Sprintf("%s.%s", d.Version, d.Group) +} + +// WebhookAdmissionType is the type of admission webhooks supported by OLM +type WebhookAdmissionType string + +const ( + // ValidatingAdmissionWebhook is for validating admission webhooks + ValidatingAdmissionWebhook WebhookAdmissionType = "ValidatingAdmissionWebhook" + // MutatingAdmissionWebhook is for mutating admission webhooks + MutatingAdmissionWebhook WebhookAdmissionType = "MutatingAdmissionWebhook" + // ConversionWebhook is for conversion webhooks + ConversionWebhook WebhookAdmissionType = "ConversionWebhook" +) + +// WebhookDescription provides details to OLM about required webhooks +// +k8s:openapi-gen=true +type WebhookDescription struct { + GenerateName string `json:"generateName"` + // +kubebuilder:validation:Enum=ValidatingAdmissionWebhook;MutatingAdmissionWebhook;ConversionWebhook + Type WebhookAdmissionType `json:"type"` + DeploymentName string `json:"deploymentName,omitempty"` + // +kubebuilder:validation:Maximum=65535 + // +kubebuilder:validation:Minimum=1 + // +kubebuilder:default=443 + ContainerPort int32 `json:"containerPort,omitempty"` + TargetPort *intstr.IntOrString `json:"targetPort,omitempty"` + Rules []admissionregistrationv1.RuleWithOperations `json:"rules,omitempty"` + FailurePolicy *admissionregistrationv1.FailurePolicyType `json:"failurePolicy,omitempty"` + MatchPolicy *admissionregistrationv1.MatchPolicyType `json:"matchPolicy,omitempty"` + ObjectSelector *metav1.LabelSelector `json:"objectSelector,omitempty"` + SideEffects *admissionregistrationv1.SideEffectClass `json:"sideEffects"` + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + AdmissionReviewVersions []string `json:"admissionReviewVersions"` + ReinvocationPolicy *admissionregistrationv1.ReinvocationPolicyType `json:"reinvocationPolicy,omitempty"` + WebhookPath *string `json:"webhookPath,omitempty"` + ConversionCRDs []string `json:"conversionCRDs,omitempty"` +} + +// GetValidatingWebhook returns a ValidatingWebhook generated from the WebhookDescription +func (w *WebhookDescription) GetValidatingWebhook(namespace string, namespaceSelector *metav1.LabelSelector, caBundle []byte) admissionregistrationv1.ValidatingWebhook { + return admissionregistrationv1.ValidatingWebhook{ + Name: w.GenerateName, + Rules: w.Rules, + FailurePolicy: w.FailurePolicy, + MatchPolicy: w.MatchPolicy, + NamespaceSelector: namespaceSelector, + ObjectSelector: w.ObjectSelector, + SideEffects: w.SideEffects, + TimeoutSeconds: w.TimeoutSeconds, + AdmissionReviewVersions: w.AdmissionReviewVersions, + ClientConfig: admissionregistrationv1.WebhookClientConfig{ + Service: &admissionregistrationv1.ServiceReference{ + Name: w.DomainName() + "-service", + Namespace: namespace, + Path: w.WebhookPath, + Port: &w.ContainerPort, + }, + CABundle: caBundle, + }, + } +} + +// GetMutatingWebhook returns a MutatingWebhook generated from the WebhookDescription +func (w *WebhookDescription) GetMutatingWebhook(namespace string, namespaceSelector *metav1.LabelSelector, caBundle []byte) admissionregistrationv1.MutatingWebhook { + return admissionregistrationv1.MutatingWebhook{ + Name: w.GenerateName, + Rules: w.Rules, + FailurePolicy: w.FailurePolicy, + MatchPolicy: w.MatchPolicy, + NamespaceSelector: namespaceSelector, + ObjectSelector: w.ObjectSelector, + SideEffects: w.SideEffects, + TimeoutSeconds: w.TimeoutSeconds, + AdmissionReviewVersions: w.AdmissionReviewVersions, + ClientConfig: admissionregistrationv1.WebhookClientConfig{ + Service: &admissionregistrationv1.ServiceReference{ + Name: w.DomainName() + "-service", + Namespace: namespace, + Path: w.WebhookPath, + Port: &w.ContainerPort, + }, + CABundle: caBundle, + }, + ReinvocationPolicy: w.ReinvocationPolicy, + } +} + +// DomainName returns the result of replacing all periods in the given Webhook name with hyphens +func (w *WebhookDescription) DomainName() string { + // Replace all '.'s with "-"s to convert to a DNS-1035 label + return strings.Replace(w.DeploymentName, ".", "-", -1) +} + +// CustomResourceDefinitions declares all of the CRDs managed or required by +// an operator being ran by ClusterServiceVersion. +// +// If the CRD is present in the Owned list, it is implicitly required. +// +k8s:openapi-gen=true +type CustomResourceDefinitions struct { + Owned []CRDDescription `json:"owned,omitempty"` + Required []CRDDescription `json:"required,omitempty"` +} + +// APIServiceDefinitions declares all of the extension apis managed or required by +// an operator being ran by ClusterServiceVersion. +// +k8s:openapi-gen=true +type APIServiceDefinitions struct { + Owned []APIServiceDescription `json:"owned,omitempty"` + Required []APIServiceDescription `json:"required,omitempty"` +} + +// ClusterServiceVersionSpec declarations tell OLM how to install an operator +// that can manage apps for a given version. +// +k8s:openapi-gen=true +type ClusterServiceVersionSpec struct { + InstallStrategy NamedInstallStrategy `json:"install"` + Version version.OperatorVersion `json:"version,omitempty"` + Maturity string `json:"maturity,omitempty"` + CustomResourceDefinitions CustomResourceDefinitions `json:"customresourcedefinitions,omitempty"` + APIServiceDefinitions APIServiceDefinitions `json:"apiservicedefinitions,omitempty"` + WebhookDefinitions []WebhookDescription `json:"webhookdefinitions,omitempty"` + NativeAPIs []metav1.GroupVersionKind `json:"nativeAPIs,omitempty"` + MinKubeVersion string `json:"minKubeVersion,omitempty"` + + // The name of the operator in display format. + DisplayName string `json:"displayName"` + + // Description of the operator. Can include the features, limitations or use-cases of the + // operator. + // +optional + Description string `json:"description,omitempty"` + + // A list of keywords describing the operator. + // +optional + Keywords []string `json:"keywords,omitempty"` + + // A list of organizational entities maintaining the operator. + // +optional + Maintainers []Maintainer `json:"maintainers,omitempty"` + + // The publishing entity behind the operator. + // +optional + Provider AppLink `json:"provider,omitempty"` + + // A list of links related to the operator. + // +optional + Links []AppLink `json:"links,omitempty"` + + // The icon for this operator. + // +optional + Icon []Icon `json:"icon,omitempty"` + + // InstallModes specify supported installation types + // +optional + InstallModes []InstallMode `json:"installModes,omitempty"` + + // The name of a CSV this one replaces. Should match the `metadata.Name` field of the old CSV. + // +optional + Replaces string `json:"replaces,omitempty"` + + // Map of string keys and values that can be used to organize and categorize + // (scope and select) objects. + // +optional + Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,11,rep,name=labels"` + + // Annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. + // +optional + Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"` + + // Label selector for related resources. + // +optional + Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"` + + // Cleanup specifies the cleanup behaviour when the CSV gets deleted + // +optional + Cleanup CleanupSpec `json:"cleanup,omitempty"` + + // The name(s) of one or more CSV(s) that should be skipped in the upgrade graph. + // Should match the `metadata.Name` field of the CSV that should be skipped. + // This field is only used during catalog creation and plays no part in cluster runtime. + // +optional + Skips []string `json:"skips,omitempty"` + + // List any related images, or other container images that your Operator might require to perform their functions. + // This list should also include operand images as well. All image references should be specified by + // digest (SHA) and not by tag. This field is only used during catalog creation and plays no part in cluster runtime. + // +optional + RelatedImages []RelatedImage `json:"relatedImages,omitempty"` +} + +// +k8s:openapi-gen=true +type CleanupSpec struct { + Enabled bool `json:"enabled"` +} + +// +k8s:openapi-gen=true +type Maintainer struct { + Name string `json:"name,omitempty"` + Email string `json:"email,omitempty"` +} + +// +k8s:openapi-gen=true +type AppLink struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` +} + +// +k8s:openapi-gen=true +type Icon struct { + Data string `json:"base64data"` + MediaType string `json:"mediatype"` +} + +// +k8s:openapi-gen=true +type RelatedImage struct { + Name string `json:"name"` + Image string `json:"image"` +} + +// ClusterServiceVersionPhase is a label for the condition of a ClusterServiceVersion at the current time. +type ClusterServiceVersionPhase string + +// These are the valid phases of ClusterServiceVersion +const ( + CSVPhaseNone = "" + // CSVPhasePending means the csv has been accepted by the system, but the install strategy has not been attempted. + // This is likely because there are unmet requirements. + CSVPhasePending ClusterServiceVersionPhase = "Pending" + // CSVPhaseInstallReady means that the requirements are met but the install strategy has not been run. + CSVPhaseInstallReady ClusterServiceVersionPhase = "InstallReady" + // CSVPhaseInstalling means that the install strategy has been initiated but not completed. + CSVPhaseInstalling ClusterServiceVersionPhase = "Installing" + // CSVPhaseSucceeded means that the resources in the CSV were created successfully. + CSVPhaseSucceeded ClusterServiceVersionPhase = "Succeeded" + // CSVPhaseFailed means that the install strategy could not be successfully completed. + CSVPhaseFailed ClusterServiceVersionPhase = "Failed" + // CSVPhaseUnknown means that for some reason the state of the csv could not be obtained. + CSVPhaseUnknown ClusterServiceVersionPhase = "Unknown" + // CSVPhaseReplacing means that a newer CSV has been created and the csv's resources will be transitioned to a new owner. + CSVPhaseReplacing ClusterServiceVersionPhase = "Replacing" + // CSVPhaseDeleting means that a CSV has been replaced by a new one and will be checked for safety before being deleted + CSVPhaseDeleting ClusterServiceVersionPhase = "Deleting" + // CSVPhaseAny matches all other phases in CSV queries + CSVPhaseAny ClusterServiceVersionPhase = "" +) + +// ConditionReason is a camelcased reason for the state transition +type ConditionReason string + +const ( + CSVReasonRequirementsUnknown ConditionReason = "RequirementsUnknown" + CSVReasonRequirementsNotMet ConditionReason = "RequirementsNotMet" + CSVReasonRequirementsMet ConditionReason = "AllRequirementsMet" + CSVReasonOwnerConflict ConditionReason = "OwnerConflict" + CSVReasonComponentFailed ConditionReason = "InstallComponentFailed" + CSVReasonComponentFailedNoRetry ConditionReason = "InstallComponentFailedNoRetry" + CSVReasonInvalidStrategy ConditionReason = "InvalidInstallStrategy" + CSVReasonWaiting ConditionReason = "InstallWaiting" + CSVReasonInstallSuccessful ConditionReason = "InstallSucceeded" + CSVReasonInstallCheckFailed ConditionReason = "InstallCheckFailed" + CSVReasonComponentUnhealthy ConditionReason = "ComponentUnhealthy" + CSVReasonBeingReplaced ConditionReason = "BeingReplaced" + CSVReasonReplaced ConditionReason = "Replaced" + CSVReasonNeedsReinstall ConditionReason = "NeedsReinstall" + CSVReasonNeedsCertRotation ConditionReason = "NeedsCertRotation" + CSVReasonAPIServiceResourceIssue ConditionReason = "APIServiceResourceIssue" + CSVReasonAPIServiceResourcesNeedReinstall ConditionReason = "APIServiceResourcesNeedReinstall" + CSVReasonAPIServiceInstallFailed ConditionReason = "APIServiceInstallFailed" + CSVReasonCopied ConditionReason = "Copied" + CSVReasonInvalidInstallModes ConditionReason = "InvalidInstallModes" + CSVReasonNoTargetNamespaces ConditionReason = "NoTargetNamespaces" + CSVReasonUnsupportedOperatorGroup ConditionReason = "UnsupportedOperatorGroup" + CSVReasonNoOperatorGroup ConditionReason = "NoOperatorGroup" + CSVReasonTooManyOperatorGroups ConditionReason = "TooManyOperatorGroups" + CSVReasonInterOperatorGroupOwnerConflict ConditionReason = "InterOperatorGroupOwnerConflict" + CSVReasonCannotModifyStaticOperatorGroupProvidedAPIs ConditionReason = "CannotModifyStaticOperatorGroupProvidedAPIs" + CSVReasonDetectedClusterChange ConditionReason = "DetectedClusterChange" + CSVReasonInvalidWebhookDescription ConditionReason = "InvalidWebhookDescription" + CSVReasonOperatorConditionNotUpgradeable ConditionReason = "OperatorConditionNotUpgradeable" + CSVReasonWaitingForCleanupToComplete ConditionReason = "WaitingOnCleanup" +) + +// HasCaResources returns true if the CSV has owned APIServices or Webhooks. +func (c *ClusterServiceVersion) HasCAResources() bool { + // Return early if there are no owned APIServices + if len(c.Spec.APIServiceDefinitions.Owned)+len(c.Spec.WebhookDefinitions) == 0 { + return false + } + return true +} + +// Conditions appear in the status as a record of state transitions on the ClusterServiceVersion +// +k8s:openapi-gen=true +type ClusterServiceVersionCondition struct { + // Condition of the ClusterServiceVersion + Phase ClusterServiceVersionPhase `json:"phase,omitempty"` + // A human readable message indicating details about why the ClusterServiceVersion is in this condition. + // +optional + Message string `json:"message,omitempty"` + // A brief CamelCase message indicating details about why the ClusterServiceVersion is in this state. + // e.g. 'RequirementsNotMet' + // +optional + Reason ConditionReason `json:"reason,omitempty"` + // Last time we updated the status + // +optional + LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"` + // Last time the status transitioned from one status to another. + // +optional + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// OwnsCRD determines whether the current CSV owns a particular CRD. +func (csv ClusterServiceVersion) OwnsCRD(name string) bool { + for _, desc := range csv.Spec.CustomResourceDefinitions.Owned { + if desc.Name == name { + return true + } + } + + return false +} + +// OwnsAPIService determines whether the current CSV owns a particular APIService. +func (csv ClusterServiceVersion) OwnsAPIService(name string) bool { + for _, desc := range csv.Spec.APIServiceDefinitions.Owned { + apiServiceName := fmt.Sprintf("%s.%s", desc.Version, desc.Group) + if apiServiceName == name { + return true + } + } + + return false +} + +// StatusReason is a camelcased reason for the status of a RequirementStatus or DependentStatus +type StatusReason string + +const ( + RequirementStatusReasonPresent StatusReason = "Present" + RequirementStatusReasonNotPresent StatusReason = "NotPresent" + RequirementStatusReasonPresentNotSatisfied StatusReason = "PresentNotSatisfied" + // The CRD is present but the Established condition is False (not available) + RequirementStatusReasonNotAvailable StatusReason = "PresentNotAvailable" + DependentStatusReasonSatisfied StatusReason = "Satisfied" + DependentStatusReasonNotSatisfied StatusReason = "NotSatisfied" +) + +// DependentStatus is the status for a dependent requirement (to prevent infinite nesting) +// +k8s:openapi-gen=true +type DependentStatus struct { + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Status StatusReason `json:"status"` + UUID string `json:"uuid,omitempty"` + Message string `json:"message,omitempty"` +} + +// +k8s:openapi-gen=true +type RequirementStatus struct { + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Status StatusReason `json:"status"` + Message string `json:"message"` + UUID string `json:"uuid,omitempty"` + Dependents []DependentStatus `json:"dependents,omitempty"` +} + +// ClusterServiceVersionStatus represents information about the status of a CSV. Status may trail the actual +// state of a system. +// +k8s:openapi-gen=true +type ClusterServiceVersionStatus struct { + // Current condition of the ClusterServiceVersion + Phase ClusterServiceVersionPhase `json:"phase,omitempty"` + // A human readable message indicating details about why the ClusterServiceVersion is in this condition. + // +optional + Message string `json:"message,omitempty"` + // A brief CamelCase message indicating details about why the ClusterServiceVersion is in this state. + // e.g. 'RequirementsNotMet' + // +optional + Reason ConditionReason `json:"reason,omitempty"` + // Last time we updated the status + // +optional + LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"` + // Last time the status transitioned from one status to another. + // +optional + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + // List of conditions, a history of state transitions + Conditions []ClusterServiceVersionCondition `json:"conditions,omitempty"` + // The status of each requirement for this CSV + RequirementStatus []RequirementStatus `json:"requirementStatus,omitempty"` + // Last time the owned APIService certs were updated + // +optional + CertsLastUpdated *metav1.Time `json:"certsLastUpdated,omitempty"` + // Time the owned APIService certs will rotate next + // +optional + CertsRotateAt *metav1.Time `json:"certsRotateAt,omitempty"` + // CleanupStatus represents information about the status of cleanup while a CSV is pending deletion + // +optional + Cleanup CleanupStatus `json:"cleanup,omitempty"` +} + +// CleanupStatus represents information about the status of cleanup while a CSV is pending deletion +// +k8s:openapi-gen=true +type CleanupStatus struct { + // PendingDeletion is the list of custom resource objects that are pending deletion and blocked on finalizers. + // This indicates the progress of cleanup that is blocking CSV deletion or operator uninstall. + // +optional + PendingDeletion []ResourceList `json:"pendingDeletion,omitempty"` +} + +// ResourceList represents a list of resources which are of the same Group/Kind +// +k8s:openapi-gen=true +type ResourceList struct { + Group string `json:"group"` + Kind string `json:"kind"` + Instances []ResourceInstance `json:"instances"` +} + +// +k8s:openapi-gen=true +type ResourceInstance struct { + Name string `json:"name"` + // Namespace can be empty for cluster-scoped resources + Namespace string `json:"namespace,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient +// +kubebuilder:storageversion +// +kubebuilder:resource:shortName={csv, csvs},categories=olm +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Display",type=string,JSONPath=`.spec.displayName`,description="The name of the CSV" +// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version`,description="The version of the CSV" +// +kubebuilder:printcolumn:name="Replaces",type=string,JSONPath=`.spec.replaces`,description="The name of a CSV that this one replaces" +// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase` + +// ClusterServiceVersion is a Custom Resource of type `ClusterServiceVersionSpec`. +type ClusterServiceVersion struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec ClusterServiceVersionSpec `json:"spec"` + // +optional + Status ClusterServiceVersionStatus `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterServiceVersionList represents a list of ClusterServiceVersions. +type ClusterServiceVersionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []ClusterServiceVersion `json:"items"` +} + +// GetAllCRDDescriptions returns a deduplicated set of CRDDescriptions that is +// the union of the owned and required CRDDescriptions. +// +// Descriptions with the same name prefer the value in Owned. +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetAllCRDDescriptions() []CRDDescription { + set := make(map[string]CRDDescription) + for _, required := range csv.Spec.CustomResourceDefinitions.Required { + set[required.Name] = required + } + + for _, owned := range csv.Spec.CustomResourceDefinitions.Owned { + set[owned.Name] = owned + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]CRDDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} + +// GetAllAPIServiceDescriptions returns a deduplicated set of APIServiceDescriptions that is +// the union of the owned and required APIServiceDescriptions. +// +// Descriptions with the same name prefer the value in Owned. +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetAllAPIServiceDescriptions() []APIServiceDescription { + set := make(map[string]APIServiceDescription) + for _, required := range csv.Spec.APIServiceDefinitions.Required { + name := fmt.Sprintf("%s.%s", required.Version, required.Group) + set[name] = required + } + + for _, owned := range csv.Spec.APIServiceDefinitions.Owned { + name := fmt.Sprintf("%s.%s", owned.Version, owned.Group) + set[name] = owned + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]APIServiceDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} + +// GetRequiredAPIServiceDescriptions returns a deduplicated set of required APIServiceDescriptions +// with the intersection of required and owned removed +// Equivalent to the set subtraction required - owned +// +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetRequiredAPIServiceDescriptions() []APIServiceDescription { + set := make(map[string]APIServiceDescription) + for _, required := range csv.Spec.APIServiceDefinitions.Required { + name := fmt.Sprintf("%s.%s", required.Version, required.Group) + set[name] = required + } + + // Remove any shared owned from the set + for _, owned := range csv.Spec.APIServiceDefinitions.Owned { + name := fmt.Sprintf("%s.%s", owned.Version, owned.Group) + if _, ok := set[name]; ok { + delete(set, name) + } + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]APIServiceDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} + +// GetOwnedAPIServiceDescriptions returns a deduplicated set of owned APIServiceDescriptions +// +// Descriptions are returned in alphabetical order. +func (csv ClusterServiceVersion) GetOwnedAPIServiceDescriptions() []APIServiceDescription { + set := make(map[string]APIServiceDescription) + for _, owned := range csv.Spec.APIServiceDefinitions.Owned { + name := owned.GetName() + set[name] = owned + } + + keys := make([]string, 0) + for key := range set { + keys = append(keys, key) + } + sort.StringSlice(keys).Sort() + + descs := make([]APIServiceDescription, 0) + for _, key := range keys { + descs = append(descs, set[key]) + } + + return descs +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/doc.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/doc.go new file mode 100644 index 000000000..74bc9b819 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/doc.go @@ -0,0 +1,6 @@ +// +groupName=operators.coreos.com +// +k8s:deepcopy-gen=package +// +k8s:conversion-gen=github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators + +// Package v1alpha1 contains resources types for version v1alpha1 of the operators.coreos.com API group. +package v1alpha1 diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/installplan_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/installplan_types.go new file mode 100644 index 000000000..09deba525 --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/installplan_types.go @@ -0,0 +1,389 @@ +package v1alpha1 + +import ( + "errors" + "fmt" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + InstallPlanKind = "InstallPlan" + InstallPlanAPIVersion = GroupName + "/" + GroupVersion +) + +// Approval is the user approval policy for an InstallPlan. +// It must be one of "Automatic" or "Manual". +type Approval string + +const ( + ApprovalAutomatic Approval = "Automatic" + ApprovalManual Approval = "Manual" +) + +// InstallPlanSpec defines a set of Application resources to be installed +type InstallPlanSpec struct { + CatalogSource string `json:"source,omitempty"` + CatalogSourceNamespace string `json:"sourceNamespace,omitempty"` + ClusterServiceVersionNames []string `json:"clusterServiceVersionNames"` + Approval Approval `json:"approval"` + Approved bool `json:"approved"` + Generation int `json:"generation,omitempty"` +} + +// InstallPlanPhase is the current status of a InstallPlan as a whole. +type InstallPlanPhase string + +const ( + InstallPlanPhaseNone InstallPlanPhase = "" + InstallPlanPhasePlanning InstallPlanPhase = "Planning" + InstallPlanPhaseRequiresApproval InstallPlanPhase = "RequiresApproval" + InstallPlanPhaseInstalling InstallPlanPhase = "Installing" + InstallPlanPhaseComplete InstallPlanPhase = "Complete" + InstallPlanPhaseFailed InstallPlanPhase = "Failed" +) + +// InstallPlanConditionType describes the state of an InstallPlan at a certain point as a whole. +type InstallPlanConditionType string + +const ( + InstallPlanResolved InstallPlanConditionType = "Resolved" + InstallPlanInstalled InstallPlanConditionType = "Installed" +) + +// ConditionReason is a camelcased reason for the state transition. +type InstallPlanConditionReason string + +const ( + InstallPlanReasonPlanUnknown InstallPlanConditionReason = "PlanUnknown" + InstallPlanReasonInstallCheckFailed InstallPlanConditionReason = "InstallCheckFailed" + InstallPlanReasonDependencyConflict InstallPlanConditionReason = "DependenciesConflict" + InstallPlanReasonComponentFailed InstallPlanConditionReason = "InstallComponentFailed" +) + +// StepStatus is the current status of a particular resource an in +// InstallPlan +type StepStatus string + +const ( + StepStatusUnknown StepStatus = "Unknown" + StepStatusNotPresent StepStatus = "NotPresent" + StepStatusPresent StepStatus = "Present" + StepStatusCreated StepStatus = "Created" + StepStatusNotCreated StepStatus = "NotCreated" + StepStatusWaitingForAPI StepStatus = "WaitingForApi" + StepStatusUnsupportedResource StepStatus = "UnsupportedResource" +) + +// ErrInvalidInstallPlan is the error returned by functions that operate on +// InstallPlans when the InstallPlan does not contain totally valid data. +var ErrInvalidInstallPlan = errors.New("the InstallPlan contains invalid data") + +// InstallPlanStatus represents the information about the status of +// steps required to complete installation. +// +// Status may trail the actual state of a system. +type InstallPlanStatus struct { + Phase InstallPlanPhase `json:"phase"` + Conditions []InstallPlanCondition `json:"conditions,omitempty"` + CatalogSources []string `json:"catalogSources"` + Plan []*Step `json:"plan,omitempty"` + // BundleLookups is the set of in-progress requests to pull and unpackage bundle content to the cluster. + // +optional + BundleLookups []BundleLookup `json:"bundleLookups,omitempty"` + // AttenuatedServiceAccountRef references the service account that is used + // to do scoped operator install. + AttenuatedServiceAccountRef *corev1.ObjectReference `json:"attenuatedServiceAccountRef,omitempty"` + + // StartTime is the time when the controller began applying + // the resources listed in the plan to the cluster. + // +optional + StartTime *metav1.Time `json:"startTime,omitempty"` + + // Message is a human-readable message containing detailed + // information that may be important to understanding why the + // plan has its current status. + // +optional + Message string `json:"message,omitempty"` +} + +// InstallPlanCondition represents the overall status of the execution of +// an InstallPlan. +type InstallPlanCondition struct { + Type InstallPlanConditionType `json:"type,omitempty"` + Status corev1.ConditionStatus `json:"status,omitempty"` // True, False, or Unknown + LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + Reason InstallPlanConditionReason `json:"reason,omitempty"` + Message string `json:"message,omitempty"` +} + +// allow overwriting `now` function for deterministic tests +var now = metav1.Now + +// GetCondition returns the InstallPlanCondition of the given type if it exists in the InstallPlanStatus' Conditions. +// Returns a condition of the given type with a ConditionStatus of "Unknown" if not found. +func (s InstallPlanStatus) GetCondition(conditionType InstallPlanConditionType) InstallPlanCondition { + for _, cond := range s.Conditions { + if cond.Type == conditionType { + return cond + } + } + + return InstallPlanCondition{ + Type: conditionType, + Status: corev1.ConditionUnknown, + } +} + +// SetCondition adds or updates a condition, using `Type` as merge key. +func (s *InstallPlanStatus) SetCondition(cond InstallPlanCondition) InstallPlanCondition { + for i, existing := range s.Conditions { + if existing.Type != cond.Type { + continue + } + if existing.Status == cond.Status { + cond.LastTransitionTime = existing.LastTransitionTime + } + s.Conditions[i] = cond + return cond + } + s.Conditions = append(s.Conditions, cond) + return cond +} + +func OrderSteps(steps []*Step) []*Step { + // CSVs must be applied first + csvList := []*Step{} + + // CRDs must be applied second + crdList := []*Step{} + + // Other resources may be applied in any order + remainingResources := []*Step{} + for _, step := range steps { + switch step.Resource.Kind { + case crdKind: + crdList = append(crdList, step) + case ClusterServiceVersionKind: + csvList = append(csvList, step) + default: + remainingResources = append(remainingResources, step) + } + } + + result := make([]*Step, len(steps)) + i := 0 + + for j := range csvList { + result[i] = csvList[j] + i++ + } + + for j := range crdList { + result[i] = crdList[j] + i++ + } + + for j := range remainingResources { + result[i] = remainingResources[j] + i++ + } + + return result +} + +func (s InstallPlanStatus) NeedsRequeue() bool { + for _, step := range s.Plan { + switch step.Status { + case StepStatusWaitingForAPI: + return true + } + } + + return false +} +func ConditionFailed(cond InstallPlanConditionType, reason InstallPlanConditionReason, message string, now *metav1.Time) InstallPlanCondition { + return InstallPlanCondition{ + Type: cond, + Status: corev1.ConditionFalse, + Reason: reason, + Message: message, + LastUpdateTime: now, + LastTransitionTime: now, + } +} + +func ConditionMet(cond InstallPlanConditionType, now *metav1.Time) InstallPlanCondition { + return InstallPlanCondition{ + Type: cond, + Status: corev1.ConditionTrue, + LastUpdateTime: now, + LastTransitionTime: now, + } +} + +// Step represents the status of an individual step in an InstallPlan. +type Step struct { + Resolving string `json:"resolving"` + Resource StepResource `json:"resource"` + Optional bool `json:"optional,omitempty"` + Status StepStatus `json:"status"` +} + +// BundleLookupConditionType is a category of the overall state of a BundleLookup. +type BundleLookupConditionType string + +const ( + // BundleLookupPending describes BundleLookups that are not complete. + BundleLookupPending BundleLookupConditionType = "BundleLookupPending" + + // BundleLookupFailed describes conditions types for when BundleLookups fail + BundleLookupFailed BundleLookupConditionType = "BundleLookupFailed" + + crdKind = "CustomResourceDefinition" +) + +type BundleLookupCondition struct { + // Type of condition. + Type BundleLookupConditionType `json:"type"` + // Status of the condition, one of True, False, Unknown. + Status corev1.ConditionStatus `json:"status"` + // The reason for the condition's last transition. + // +optional + Reason string `json:"reason,omitempty"` + // A human readable message indicating details about the transition. + // +optional + Message string `json:"message,omitempty"` + // Last time the condition was probed. + // +optional + LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"` + // Last time the condition transitioned from one status to another. + // +optional + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// BundleLookup is a request to pull and unpackage the content of a bundle to the cluster. +type BundleLookup struct { + // Path refers to the location of a bundle to pull. + // It's typically an image reference. + Path string `json:"path"` + // Identifier is the catalog-unique name of the operator (the name of the CSV for bundles that contain CSVs) + Identifier string `json:"identifier"` + // Replaces is the name of the bundle to replace with the one found at Path. + Replaces string `json:"replaces"` + // CatalogSourceRef is a reference to the CatalogSource the bundle path was resolved from. + CatalogSourceRef *corev1.ObjectReference `json:"catalogSourceRef"` + // Conditions represents the overall state of a BundleLookup. + // +optional + Conditions []BundleLookupCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` + // The effective properties of the unpacked bundle. + // +optional + Properties string `json:"properties,omitempty"` +} + +// GetCondition returns the BundleLookupCondition of the given type if it exists in the BundleLookup's Conditions. +// Returns a condition of the given type with a ConditionStatus of "Unknown" if not found. +func (b BundleLookup) GetCondition(conditionType BundleLookupConditionType) BundleLookupCondition { + for _, cond := range b.Conditions { + if cond.Type == conditionType { + return cond + } + } + + return BundleLookupCondition{ + Type: conditionType, + Status: corev1.ConditionUnknown, + } +} + +// RemoveCondition removes the BundleLookupCondition of the given type from the BundleLookup's Conditions if it exists. +func (b *BundleLookup) RemoveCondition(conditionType BundleLookupConditionType) { + for i, cond := range b.Conditions { + if cond.Type == conditionType { + b.Conditions = append(b.Conditions[:i], b.Conditions[i+1:]...) + if len(b.Conditions) == 0 { + b.Conditions = nil + } + return + } + } +} + +// SetCondition replaces the existing BundleLookupCondition of the same type, or adds it if it was not found. +func (b *BundleLookup) SetCondition(cond BundleLookupCondition) BundleLookupCondition { + for i, existing := range b.Conditions { + if existing.Type != cond.Type { + continue + } + if existing.Status == cond.Status { + cond.LastTransitionTime = existing.LastTransitionTime + } + b.Conditions[i] = cond + return cond + } + b.Conditions = append(b.Conditions, cond) + + return cond +} + +func (s *Step) String() string { + return fmt.Sprintf("%s: %s (%s)", s.Resolving, s.Resource, s.Status) +} + +// StepResource represents the status of a resource to be tracked by an +// InstallPlan. +type StepResource struct { + CatalogSource string `json:"sourceName"` + CatalogSourceNamespace string `json:"sourceNamespace"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Manifest string `json:"manifest,omitempty"` +} + +func (r StepResource) String() string { + return fmt.Sprintf("%s[%s/%s/%s (%s/%s)]", r.Name, r.Group, r.Version, r.Kind, r.CatalogSource, r.CatalogSourceNamespace) +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient +// +kubebuilder:resource:shortName=ip,categories=olm +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="CSV",type=string,JSONPath=`.spec.clusterServiceVersionNames[0]`,description="The first CSV in the list of clusterServiceVersionNames" +// +kubebuilder:printcolumn:name="Approval",type=string,JSONPath=`.spec.approval`,description="The approval mode" +// +kubebuilder:printcolumn:name="Approved",type=boolean,JSONPath=`.spec.approved` + +// InstallPlan defines the installation of a set of operators. +type InstallPlan struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec InstallPlanSpec `json:"spec"` + // +optional + Status InstallPlanStatus `json:"status"` +} + +// EnsureCatalogSource ensures that a CatalogSource is present in the Status +// block of an InstallPlan. +func (p *InstallPlan) EnsureCatalogSource(sourceName string) { + for _, srcName := range p.Status.CatalogSources { + if srcName == sourceName { + return + } + } + + p.Status.CatalogSources = append(p.Status.CatalogSources, sourceName) +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InstallPlanList is a list of InstallPlan resources. +type InstallPlanList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []InstallPlan `json:"items"` +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/register.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/register.go new file mode 100644 index 000000000..f0331ba3e --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/register.go @@ -0,0 +1,55 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators" +) + +const ( + // GroupName is the group name used in this package. + GroupName = operators.GroupName + // GroupVersion is the group version used in this package. + GroupVersion = "v1alpha1" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion} + +// Kind takes an unqualified kind and returns back a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder initializes a scheme builder + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme is a global function that registers this API group & version to a scheme + AddToScheme = SchemeBuilder.AddToScheme + + // localSchemeBuilder is expected by generated conversion functions + localSchemeBuilder = &SchemeBuilder +) + +// addKnownTypes adds the list of known types to Scheme +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &CatalogSource{}, + &CatalogSourceList{}, + &InstallPlan{}, + &InstallPlanList{}, + &Subscription{}, + &SubscriptionList{}, + &ClusterServiceVersion{}, + &ClusterServiceVersionList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/subscription_types.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/subscription_types.go new file mode 100644 index 000000000..292fedf9b --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/subscription_types.go @@ -0,0 +1,360 @@ +package v1alpha1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +const ( + SubscriptionKind = "Subscription" + SubscriptionCRDAPIVersion = GroupName + "/" + GroupVersion +) + +// SubscriptionState tracks when updates are available, installing, or service is up to date +type SubscriptionState string + +const ( + SubscriptionStateNone = "" + SubscriptionStateFailed = "UpgradeFailed" + SubscriptionStateUpgradeAvailable = "UpgradeAvailable" + SubscriptionStateUpgradePending = "UpgradePending" + SubscriptionStateAtLatest = "AtLatestKnown" +) + +const ( + SubscriptionReasonInvalidCatalog ConditionReason = "InvalidCatalog" + SubscriptionReasonUpgradeSucceeded ConditionReason = "UpgradeSucceeded" +) + +// SubscriptionSpec defines an Application that can be installed +type SubscriptionSpec struct { + CatalogSource string `json:"source"` + CatalogSourceNamespace string `json:"sourceNamespace"` + Package string `json:"name"` + Channel string `json:"channel,omitempty"` + StartingCSV string `json:"startingCSV,omitempty"` + InstallPlanApproval Approval `json:"installPlanApproval,omitempty"` + Config *SubscriptionConfig `json:"config,omitempty"` +} + +// SubscriptionConfig contains configuration specified for a subscription. +type SubscriptionConfig struct { + // Selector is the label selector for pods to be configured. + // Existing ReplicaSets whose pods are + // selected by this will be the ones affected by this deployment. + // It must match the pod template's labels. + Selector *metav1.LabelSelector `json:"selector,omitempty"` + + // NodeSelector is a selector which must be true for the pod to fit on a node. + // Selector which must match a node's labels for the pod to be scheduled on that node. + // More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + // +optional + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + + // Tolerations are the pod's tolerations. + // +optional + Tolerations []corev1.Toleration `json:"tolerations,omitempty"` + + // Resources represents compute resources required by this container. + // Immutable. + // More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + // +optional + Resources *corev1.ResourceRequirements `json:"resources,omitempty"` + + // EnvFrom is a list of sources to populate environment variables in the container. + // The keys defined within a source must be a C_IDENTIFIER. All invalid keys + // will be reported as an event when the container is starting. When a key exists in multiple + // sources, the value associated with the last source will take precedence. + // Values defined by an Env with a duplicate key will take precedence. + // Immutable. + // +optional + EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"` + // Env is a list of environment variables to set in the container. + // Cannot be updated. + // +patchMergeKey=name + // +patchStrategy=merge + // +optional + Env []corev1.EnvVar `json:"env,omitempty" patchMergeKey:"name" patchStrategy:"merge"` + + // List of Volumes to set in the podSpec. + // +optional + Volumes []corev1.Volume `json:"volumes,omitempty"` + + // List of VolumeMounts to set in the container. + // +optional + VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"` + + // If specified, overrides the pod's scheduling constraints. + // nil sub-attributes will *not* override the original values in the pod.spec for those sub-attributes. + // Use empty object ({}) to erase original sub-attribute values. + // +optional + Affinity *corev1.Affinity `json:"affinity,omitempty" protobuf:"bytes,18,opt,name=affinity"` + + // Annotations is an unstructured key value map stored with each Deployment, Pod, APIService in the Operator. + // Typically, annotations may be set by external tools to store and retrieve arbitrary metadata. + // Use this field to pre-define annotations that OLM should add to each of the Subscription's + // deployments, pods, and apiservices. + // +optional + Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"` +} + +// SubscriptionConditionType indicates an explicit state condition about a Subscription in "abnormal-true" +// polarity form (see https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties). +type SubscriptionConditionType string + +const ( + // SubscriptionCatalogSourcesUnhealthy indicates that some or all of the CatalogSources to be used in resolution are unhealthy. + SubscriptionCatalogSourcesUnhealthy SubscriptionConditionType = "CatalogSourcesUnhealthy" + + // SubscriptionInstallPlanMissing indicates that a Subscription's InstallPlan is missing. + SubscriptionInstallPlanMissing SubscriptionConditionType = "InstallPlanMissing" + + // SubscriptionInstallPlanPending indicates that a Subscription's InstallPlan is pending installation. + SubscriptionInstallPlanPending SubscriptionConditionType = "InstallPlanPending" + + // SubscriptionInstallPlanFailed indicates that the installation of a Subscription's InstallPlan has failed. + SubscriptionInstallPlanFailed SubscriptionConditionType = "InstallPlanFailed" + + // SubscriptionResolutionFailed indicates that the dependency resolution in the namespace in which the subscription is created has failed + SubscriptionResolutionFailed SubscriptionConditionType = "ResolutionFailed" + + // SubscriptionBundleUnpacking indicates that the unpack job is currently running + SubscriptionBundleUnpacking SubscriptionConditionType = "BundleUnpacking" + + // SubscriptionBundleUnpackFailed indicates that the unpack job failed + SubscriptionBundleUnpackFailed SubscriptionConditionType = "BundleUnpackFailed" + + // SubscriptionDeprecated is a roll-up condition which indicates that the Operator currently installed with this Subscription + //has been deprecated. It will be present when any of the three deprecation types (Package, Channel, Bundle) are present. + SubscriptionDeprecated SubscriptionConditionType = "Deprecated" + + // SubscriptionOperatorDeprecated indicates that the Package currently installed with this Subscription has been deprecated. + SubscriptionPackageDeprecated SubscriptionConditionType = "PackageDeprecated" + + // SubscriptionOperatorDeprecated indicates that the Channel used with this Subscription has been deprecated. + SubscriptionChannelDeprecated SubscriptionConditionType = "ChannelDeprecated" + + // SubscriptionOperatorDeprecated indicates that the Bundle currently installed with this Subscription has been deprecated. + SubscriptionBundleDeprecated SubscriptionConditionType = "BundleDeprecated" +) + +const ( + // NoCatalogSourcesFound is a reason string for Subscriptions with unhealthy CatalogSources due to none being available. + NoCatalogSourcesFound = "NoCatalogSourcesFound" + + // AllCatalogSourcesHealthy is a reason string for Subscriptions that transitioned due to all CatalogSources being healthy. + AllCatalogSourcesHealthy = "AllCatalogSourcesHealthy" + + // CatalogSourcesAdded is a reason string for Subscriptions that transitioned due to CatalogSources being added. + CatalogSourcesAdded = "CatalogSourcesAdded" + + // CatalogSourcesUpdated is a reason string for Subscriptions that transitioned due to CatalogSource being updated. + CatalogSourcesUpdated = "CatalogSourcesUpdated" + + // CatalogSourcesDeleted is a reason string for Subscriptions that transitioned due to CatalogSources being removed. + CatalogSourcesDeleted = "CatalogSourcesDeleted" + + // UnhealthyCatalogSourceFound is a reason string for Subscriptions that transitioned because an unhealthy CatalogSource was found. + UnhealthyCatalogSourceFound = "UnhealthyCatalogSourceFound" + + // ReferencedInstallPlanNotFound is a reason string for Subscriptions that transitioned due to a referenced InstallPlan not being found. + ReferencedInstallPlanNotFound = "ReferencedInstallPlanNotFound" + + // InstallPlanNotYetReconciled is a reason string for Subscriptions that transitioned due to a referenced InstallPlan not being reconciled yet. + InstallPlanNotYetReconciled = "InstallPlanNotYetReconciled" + + // InstallPlanFailed is a reason string for Subscriptions that transitioned due to a referenced InstallPlan failing without setting an explicit failure condition. + InstallPlanFailed = "InstallPlanFailed" +) + +// SubscriptionCondition represents the latest available observations of a Subscription's state. +type SubscriptionCondition struct { + // Type is the type of Subscription condition. + Type SubscriptionConditionType `json:"type" description:"type of Subscription condition"` + + // Status is the status of the condition, one of True, False, Unknown. + Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"` + + // Reason is a one-word CamelCase reason for the condition's last transition. + // +optional + Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"` + + // Message is a human-readable message indicating details about last transition. + // +optional + Message string `json:"message,omitempty" description:"human-readable message indicating details about last transition"` + + // LastHeartbeatTime is the last time we got an update on a given condition + // +optional + LastHeartbeatTime *metav1.Time `json:"lastHeartbeatTime,omitempty" description:"last time we got an update on a given condition"` + + // LastTransitionTime is the last time the condition transit from one status to another + // +optional + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another" hash:"ignore"` +} + +// Equals returns true if a SubscriptionCondition equals the one given, false otherwise. +// Equality is determined by the equality of the type, status, reason, and message fields ONLY. +func (s SubscriptionCondition) Equals(condition SubscriptionCondition) bool { + return s.Type == condition.Type && s.Status == condition.Status && s.Reason == condition.Reason && s.Message == condition.Message +} + +type SubscriptionStatus struct { + // CurrentCSV is the CSV the Subscription is progressing to. + // +optional + CurrentCSV string `json:"currentCSV,omitempty"` + + // InstalledCSV is the CSV currently installed by the Subscription. + // +optional + InstalledCSV string `json:"installedCSV,omitempty"` + + // Install is a reference to the latest InstallPlan generated for the Subscription. + // DEPRECATED: InstallPlanRef + // +optional + Install *InstallPlanReference `json:"installplan,omitempty"` + + // State represents the current state of the Subscription + // +optional + State SubscriptionState `json:"state,omitempty"` + + // Reason is the reason the Subscription was transitioned to its current state. + // +optional + Reason ConditionReason `json:"reason,omitempty"` + + // InstallPlanGeneration is the current generation of the installplan + // +optional + InstallPlanGeneration int `json:"installPlanGeneration,omitempty"` + + // InstallPlanRef is a reference to the latest InstallPlan that contains the Subscription's current CSV. + // +optional + InstallPlanRef *corev1.ObjectReference `json:"installPlanRef,omitempty"` + + // CatalogHealth contains the Subscription's view of its relevant CatalogSources' status. + // It is used to determine SubscriptionStatusConditions related to CatalogSources. + // +optional + CatalogHealth []SubscriptionCatalogHealth `json:"catalogHealth,omitempty"` + + // Conditions is a list of the latest available observations about a Subscription's current state. + // +optional + Conditions []SubscriptionCondition `json:"conditions,omitempty" hash:"set"` + + // LastUpdated represents the last time that the Subscription status was updated. + LastUpdated metav1.Time `json:"lastUpdated"` +} + +// GetCondition returns the SubscriptionCondition of the given type if it exists in the SubscriptionStatus' Conditions. +// Returns a condition of the given type with a ConditionStatus of "Unknown" if not found. +func (s SubscriptionStatus) GetCondition(conditionType SubscriptionConditionType) SubscriptionCondition { + for _, cond := range s.Conditions { + if cond.Type == conditionType { + return cond + } + } + + return SubscriptionCondition{ + Type: conditionType, + Status: corev1.ConditionUnknown, + } +} + +// SetCondition sets the given SubscriptionCondition in the SubscriptionStatus' Conditions. +func (s *SubscriptionStatus) SetCondition(condition SubscriptionCondition) { + for i, cond := range s.Conditions { + if cond.Type == condition.Type { + s.Conditions[i] = condition + return + } + } + + s.Conditions = append(s.Conditions, condition) +} + +// RemoveConditions removes any conditions of the given types from the SubscriptionStatus' Conditions. +func (s *SubscriptionStatus) RemoveConditions(remove ...SubscriptionConditionType) { + exclusions := map[SubscriptionConditionType]struct{}{} + for _, r := range remove { + exclusions[r] = struct{}{} + } + + var filtered []SubscriptionCondition + for _, cond := range s.Conditions { + if _, ok := exclusions[cond.Type]; ok { + // Skip excluded condition types + continue + } + filtered = append(filtered, cond) + } + + s.Conditions = filtered +} + +type InstallPlanReference struct { + APIVersion string `json:"apiVersion"` + Kind string `json:"kind"` + Name string `json:"name"` + UID types.UID `json:"uuid"` +} + +// SubscriptionCatalogHealth describes the health of a CatalogSource the Subscription knows about. +type SubscriptionCatalogHealth struct { + // CatalogSourceRef is a reference to a CatalogSource. + CatalogSourceRef *corev1.ObjectReference `json:"catalogSourceRef"` + + // LastUpdated represents the last time that the CatalogSourceHealth changed + LastUpdated *metav1.Time `json:"lastUpdated"` + + // Healthy is true if the CatalogSource is healthy; false otherwise. + Healthy bool `json:"healthy"` +} + +// Equals returns true if a SubscriptionCatalogHealth equals the one given, false otherwise. +// Equality is based SOLEY on health and UID. +func (s SubscriptionCatalogHealth) Equals(health SubscriptionCatalogHealth) bool { + return s.Healthy == health.Healthy && s.CatalogSourceRef.UID == health.CatalogSourceRef.UID +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient +// +kubebuilder:resource:shortName={sub, subs},categories=olm +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Package",type=string,JSONPath=`.spec.name`,description="The package subscribed to" +// +kubebuilder:printcolumn:name="Source",type=string,JSONPath=`.spec.source`,description="The catalog source for the specified package" +// +kubebuilder:printcolumn:name="Channel",type=string,JSONPath=`.spec.channel`,description="The channel of updates to subscribe to" + +// Subscription keeps operators up to date by tracking changes to Catalogs. +type Subscription struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec *SubscriptionSpec `json:"spec"` + // +optional + Status SubscriptionStatus `json:"status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// SubscriptionList is a list of Subscription resources. +type SubscriptionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []Subscription `json:"items"` +} + +// GetInstallPlanApproval gets the configured install plan approval or the default +func (s *Subscription) GetInstallPlanApproval() Approval { + if s.Spec.InstallPlanApproval == ApprovalManual { + return ApprovalManual + } + return ApprovalAutomatic +} + +// NewInstallPlanReference returns an InstallPlanReference for the given ObjectReference. +func NewInstallPlanReference(ref *corev1.ObjectReference) *InstallPlanReference { + return &InstallPlanReference{ + APIVersion: ref.APIVersion, + Kind: ref.Kind, + Name: ref.Name, + UID: ref.UID, + } +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..684a7432a --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,1632 @@ +//go:build !ignore_autogenerated + +/* + +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 v1alpha1 + +import ( + "encoding/json" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/intstr" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIResourceReference) DeepCopyInto(out *APIResourceReference) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceReference. +func (in *APIResourceReference) DeepCopy() *APIResourceReference { + if in == nil { + return nil + } + out := new(APIResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServiceDefinitions) DeepCopyInto(out *APIServiceDefinitions) { + *out = *in + if in.Owned != nil { + in, out := &in.Owned, &out.Owned + *out = make([]APIServiceDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Required != nil { + in, out := &in.Required, &out.Required + *out = make([]APIServiceDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceDefinitions. +func (in *APIServiceDefinitions) DeepCopy() *APIServiceDefinitions { + if in == nil { + return nil + } + out := new(APIServiceDefinitions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServiceDescription) DeepCopyInto(out *APIServiceDescription) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]APIResourceReference, len(*in)) + copy(*out, *in) + } + if in.StatusDescriptors != nil { + in, out := &in.StatusDescriptors, &out.StatusDescriptors + *out = make([]StatusDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SpecDescriptors != nil { + in, out := &in.SpecDescriptors, &out.SpecDescriptors + *out = make([]SpecDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ActionDescriptor != nil { + in, out := &in.ActionDescriptor, &out.ActionDescriptor + *out = make([]ActionDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceDescription. +func (in *APIServiceDescription) DeepCopy() *APIServiceDescription { + if in == nil { + return nil + } + out := new(APIServiceDescription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ActionDescriptor) DeepCopyInto(out *ActionDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ActionDescriptor. +func (in *ActionDescriptor) DeepCopy() *ActionDescriptor { + if in == nil { + return nil + } + out := new(ActionDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AppLink) DeepCopyInto(out *AppLink) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppLink. +func (in *AppLink) DeepCopy() *AppLink { + if in == nil { + return nil + } + out := new(AppLink) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BundleLookup) DeepCopyInto(out *BundleLookup) { + *out = *in + if in.CatalogSourceRef != nil { + in, out := &in.CatalogSourceRef, &out.CatalogSourceRef + *out = new(v1.ObjectReference) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]BundleLookupCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleLookup. +func (in *BundleLookup) DeepCopy() *BundleLookup { + if in == nil { + return nil + } + out := new(BundleLookup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BundleLookupCondition) DeepCopyInto(out *BundleLookupCondition) { + *out = *in + if in.LastUpdateTime != nil { + in, out := &in.LastUpdateTime, &out.LastUpdateTime + *out = (*in).DeepCopy() + } + if in.LastTransitionTime != nil { + in, out := &in.LastTransitionTime, &out.LastTransitionTime + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleLookupCondition. +func (in *BundleLookupCondition) DeepCopy() *BundleLookupCondition { + if in == nil { + return nil + } + out := new(BundleLookupCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CRDDescription) DeepCopyInto(out *CRDDescription) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]APIResourceReference, len(*in)) + copy(*out, *in) + } + if in.StatusDescriptors != nil { + in, out := &in.StatusDescriptors, &out.StatusDescriptors + *out = make([]StatusDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SpecDescriptors != nil { + in, out := &in.SpecDescriptors, &out.SpecDescriptors + *out = make([]SpecDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ActionDescriptor != nil { + in, out := &in.ActionDescriptor, &out.ActionDescriptor + *out = make([]ActionDescriptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CRDDescription. +func (in *CRDDescription) DeepCopy() *CRDDescription { + if in == nil { + return nil + } + out := new(CRDDescription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSource) DeepCopyInto(out *CatalogSource) { + *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 CatalogSource. +func (in *CatalogSource) DeepCopy() *CatalogSource { + if in == nil { + return nil + } + out := new(CatalogSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CatalogSource) 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 *CatalogSourceList) DeepCopyInto(out *CatalogSourceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CatalogSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceList. +func (in *CatalogSourceList) DeepCopy() *CatalogSourceList { + if in == nil { + return nil + } + out := new(CatalogSourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CatalogSourceList) 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 *CatalogSourceSpec) DeepCopyInto(out *CatalogSourceSpec) { + *out = *in + if in.GrpcPodConfig != nil { + in, out := &in.GrpcPodConfig, &out.GrpcPodConfig + *out = new(GrpcPodConfig) + (*in).DeepCopyInto(*out) + } + if in.UpdateStrategy != nil { + in, out := &in.UpdateStrategy, &out.UpdateStrategy + *out = new(UpdateStrategy) + (*in).DeepCopyInto(*out) + } + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]string, len(*in)) + copy(*out, *in) + } + out.Icon = in.Icon +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceSpec. +func (in *CatalogSourceSpec) DeepCopy() *CatalogSourceSpec { + if in == nil { + return nil + } + out := new(CatalogSourceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogSourceStatus) DeepCopyInto(out *CatalogSourceStatus) { + *out = *in + if in.LatestImageRegistryPoll != nil { + in, out := &in.LatestImageRegistryPoll, &out.LatestImageRegistryPoll + *out = (*in).DeepCopy() + } + if in.ConfigMapResource != nil { + in, out := &in.ConfigMapResource, &out.ConfigMapResource + *out = new(ConfigMapResourceReference) + (*in).DeepCopyInto(*out) + } + if in.RegistryServiceStatus != nil { + in, out := &in.RegistryServiceStatus, &out.RegistryServiceStatus + *out = new(RegistryServiceStatus) + (*in).DeepCopyInto(*out) + } + if in.GRPCConnectionState != nil { + in, out := &in.GRPCConnectionState, &out.GRPCConnectionState + *out = new(GRPCConnectionState) + (*in).DeepCopyInto(*out) + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSourceStatus. +func (in *CatalogSourceStatus) DeepCopy() *CatalogSourceStatus { + if in == nil { + return nil + } + out := new(CatalogSourceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CleanupSpec) DeepCopyInto(out *CleanupSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CleanupSpec. +func (in *CleanupSpec) DeepCopy() *CleanupSpec { + if in == nil { + return nil + } + out := new(CleanupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CleanupStatus) DeepCopyInto(out *CleanupStatus) { + *out = *in + if in.PendingDeletion != nil { + in, out := &in.PendingDeletion, &out.PendingDeletion + *out = make([]ResourceList, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CleanupStatus. +func (in *CleanupStatus) DeepCopy() *CleanupStatus { + if in == nil { + return nil + } + out := new(CleanupStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersion) DeepCopyInto(out *ClusterServiceVersion) { + *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 ClusterServiceVersion. +func (in *ClusterServiceVersion) DeepCopy() *ClusterServiceVersion { + if in == nil { + return nil + } + out := new(ClusterServiceVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterServiceVersion) 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 *ClusterServiceVersionCondition) DeepCopyInto(out *ClusterServiceVersionCondition) { + *out = *in + if in.LastUpdateTime != nil { + in, out := &in.LastUpdateTime, &out.LastUpdateTime + *out = (*in).DeepCopy() + } + if in.LastTransitionTime != nil { + in, out := &in.LastTransitionTime, &out.LastTransitionTime + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionCondition. +func (in *ClusterServiceVersionCondition) DeepCopy() *ClusterServiceVersionCondition { + if in == nil { + return nil + } + out := new(ClusterServiceVersionCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionList) DeepCopyInto(out *ClusterServiceVersionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterServiceVersion, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionList. +func (in *ClusterServiceVersionList) DeepCopy() *ClusterServiceVersionList { + if in == nil { + return nil + } + out := new(ClusterServiceVersionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterServiceVersionList) 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 *ClusterServiceVersionSpec) DeepCopyInto(out *ClusterServiceVersionSpec) { + *out = *in + in.InstallStrategy.DeepCopyInto(&out.InstallStrategy) + in.Version.DeepCopyInto(&out.Version) + in.CustomResourceDefinitions.DeepCopyInto(&out.CustomResourceDefinitions) + in.APIServiceDefinitions.DeepCopyInto(&out.APIServiceDefinitions) + if in.WebhookDefinitions != nil { + in, out := &in.WebhookDefinitions, &out.WebhookDefinitions + *out = make([]WebhookDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.NativeAPIs != nil { + in, out := &in.NativeAPIs, &out.NativeAPIs + *out = make([]metav1.GroupVersionKind, len(*in)) + copy(*out, *in) + } + if in.Keywords != nil { + in, out := &in.Keywords, &out.Keywords + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Maintainers != nil { + in, out := &in.Maintainers, &out.Maintainers + *out = make([]Maintainer, len(*in)) + copy(*out, *in) + } + out.Provider = in.Provider + if in.Links != nil { + in, out := &in.Links, &out.Links + *out = make([]AppLink, len(*in)) + copy(*out, *in) + } + if in.Icon != nil { + in, out := &in.Icon, &out.Icon + *out = make([]Icon, len(*in)) + copy(*out, *in) + } + if in.InstallModes != nil { + in, out := &in.InstallModes, &out.InstallModes + *out = make([]InstallMode, len(*in)) + copy(*out, *in) + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + out.Cleanup = in.Cleanup + if in.Skips != nil { + in, out := &in.Skips, &out.Skips + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.RelatedImages != nil { + in, out := &in.RelatedImages, &out.RelatedImages + *out = make([]RelatedImage, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionSpec. +func (in *ClusterServiceVersionSpec) DeepCopy() *ClusterServiceVersionSpec { + if in == nil { + return nil + } + out := new(ClusterServiceVersionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceVersionStatus) DeepCopyInto(out *ClusterServiceVersionStatus) { + *out = *in + if in.LastUpdateTime != nil { + in, out := &in.LastUpdateTime, &out.LastUpdateTime + *out = (*in).DeepCopy() + } + if in.LastTransitionTime != nil { + in, out := &in.LastTransitionTime, &out.LastTransitionTime + *out = (*in).DeepCopy() + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]ClusterServiceVersionCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RequirementStatus != nil { + in, out := &in.RequirementStatus, &out.RequirementStatus + *out = make([]RequirementStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CertsLastUpdated != nil { + in, out := &in.CertsLastUpdated, &out.CertsLastUpdated + *out = (*in).DeepCopy() + } + if in.CertsRotateAt != nil { + in, out := &in.CertsRotateAt, &out.CertsRotateAt + *out = (*in).DeepCopy() + } + in.Cleanup.DeepCopyInto(&out.Cleanup) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceVersionStatus. +func (in *ClusterServiceVersionStatus) DeepCopy() *ClusterServiceVersionStatus { + if in == nil { + return nil + } + out := new(ClusterServiceVersionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConfigMapResourceReference) DeepCopyInto(out *ConfigMapResourceReference) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapResourceReference. +func (in *ConfigMapResourceReference) DeepCopy() *ConfigMapResourceReference { + if in == nil { + return nil + } + out := new(ConfigMapResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomResourceDefinitions) DeepCopyInto(out *CustomResourceDefinitions) { + *out = *in + if in.Owned != nil { + in, out := &in.Owned, &out.Owned + *out = make([]CRDDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Required != nil { + in, out := &in.Required, &out.Required + *out = make([]CRDDescription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomResourceDefinitions. +func (in *CustomResourceDefinitions) DeepCopy() *CustomResourceDefinitions { + if in == nil { + return nil + } + out := new(CustomResourceDefinitions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DependentStatus) DeepCopyInto(out *DependentStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DependentStatus. +func (in *DependentStatus) DeepCopy() *DependentStatus { + if in == nil { + return nil + } + out := new(DependentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtractContentConfig) DeepCopyInto(out *ExtractContentConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtractContentConfig. +func (in *ExtractContentConfig) DeepCopy() *ExtractContentConfig { + if in == nil { + return nil + } + out := new(ExtractContentConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GRPCConnectionState) DeepCopyInto(out *GRPCConnectionState) { + *out = *in + in.LastConnectTime.DeepCopyInto(&out.LastConnectTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GRPCConnectionState. +func (in *GRPCConnectionState) DeepCopy() *GRPCConnectionState { + if in == nil { + return nil + } + out := new(GRPCConnectionState) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GrpcPodConfig) DeepCopyInto(out *GrpcPodConfig) { + *out = *in + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(v1.Affinity) + (*in).DeepCopyInto(*out) + } + if in.PriorityClassName != nil { + in, out := &in.PriorityClassName, &out.PriorityClassName + *out = new(string) + **out = **in + } + if in.MemoryTarget != nil { + in, out := &in.MemoryTarget, &out.MemoryTarget + x := (*in).DeepCopy() + *out = &x + } + if in.ExtractContent != nil { + in, out := &in.ExtractContent, &out.ExtractContent + *out = new(ExtractContentConfig) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrpcPodConfig. +func (in *GrpcPodConfig) DeepCopy() *GrpcPodConfig { + if in == nil { + return nil + } + out := new(GrpcPodConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Icon) DeepCopyInto(out *Icon) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Icon. +func (in *Icon) DeepCopy() *Icon { + if in == nil { + return nil + } + out := new(Icon) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallMode) DeepCopyInto(out *InstallMode) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallMode. +func (in *InstallMode) DeepCopy() *InstallMode { + if in == nil { + return nil + } + out := new(InstallMode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in InstallModeSet) DeepCopyInto(out *InstallModeSet) { + { + in := &in + *out = make(InstallModeSet, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallModeSet. +func (in InstallModeSet) DeepCopy() InstallModeSet { + if in == nil { + return nil + } + out := new(InstallModeSet) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlan) DeepCopyInto(out *InstallPlan) { + *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 InstallPlan. +func (in *InstallPlan) DeepCopy() *InstallPlan { + if in == nil { + return nil + } + out := new(InstallPlan) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallPlan) 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 *InstallPlanCondition) DeepCopyInto(out *InstallPlanCondition) { + *out = *in + if in.LastUpdateTime != nil { + in, out := &in.LastUpdateTime, &out.LastUpdateTime + *out = (*in).DeepCopy() + } + if in.LastTransitionTime != nil { + in, out := &in.LastTransitionTime, &out.LastTransitionTime + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanCondition. +func (in *InstallPlanCondition) DeepCopy() *InstallPlanCondition { + if in == nil { + return nil + } + out := new(InstallPlanCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanList) DeepCopyInto(out *InstallPlanList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]InstallPlan, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanList. +func (in *InstallPlanList) DeepCopy() *InstallPlanList { + if in == nil { + return nil + } + out := new(InstallPlanList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InstallPlanList) 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 *InstallPlanReference) DeepCopyInto(out *InstallPlanReference) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanReference. +func (in *InstallPlanReference) DeepCopy() *InstallPlanReference { + if in == nil { + return nil + } + out := new(InstallPlanReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanSpec) DeepCopyInto(out *InstallPlanSpec) { + *out = *in + if in.ClusterServiceVersionNames != nil { + in, out := &in.ClusterServiceVersionNames, &out.ClusterServiceVersionNames + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanSpec. +func (in *InstallPlanSpec) DeepCopy() *InstallPlanSpec { + if in == nil { + return nil + } + out := new(InstallPlanSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallPlanStatus) DeepCopyInto(out *InstallPlanStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]InstallPlanCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CatalogSources != nil { + in, out := &in.CatalogSources, &out.CatalogSources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Plan != nil { + in, out := &in.Plan, &out.Plan + *out = make([]*Step, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Step) + **out = **in + } + } + } + if in.BundleLookups != nil { + in, out := &in.BundleLookups, &out.BundleLookups + *out = make([]BundleLookup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.AttenuatedServiceAccountRef != nil { + in, out := &in.AttenuatedServiceAccountRef, &out.AttenuatedServiceAccountRef + *out = new(v1.ObjectReference) + **out = **in + } + if in.StartTime != nil { + in, out := &in.StartTime, &out.StartTime + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallPlanStatus. +func (in *InstallPlanStatus) DeepCopy() *InstallPlanStatus { + if in == nil { + return nil + } + out := new(InstallPlanStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Maintainer) DeepCopyInto(out *Maintainer) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Maintainer. +func (in *Maintainer) DeepCopy() *Maintainer { + if in == nil { + return nil + } + out := new(Maintainer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NamedInstallStrategy) DeepCopyInto(out *NamedInstallStrategy) { + *out = *in + in.StrategySpec.DeepCopyInto(&out.StrategySpec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedInstallStrategy. +func (in *NamedInstallStrategy) DeepCopy() *NamedInstallStrategy { + if in == nil { + return nil + } + out := new(NamedInstallStrategy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegistryPoll) DeepCopyInto(out *RegistryPoll) { + *out = *in + if in.Interval != nil { + in, out := &in.Interval, &out.Interval + *out = new(metav1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryPoll. +func (in *RegistryPoll) DeepCopy() *RegistryPoll { + if in == nil { + return nil + } + out := new(RegistryPoll) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegistryServiceStatus) DeepCopyInto(out *RegistryServiceStatus) { + *out = *in + in.CreatedAt.DeepCopyInto(&out.CreatedAt) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryServiceStatus. +func (in *RegistryServiceStatus) DeepCopy() *RegistryServiceStatus { + if in == nil { + return nil + } + out := new(RegistryServiceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RelatedImage) DeepCopyInto(out *RelatedImage) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RelatedImage. +func (in *RelatedImage) DeepCopy() *RelatedImage { + if in == nil { + return nil + } + out := new(RelatedImage) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RequirementStatus) DeepCopyInto(out *RequirementStatus) { + *out = *in + if in.Dependents != nil { + in, out := &in.Dependents, &out.Dependents + *out = make([]DependentStatus, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequirementStatus. +func (in *RequirementStatus) DeepCopy() *RequirementStatus { + if in == nil { + return nil + } + out := new(RequirementStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceInstance) DeepCopyInto(out *ResourceInstance) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceInstance. +func (in *ResourceInstance) DeepCopy() *ResourceInstance { + if in == nil { + return nil + } + out := new(ResourceInstance) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceList) DeepCopyInto(out *ResourceList) { + *out = *in + if in.Instances != nil { + in, out := &in.Instances, &out.Instances + *out = make([]ResourceInstance, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceList. +func (in *ResourceList) DeepCopy() *ResourceList { + if in == nil { + return nil + } + out := new(ResourceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpecDescriptor) DeepCopyInto(out *SpecDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpecDescriptor. +func (in *SpecDescriptor) DeepCopy() *SpecDescriptor { + if in == nil { + return nil + } + out := new(SpecDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StatusDescriptor) DeepCopyInto(out *StatusDescriptor) { + *out = *in + if in.XDescriptors != nil { + in, out := &in.XDescriptors, &out.XDescriptors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = make(json.RawMessage, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatusDescriptor. +func (in *StatusDescriptor) DeepCopy() *StatusDescriptor { + if in == nil { + return nil + } + out := new(StatusDescriptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Step) DeepCopyInto(out *Step) { + *out = *in + out.Resource = in.Resource +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Step. +func (in *Step) DeepCopy() *Step { + if in == nil { + return nil + } + out := new(Step) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StepResource) DeepCopyInto(out *StepResource) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StepResource. +func (in *StepResource) DeepCopy() *StepResource { + if in == nil { + return nil + } + out := new(StepResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StrategyDeploymentPermissions) DeepCopyInto(out *StrategyDeploymentPermissions) { + *out = *in + if in.Rules != nil { + in, out := &in.Rules, &out.Rules + *out = make([]rbacv1.PolicyRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategyDeploymentPermissions. +func (in *StrategyDeploymentPermissions) DeepCopy() *StrategyDeploymentPermissions { + if in == nil { + return nil + } + out := new(StrategyDeploymentPermissions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StrategyDeploymentSpec) DeepCopyInto(out *StrategyDeploymentSpec) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) + if in.Label != nil { + in, out := &in.Label, &out.Label + *out = make(labels.Set, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategyDeploymentSpec. +func (in *StrategyDeploymentSpec) DeepCopy() *StrategyDeploymentSpec { + if in == nil { + return nil + } + out := new(StrategyDeploymentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StrategyDetailsDeployment) DeepCopyInto(out *StrategyDetailsDeployment) { + *out = *in + if in.DeploymentSpecs != nil { + in, out := &in.DeploymentSpecs, &out.DeploymentSpecs + *out = make([]StrategyDeploymentSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Permissions != nil { + in, out := &in.Permissions, &out.Permissions + *out = make([]StrategyDeploymentPermissions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ClusterPermissions != nil { + in, out := &in.ClusterPermissions, &out.ClusterPermissions + *out = make([]StrategyDeploymentPermissions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StrategyDetailsDeployment. +func (in *StrategyDetailsDeployment) DeepCopy() *StrategyDetailsDeployment { + if in == nil { + return nil + } + out := new(StrategyDetailsDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Subscription) DeepCopyInto(out *Subscription) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Spec != nil { + in, out := &in.Spec, &out.Spec + *out = new(SubscriptionSpec) + (*in).DeepCopyInto(*out) + } + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subscription. +func (in *Subscription) DeepCopy() *Subscription { + if in == nil { + return nil + } + out := new(Subscription) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Subscription) 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 *SubscriptionCatalogHealth) DeepCopyInto(out *SubscriptionCatalogHealth) { + *out = *in + if in.CatalogSourceRef != nil { + in, out := &in.CatalogSourceRef, &out.CatalogSourceRef + *out = new(v1.ObjectReference) + **out = **in + } + if in.LastUpdated != nil { + in, out := &in.LastUpdated, &out.LastUpdated + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionCatalogHealth. +func (in *SubscriptionCatalogHealth) DeepCopy() *SubscriptionCatalogHealth { + if in == nil { + return nil + } + out := new(SubscriptionCatalogHealth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionCondition) DeepCopyInto(out *SubscriptionCondition) { + *out = *in + if in.LastHeartbeatTime != nil { + in, out := &in.LastHeartbeatTime, &out.LastHeartbeatTime + *out = (*in).DeepCopy() + } + if in.LastTransitionTime != nil { + in, out := &in.LastTransitionTime, &out.LastTransitionTime + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionCondition. +func (in *SubscriptionCondition) DeepCopy() *SubscriptionCondition { + if in == nil { + return nil + } + out := new(SubscriptionCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionConfig) DeepCopyInto(out *SubscriptionConfig) { + *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.EnvFrom != nil { + in, out := &in.EnvFrom, &out.EnvFrom + *out = make([]v1.EnvFromSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]v1.EnvVar, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Volumes != nil { + in, out := &in.Volumes, &out.Volumes + *out = make([]v1.Volume, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.VolumeMounts != nil { + in, out := &in.VolumeMounts, &out.VolumeMounts + *out = make([]v1.VolumeMount, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(v1.Affinity) + (*in).DeepCopyInto(*out) + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *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 SubscriptionConfig. +func (in *SubscriptionConfig) DeepCopy() *SubscriptionConfig { + if in == nil { + return nil + } + out := new(SubscriptionConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionList) DeepCopyInto(out *SubscriptionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Subscription, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionList. +func (in *SubscriptionList) DeepCopy() *SubscriptionList { + if in == nil { + return nil + } + out := new(SubscriptionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SubscriptionList) 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 *SubscriptionSpec) DeepCopyInto(out *SubscriptionSpec) { + *out = *in + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = new(SubscriptionConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionSpec. +func (in *SubscriptionSpec) DeepCopy() *SubscriptionSpec { + if in == nil { + return nil + } + out := new(SubscriptionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionStatus) DeepCopyInto(out *SubscriptionStatus) { + *out = *in + if in.Install != nil { + in, out := &in.Install, &out.Install + *out = new(InstallPlanReference) + **out = **in + } + if in.InstallPlanRef != nil { + in, out := &in.InstallPlanRef, &out.InstallPlanRef + *out = new(v1.ObjectReference) + **out = **in + } + if in.CatalogHealth != nil { + in, out := &in.CatalogHealth, &out.CatalogHealth + *out = make([]SubscriptionCatalogHealth, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]SubscriptionCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.LastUpdated.DeepCopyInto(&out.LastUpdated) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionStatus. +func (in *SubscriptionStatus) DeepCopy() *SubscriptionStatus { + if in == nil { + return nil + } + out := new(SubscriptionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UpdateStrategy) DeepCopyInto(out *UpdateStrategy) { + *out = *in + if in.RegistryPoll != nil { + in, out := &in.RegistryPoll, &out.RegistryPoll + *out = new(RegistryPoll) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpdateStrategy. +func (in *UpdateStrategy) DeepCopy() *UpdateStrategy { + if in == nil { + return nil + } + out := new(UpdateStrategy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WebhookDescription) DeepCopyInto(out *WebhookDescription) { + *out = *in + if in.TargetPort != nil { + in, out := &in.TargetPort, &out.TargetPort + *out = new(intstr.IntOrString) + **out = **in + } + if in.Rules != nil { + in, out := &in.Rules, &out.Rules + *out = make([]admissionregistrationv1.RuleWithOperations, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FailurePolicy != nil { + in, out := &in.FailurePolicy, &out.FailurePolicy + *out = new(admissionregistrationv1.FailurePolicyType) + **out = **in + } + if in.MatchPolicy != nil { + in, out := &in.MatchPolicy, &out.MatchPolicy + *out = new(admissionregistrationv1.MatchPolicyType) + **out = **in + } + if in.ObjectSelector != nil { + in, out := &in.ObjectSelector, &out.ObjectSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.SideEffects != nil { + in, out := &in.SideEffects, &out.SideEffects + *out = new(admissionregistrationv1.SideEffectClass) + **out = **in + } + if in.TimeoutSeconds != nil { + in, out := &in.TimeoutSeconds, &out.TimeoutSeconds + *out = new(int32) + **out = **in + } + if in.AdmissionReviewVersions != nil { + in, out := &in.AdmissionReviewVersions, &out.AdmissionReviewVersions + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ReinvocationPolicy != nil { + in, out := &in.ReinvocationPolicy, &out.ReinvocationPolicy + *out = new(admissionregistrationv1.ReinvocationPolicyType) + **out = **in + } + if in.WebhookPath != nil { + in, out := &in.WebhookPath, &out.WebhookPath + *out = new(string) + **out = **in + } + if in.ConversionCRDs != nil { + in, out := &in.ConversionCRDs, &out.ConversionCRDs + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookDescription. +func (in *WebhookDescription) DeepCopy() *WebhookDescription { + if in == nil { + return nil + } + out := new(WebhookDescription) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/version/version.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/version/version.go new file mode 100644 index 000000000..a0ffb9fcb --- /dev/null +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/version/version.go @@ -0,0 +1,67 @@ +package version + +import ( + "encoding/json" + + semver "github.com/blang/semver/v4" +) + +// +k8s:openapi-gen=true +// OperatorVersion is a wrapper around semver.Version which supports correct +// marshaling to YAML and JSON. +// +kubebuilder:validation:Type=string +type OperatorVersion struct { + semver.Version `json:"-"` +} + +// DeepCopyInto creates a deep-copy of the Version value. +func (v *OperatorVersion) DeepCopyInto(out *OperatorVersion) { + out.Major = v.Major + out.Minor = v.Minor + out.Patch = v.Patch + + if v.Pre != nil { + pre := make([]semver.PRVersion, len(v.Pre)) + copy(pre, v.Pre) + out.Pre = pre + } + + if v.Build != nil { + build := make([]string, len(v.Build)) + copy(build, v.Build) + out.Build = build + } +} + +// MarshalJSON implements the encoding/json.Marshaler interface. +func (v OperatorVersion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.String()) +} + +// UnmarshalJSON implements the encoding/json.Unmarshaler interface. +func (v *OperatorVersion) UnmarshalJSON(data []byte) (err error) { + var versionString string + + if err = json.Unmarshal(data, &versionString); err != nil { + return + } + + version := semver.Version{} + version, err = semver.ParseTolerant(versionString) + if err != nil { + return err + } + v.Version = version + return +} + +// OpenAPISchemaType is used by the kube-openapi generator when constructing +// the OpenAPI spec of this type. +// +// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators +func (_ OperatorVersion) OpenAPISchemaType() []string { return []string{"string"} } + +// OpenAPISchemaFormat is used by the kube-openapi generator when constructing +// the OpenAPI spec of this type. +// "semver" is not a standard openapi format but tooling may use the value regardless +func (_ OperatorVersion) OpenAPISchemaFormat() string { return "semver" } diff --git a/vendor/github.com/openshift-kni/eco-goinfra/pkg/sriov/network.go b/vendor/github.com/openshift-kni/eco-goinfra/pkg/sriov/network.go index 3dea7af68..acdbb4ddb 100644 --- a/vendor/github.com/openshift-kni/eco-goinfra/pkg/sriov/network.go +++ b/vendor/github.com/openshift-kni/eco-goinfra/pkg/sriov/network.go @@ -222,6 +222,26 @@ func (builder *NetworkBuilder) WithVlanQoS(qoSClass uint16) *NetworkBuilder { return builder } +// WithLogLevel sets logLevel parameter in the SrIovNetwork definition spec. +func (builder *NetworkBuilder) WithLogLevel(logLevel string) *NetworkBuilder { + if valid, _ := builder.validate(); !valid { + return builder + } + + allowedLogLevels := []string{"panic", "error", "warning", "info", "debug", ""} + + if !slices.Contains(allowedLogLevels, logLevel) { + builder.errorMsg = "invalid logLevel value, allowed logLevel values are:" + + " panic, error, warning, info, debug or empty" + + return builder + } + + builder.Definition.Spec.LogLevel = logLevel + + return builder +} + // WithIPAddressSupport sets ips capabilities in the SrIovNetwork definition spec. func (builder *NetworkBuilder) WithIPAddressSupport() *NetworkBuilder { return builder.withCapabilities("ips") diff --git a/vendor/modules.txt b/vendor/modules.txt index 551335c06..139dec983 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -598,7 +598,7 @@ github.com/openshift-kni/cluster-group-upgrades-operator/pkg/generated/clientset github.com/openshift-kni/cluster-group-upgrades-operator/pkg/generated/clientset/versioned/scheme github.com/openshift-kni/cluster-group-upgrades-operator/pkg/generated/clientset/versioned/typed/clustergroupupgrades/v1alpha1 github.com/openshift-kni/cluster-group-upgrades-operator/pkg/generated/clientset/versioned/typed/clustergroupupgrades/v1alpha1/fake -# github.com/openshift-kni/eco-goinfra v0.0.0-20240726142624-8eb62208ad75 +# github.com/openshift-kni/eco-goinfra v0.0.0-20240731154756-d6b470ae81c2 ## explicit; go 1.22 github.com/openshift-kni/eco-goinfra/pkg/apiservers github.com/openshift-kni/eco-goinfra/pkg/argocd @@ -641,7 +641,6 @@ github.com/openshift-kni/eco-goinfra/pkg/nrop github.com/openshift-kni/eco-goinfra/pkg/nto github.com/openshift-kni/eco-goinfra/pkg/nvidiagpu github.com/openshift-kni/eco-goinfra/pkg/oadp -github.com/openshift-kni/eco-goinfra/pkg/oadp/oadptypes github.com/openshift-kni/eco-goinfra/pkg/ocm github.com/openshift-kni/eco-goinfra/pkg/olm github.com/openshift-kni/eco-goinfra/pkg/pod @@ -688,6 +687,13 @@ github.com/openshift-kni/eco-goinfra/pkg/schemes/nvidiagpu/k8skoperatorlibs/upgr github.com/openshift-kni/eco-goinfra/pkg/schemes/nvidiagpu/nvidiagputypes github.com/openshift-kni/eco-goinfra/pkg/schemes/nvidiagpu/nvidiagputypes/internal/consts github.com/openshift-kni/eco-goinfra/pkg/schemes/nvidiagpu/semver +github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/api/v1alpha1 +github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/pkg/common +github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/api/v1 +github.com/openshift-kni/eco-goinfra/pkg/schemes/oadp/velero/pkg/restore +github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators +github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/operators/v1alpha1 +github.com/openshift-kni/eco-goinfra/pkg/schemes/olm/version github.com/openshift-kni/eco-goinfra/pkg/secret github.com/openshift-kni/eco-goinfra/pkg/service github.com/openshift-kni/eco-goinfra/pkg/serviceaccount