diff --git a/config/v1alpha1/register.go b/config/v1alpha1/register.go index 1d84b710792..b0c015e9dd0 100644 --- a/config/v1alpha1/register.go +++ b/config/v1alpha1/register.go @@ -34,8 +34,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { &ClusterMonitoringList{}, &InsightsDataGather{}, &InsightsDataGatherList{}, - &Backup{}, - &BackupList{}, &CRIOCredentialProviderConfig{}, &CRIOCredentialProviderConfigList{}, &PKI{}, diff --git a/config/v1alpha1/types_backup.go b/config/v1alpha1/types_backup.go deleted file mode 100644 index 0f3da518475..00000000000 --- a/config/v1alpha1/types_backup.go +++ /dev/null @@ -1,162 +0,0 @@ -package v1alpha1 - -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// -// Backup provides configuration for performing backups of the openshift cluster. -// -// Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. -// +kubebuilder:object:root=true -// +kubebuilder:resource:path=backups,scope=Cluster -// +kubebuilder:subresource:status -// +openshift:api-approved.openshift.io=https://github.com/openshift/api/pull/1482 -// +openshift:file-pattern=cvoRunLevel=0000_10,operatorName=config-operator,operatorOrdering=01 -// +openshift:enable:FeatureGate=AutomatedEtcdBackup -// +openshift:compatibility-gen:level=4 -type Backup struct { - metav1.TypeMeta `json:",inline"` - - // metadata is the standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - metav1.ObjectMeta `json:"metadata,omitempty"` - - // spec holds user settable values for configuration - // +required - Spec BackupSpec `json:"spec"` - // status holds observed values from the cluster. They may not be overridden. - // +optional - Status BackupStatus `json:"status"` -} - -type BackupSpec struct { - // etcd specifies the configuration for periodic backups of the etcd cluster - // +required - EtcdBackupSpec EtcdBackupSpec `json:"etcd"` -} - -type BackupStatus struct { -} - -// EtcdBackupSpec provides configuration for automated etcd backups to the cluster-etcd-operator -type EtcdBackupSpec struct { - - // schedule defines the recurring backup schedule in Cron format - // every 2 hours: 0 */2 * * * - // every day at 3am: 0 3 * * * - // Empty string means no opinion and the platform is left to choose a reasonable default which is subject to change without notice. - // The current default is "no backups", but will change in the future. - // +optional - // +kubebuilder:validation:Pattern:=`^(@(annually|yearly|monthly|weekly|daily|hourly))|(\*|(?:\*|(?:[0-9]|(?:[1-5][0-9])))\/(?:[0-9]|(?:[1-5][0-9]))|(?:[0-9]|(?:[1-5][0-9]))(?:(?:\-[0-9]|\-(?:[1-5][0-9]))?|(?:\,(?:[0-9]|(?:[1-5][0-9])))*)) (\*|(?:\*|(?:\*|(?:[0-9]|1[0-9]|2[0-3])))\/(?:[0-9]|1[0-9]|2[0-3])|(?:[0-9]|1[0-9]|2[0-3])(?:(?:\-(?:[0-9]|1[0-9]|2[0-3]))?|(?:\,(?:[0-9]|1[0-9]|2[0-3]))*)) (\*|(?:[1-9]|(?:[12][0-9])|3[01])(?:(?:\-(?:[1-9]|(?:[12][0-9])|3[01]))?|(?:\,(?:[1-9]|(?:[12][0-9])|3[01]))*)) (\*|(?:[1-9]|1[012]|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:\-(?:[1-9]|1[012]|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?|(?:\,(?:[1-9]|1[012]|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))*)) (\*|(?:[0-6]|SUN|MON|TUE|WED|THU|FRI|SAT)(?:(?:\-(?:[0-6]|SUN|MON|TUE|WED|THU|FRI|SAT))?|(?:\,(?:[0-6]|SUN|MON|TUE|WED|THU|FRI|SAT))*))$` - Schedule string `json:"schedule"` - - // Cron Regex breakdown: - // Allow macros: (@(annually|yearly|monthly|weekly|daily|hourly)) - // OR - // Minute: - // (\*|(?:\*|(?:[0-9]|(?:[1-5][0-9])))\/(?:[0-9]|(?:[1-5][0-9]))|(?:[0-9]|(?:[1-5][0-9]))(?:(?:\-[0-9]|\-(?:[1-5][0-9]))?|(?:\,(?:[0-9]|(?:[1-5][0-9])))*)) - // Hour: - // (\*|(?:\*|(?:\*|(?:[0-9]|1[0-9]|2[0-3])))\/(?:[0-9]|1[0-9]|2[0-3])|(?:[0-9]|1[0-9]|2[0-3])(?:(?:\-(?:[0-9]|1[0-9]|2[0-3]))?|(?:\,(?:[0-9]|1[0-9]|2[0-3]))*)) - // Day of the Month: - // (\*|(?:[1-9]|(?:[12][0-9])|3[01])(?:(?:\-(?:[1-9]|(?:[12][0-9])|3[01]))?|(?:\,(?:[1-9]|(?:[12][0-9])|3[01]))*)) - // Month: - // (\*|(?:[1-9]|1[012]|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:\-(?:[1-9]|1[012]|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?|(?:\,(?:[1-9]|1[012]|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))*)) - // Day of Week: - // (\*|(?:[0-6]|SUN|MON|TUE|WED|THU|FRI|SAT)(?:(?:\-(?:[0-6]|SUN|MON|TUE|WED|THU|FRI|SAT))?|(?:\,(?:[0-6]|SUN|MON|TUE|WED|THU|FRI|SAT))*)) - // - - // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - // If not specified, this will default to the time zone of the kube-controller-manager process. - // See https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zones - // +optional - // +kubebuilder:validation:Pattern:=`^([A-Za-z_]+([+-]*0)*|[A-Za-z_]+(\/[A-Za-z_]+){1,2})(\/GMT[+-]\d{1,2})?$` - TimeZone string `json:"timeZone"` - - // Timezone regex breakdown: - // ([A-Za-z_]+([+-]*0)*|[A-Za-z_]+(/[A-Za-z_]+){1,2}) - Matches either: - // [A-Za-z_]+([+-]*0)* - One or more alphabetical characters (uppercase or lowercase) or underscores, followed by a +0 or -0 to account for GMT+0 or GMT-0 (for the first part of the timezone identifier). - // [A-Za-z_]+(/[A-Za-z_]+){1,2} - One or more alphabetical characters (uppercase or lowercase) or underscores, followed by one or two occurrences of a forward slash followed by one or more alphabetical characters or underscores. This allows for matching timezone identifiers with 2 or 3 parts, e.g America/Argentina/Buenos_Aires - // (/GMT[+-]\d{1,2})? - Makes the GMT offset suffix optional. It matches "/GMT" followed by either a plus ("+") or minus ("-") sign and one or two digits (the GMT offset) - - // retentionPolicy defines the retention policy for retaining and deleting existing backups. - // +optional - RetentionPolicy RetentionPolicy `json:"retentionPolicy"` - - // pvcName specifies the name of the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the - // etcd backup files would be saved - // The PVC itself must always be created in the "openshift-etcd" namespace - // If the PVC is left unspecified "" then the platform will choose a reasonable default location to save the backup. - // In the future this would be backups saved across the control-plane master nodes. - // +optional - PVCName string `json:"pvcName"` -} - -// RetentionType is the enumeration of valid retention policy types. -// +enum -// +kubebuilder:validation:Enum:="RetentionNumber";"RetentionSize" -type RetentionType string - -const ( - // RetentionTypeNumber sets the retention policy based on the number of backup files saved - RetentionTypeNumber RetentionType = "RetentionNumber" - // RetentionTypeSize sets the retention policy based on the total size of the backup files saved - RetentionTypeSize RetentionType = "RetentionSize" -) - -// RetentionPolicy defines the retention policy for retaining and deleting existing backups. -// This struct is a discriminated union that allows users to select the type of retention policy from the supported types. -// +union -type RetentionPolicy struct { - // retentionType sets the type of retention policy. - // Currently, the only valid policies are retention by number of backups (RetentionNumber), by the size of backups (RetentionSize). More policies or types may be added in the future. - // Empty string means no opinion and the platform is left to choose a reasonable default which is subject to change without notice. - // The current default is RetentionNumber with 15 backups kept. - // +unionDiscriminator - // +required - RetentionType RetentionType `json:"retentionType"` - - // retentionNumber configures the retention policy based on the number of backups - // +optional - RetentionNumber *RetentionNumberConfig `json:"retentionNumber,omitempty"` - - // retentionSize configures the retention policy based on the size of backups - // +optional - RetentionSize *RetentionSizeConfig `json:"retentionSize,omitempty"` -} - -// RetentionNumberConfig specifies the configuration of the retention policy on the number of backups -type RetentionNumberConfig struct { - // maxNumberOfBackups defines the maximum number of backups to retain. - // If the existing number of backups saved is equal to MaxNumberOfBackups then - // the oldest backup will be removed before a new backup is initiated. - // +kubebuilder:validation:Minimum=1 - // +required - MaxNumberOfBackups int `json:"maxNumberOfBackups"` -} - -// RetentionSizeConfig specifies the configuration of the retention policy on the total size of backups -type RetentionSizeConfig struct { - // maxSizeOfBackupsGb defines the total size in GB of backups to retain. - // If the current total size backups exceeds MaxSizeOfBackupsGb then - // the oldest backup will be removed before a new backup is initiated. - // +kubebuilder:validation:Minimum=1 - // +required - MaxSizeOfBackupsGb int `json:"maxSizeOfBackupsGb"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// BackupList is a collection of items -// -// Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. -// +openshift:compatibility-gen:level=4 -type BackupList struct { - metav1.TypeMeta `json:",inline"` - - // metadata is the standard list's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - metav1.ListMeta `json:"metadata"` - Items []Backup `json:"items"` -} diff --git a/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_backups.crd.yaml b/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_backups.crd.yaml index 7cffedaa00e..f9d0eba0fb5 100644 --- a/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_backups.crd.yaml +++ b/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_backups.crd.yaml @@ -129,6 +129,20 @@ spec: status: description: status holds observed values from the cluster. They may not be overridden. + properties: + lastScheduledBackupCount: + description: |- + lastScheduledBackupCount is the number of EtcdBackup resources created + in the last scheduled execution. This typically corresponds to the number + of master nodes in the cluster at the time of backup. + type: integer + lastScheduledTime: + description: |- + lastScheduledTime is the time when the last scheduled backup was triggered. + This is used by the controller to track when backups have been executed + and to prevent duplicate executions on controller restart. + format: date-time + type: string type: object required: - spec diff --git a/config/v1alpha1/zz_generated.deepcopy.go b/config/v1alpha1/zz_generated.deepcopy.go index 12dd0cd3127..7c388bef29a 100644 --- a/config/v1alpha1/zz_generated.deepcopy.go +++ b/config/v1alpha1/zz_generated.deepcopy.go @@ -138,100 +138,6 @@ func (in *AuthorizationConfig) DeepCopy() *AuthorizationConfig { return out } -// 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) - out.Status = in.Status - return -} - -// 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 *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]) - } - } - return -} - -// 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 *BackupSpec) DeepCopyInto(out *BackupSpec) { - *out = *in - in.EtcdBackupSpec.DeepCopyInto(&out.EtcdBackupSpec) - return -} - -// 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 - return -} - -// 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 *BasicAuth) DeepCopyInto(out *BasicAuth) { *out = *in @@ -565,23 +471,6 @@ func (in *ECDSAKeyConfig) DeepCopy() *ECDSAKeyConfig { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EtcdBackupSpec) DeepCopyInto(out *EtcdBackupSpec) { - *out = *in - in.RetentionPolicy.DeepCopyInto(&out.RetentionPolicy) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupSpec. -func (in *EtcdBackupSpec) DeepCopy() *EtcdBackupSpec { - if in == nil { - return nil - } - out := new(EtcdBackupSpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GatherConfig) DeepCopyInto(out *GatherConfig) { *out = *in @@ -1843,64 +1732,6 @@ func (in *Retention) DeepCopy() *Retention { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RetentionNumberConfig) DeepCopyInto(out *RetentionNumberConfig) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetentionNumberConfig. -func (in *RetentionNumberConfig) DeepCopy() *RetentionNumberConfig { - if in == nil { - return nil - } - out := new(RetentionNumberConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RetentionPolicy) DeepCopyInto(out *RetentionPolicy) { - *out = *in - if in.RetentionNumber != nil { - in, out := &in.RetentionNumber, &out.RetentionNumber - *out = new(RetentionNumberConfig) - **out = **in - } - if in.RetentionSize != nil { - in, out := &in.RetentionSize, &out.RetentionSize - *out = new(RetentionSizeConfig) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetentionPolicy. -func (in *RetentionPolicy) DeepCopy() *RetentionPolicy { - if in == nil { - return nil - } - out := new(RetentionPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RetentionSizeConfig) DeepCopyInto(out *RetentionSizeConfig) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetentionSizeConfig. -func (in *RetentionSizeConfig) DeepCopy() *RetentionSizeConfig { - if in == nil { - return nil - } - out := new(RetentionSizeConfig) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SecretKeySelector) DeepCopyInto(out *SecretKeySelector) { *out = *in diff --git a/config/v1alpha1/zz_generated.featuregated-crd-manifests.yaml b/config/v1alpha1/zz_generated.featuregated-crd-manifests.yaml index b2a12419377..c8b9b4ebeff 100644 --- a/config/v1alpha1/zz_generated.featuregated-crd-manifests.yaml +++ b/config/v1alpha1/zz_generated.featuregated-crd-manifests.yaml @@ -1,26 +1,3 @@ -backups.config.openshift.io: - Annotations: {} - ApprovedPRNumber: https://github.com/openshift/api/pull/1482 - CRDName: backups.config.openshift.io - Capability: "" - Category: "" - FeatureGates: - - AutomatedEtcdBackup - FilenameOperatorName: config-operator - FilenameOperatorOrdering: "01" - FilenameRunLevel: "0000_10" - GroupName: config.openshift.io - HasStatus: true - KindName: Backup - Labels: {} - PluralName: backups - PrinterColumns: [] - Scope: Cluster - ShortNames: null - TopLevelFeatureGates: - - AutomatedEtcdBackup - Version: v1alpha1 - criocredentialproviderconfigs.config.openshift.io: Annotations: {} ApprovedPRNumber: https://github.com/openshift/api/pull/2557 diff --git a/config/v1alpha1/zz_generated.featuregated-crd-manifests/backups.config.openshift.io/AutomatedEtcdBackup.yaml b/config/v1alpha1/zz_generated.featuregated-crd-manifests/backups.config.openshift.io/AutomatedEtcdBackup.yaml index 483e45e1263..dcc2c02bed1 100644 --- a/config/v1alpha1/zz_generated.featuregated-crd-manifests/backups.config.openshift.io/AutomatedEtcdBackup.yaml +++ b/config/v1alpha1/zz_generated.featuregated-crd-manifests/backups.config.openshift.io/AutomatedEtcdBackup.yaml @@ -129,6 +129,20 @@ spec: status: description: status holds observed values from the cluster. They may not be overridden. + properties: + lastScheduledBackupCount: + description: |- + lastScheduledBackupCount is the number of EtcdBackup resources created + in the last scheduled execution. This typically corresponds to the number + of master nodes in the cluster at the time of backup. + type: integer + lastScheduledTime: + description: |- + lastScheduledTime is the time when the last scheduled backup was triggered. + This is used by the controller to track when backups have been executed + and to prevent duplicate executions on controller restart. + format: date-time + type: string type: object required: - spec diff --git a/config/v1alpha1/zz_generated.model_name.go b/config/v1alpha1/zz_generated.model_name.go index 36a7803bf2f..8bf6e52dac3 100644 --- a/config/v1alpha1/zz_generated.model_name.go +++ b/config/v1alpha1/zz_generated.model_name.go @@ -30,26 +30,6 @@ func (in AuthorizationConfig) OpenAPIModelName() string { return "com.github.openshift.api.config.v1alpha1.AuthorizationConfig" } -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in Backup) OpenAPIModelName() string { - return "com.github.openshift.api.config.v1alpha1.Backup" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in BackupList) OpenAPIModelName() string { - return "com.github.openshift.api.config.v1alpha1.BackupList" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in BackupSpec) OpenAPIModelName() string { - return "com.github.openshift.api.config.v1alpha1.BackupSpec" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in BackupStatus) OpenAPIModelName() string { - return "com.github.openshift.api.config.v1alpha1.BackupStatus" -} - // OpenAPIModelName returns the OpenAPI model name for this type. func (in BasicAuth) OpenAPIModelName() string { return "com.github.openshift.api.config.v1alpha1.BasicAuth" @@ -125,11 +105,6 @@ func (in ECDSAKeyConfig) OpenAPIModelName() string { return "com.github.openshift.api.config.v1alpha1.ECDSAKeyConfig" } -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in EtcdBackupSpec) OpenAPIModelName() string { - return "com.github.openshift.api.config.v1alpha1.EtcdBackupSpec" -} - // OpenAPIModelName returns the OpenAPI model name for this type. func (in GatherConfig) OpenAPIModelName() string { return "com.github.openshift.api.config.v1alpha1.GatherConfig" @@ -400,21 +375,6 @@ func (in Retention) OpenAPIModelName() string { return "com.github.openshift.api.config.v1alpha1.Retention" } -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in RetentionNumberConfig) OpenAPIModelName() string { - return "com.github.openshift.api.config.v1alpha1.RetentionNumberConfig" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in RetentionPolicy) OpenAPIModelName() string { - return "com.github.openshift.api.config.v1alpha1.RetentionPolicy" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in RetentionSizeConfig) OpenAPIModelName() string { - return "com.github.openshift.api.config.v1alpha1.RetentionSizeConfig" -} - // OpenAPIModelName returns the OpenAPI model name for this type. func (in SecretKeySelector) OpenAPIModelName() string { return "com.github.openshift.api.config.v1alpha1.SecretKeySelector" diff --git a/config/v1alpha1/zz_generated.swagger_doc_generated.go b/config/v1alpha1/zz_generated.swagger_doc_generated.go index 8f6cda1915a..fb04a4b5430 100644 --- a/config/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/config/v1alpha1/zz_generated.swagger_doc_generated.go @@ -11,75 +11,6 @@ package v1alpha1 // Those methods can be generated by using hack/update-swagger-docs.sh // AUTO-GENERATED FUNCTIONS START HERE -var map_Backup = map[string]string{ - "": "\n\nBackup provides configuration for performing backups of the openshift cluster.\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", - "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "spec holds user settable values for configuration", - "status": "status holds observed values from the cluster. They may not be overridden.", -} - -func (Backup) SwaggerDoc() map[string]string { - return map_Backup -} - -var map_BackupList = map[string]string{ - "": "BackupList is a collection of items\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", - "metadata": "metadata is the standard list's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", -} - -func (BackupList) SwaggerDoc() map[string]string { - return map_BackupList -} - -var map_BackupSpec = map[string]string{ - "etcd": "etcd specifies the configuration for periodic backups of the etcd cluster", -} - -func (BackupSpec) SwaggerDoc() map[string]string { - return map_BackupSpec -} - -var map_EtcdBackupSpec = map[string]string{ - "": "EtcdBackupSpec provides configuration for automated etcd backups to the cluster-etcd-operator", - "schedule": "schedule defines the recurring backup schedule in Cron format every 2 hours: 0 */2 * * * every day at 3am: 0 3 * * * Empty string means no opinion and the platform is left to choose a reasonable default which is subject to change without notice. The current default is \"no backups\", but will change in the future.", - "timeZone": "The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will default to the time zone of the kube-controller-manager process. See https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zones", - "retentionPolicy": "retentionPolicy defines the retention policy for retaining and deleting existing backups.", - "pvcName": "pvcName specifies the name of the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup files would be saved The PVC itself must always be created in the \"openshift-etcd\" namespace If the PVC is left unspecified \"\" then the platform will choose a reasonable default location to save the backup. In the future this would be backups saved across the control-plane master nodes.", -} - -func (EtcdBackupSpec) SwaggerDoc() map[string]string { - return map_EtcdBackupSpec -} - -var map_RetentionNumberConfig = map[string]string{ - "": "RetentionNumberConfig specifies the configuration of the retention policy on the number of backups", - "maxNumberOfBackups": "maxNumberOfBackups defines the maximum number of backups to retain. If the existing number of backups saved is equal to MaxNumberOfBackups then the oldest backup will be removed before a new backup is initiated.", -} - -func (RetentionNumberConfig) SwaggerDoc() map[string]string { - return map_RetentionNumberConfig -} - -var map_RetentionPolicy = map[string]string{ - "": "RetentionPolicy defines the retention policy for retaining and deleting existing backups. This struct is a discriminated union that allows users to select the type of retention policy from the supported types.", - "retentionType": "retentionType sets the type of retention policy. Currently, the only valid policies are retention by number of backups (RetentionNumber), by the size of backups (RetentionSize). More policies or types may be added in the future. Empty string means no opinion and the platform is left to choose a reasonable default which is subject to change without notice. The current default is RetentionNumber with 15 backups kept.", - "retentionNumber": "retentionNumber configures the retention policy based on the number of backups", - "retentionSize": "retentionSize configures the retention policy based on the size of backups", -} - -func (RetentionPolicy) SwaggerDoc() map[string]string { - return map_RetentionPolicy -} - -var map_RetentionSizeConfig = map[string]string{ - "": "RetentionSizeConfig specifies the configuration of the retention policy on the total size of backups", - "maxSizeOfBackupsGb": "maxSizeOfBackupsGb defines the total size in GB of backups to retain. If the current total size backups exceeds MaxSizeOfBackupsGb then the oldest backup will be removed before a new backup is initiated.", -} - -func (RetentionSizeConfig) SwaggerDoc() map[string]string { - return map_RetentionSizeConfig -} - var map_AdditionalAlertmanagerConfig = map[string]string{ "": "AdditionalAlertmanagerConfig represents configuration for additional Alertmanager instances. The `AdditionalAlertmanagerConfig` resource defines settings for how a component communicates with additional Alertmanager instances.", "name": "name is a unique identifier for this Alertmanager configuration entry. The name must be a valid DNS subdomain (RFC 1123): lowercase alphanumeric characters, hyphens, or periods, and must start and end with an alphanumeric character. Minimum length is 1 character (empty string is invalid). Maximum length is 253 characters.", diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index b1ba3010c5f..eb2a053f0fc 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -519,10 +519,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA configv1alpha1.AlertmanagerCustomConfig{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_AlertmanagerCustomConfig(ref), configv1alpha1.Audit{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_Audit(ref), configv1alpha1.AuthorizationConfig{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_AuthorizationConfig(ref), - configv1alpha1.Backup{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_Backup(ref), - configv1alpha1.BackupList{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_BackupList(ref), - configv1alpha1.BackupSpec{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_BackupSpec(ref), - configv1alpha1.BackupStatus{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_BackupStatus(ref), configv1alpha1.BasicAuth{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_BasicAuth(ref), configv1alpha1.CRIOCredentialProviderConfig{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_CRIOCredentialProviderConfig(ref), configv1alpha1.CRIOCredentialProviderConfigList{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_CRIOCredentialProviderConfigList(ref), @@ -538,7 +534,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA configv1alpha1.DefaultCertificateConfig{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_DefaultCertificateConfig(ref), configv1alpha1.DropEqualActionConfig{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_DropEqualActionConfig(ref), configv1alpha1.ECDSAKeyConfig{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_ECDSAKeyConfig(ref), - configv1alpha1.EtcdBackupSpec{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_EtcdBackupSpec(ref), configv1alpha1.GatherConfig{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_GatherConfig(ref), configv1alpha1.HashModActionConfig{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_HashModActionConfig(ref), configv1alpha1.InsightsDataGather{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_InsightsDataGather(ref), @@ -593,9 +588,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA configv1alpha1.RemoteWriteSpec{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_RemoteWriteSpec(ref), configv1alpha1.ReplaceActionConfig{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_ReplaceActionConfig(ref), configv1alpha1.Retention{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_Retention(ref), - configv1alpha1.RetentionNumberConfig{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_RetentionNumberConfig(ref), - configv1alpha1.RetentionPolicy{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_RetentionPolicy(ref), - configv1alpha1.RetentionSizeConfig{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_RetentionSizeConfig(ref), configv1alpha1.SecretKeySelector{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_SecretKeySelector(ref), configv1alpha1.Sigv4{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_Sigv4(ref), configv1alpha1.Storage{}.OpenAPIModelName(): schema_openshift_api_config_v1alpha1_Storage(ref), @@ -1326,7 +1318,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA operatorv1.Upstream{}.OpenAPIModelName(): schema_openshift_api_operator_v1_Upstream(ref), operatorv1.UpstreamResolvers{}.OpenAPIModelName(): schema_openshift_api_operator_v1_UpstreamResolvers(ref), operatorv1.VSphereCSIDriverConfigSpec{}.OpenAPIModelName(): schema_openshift_api_operator_v1_VSphereCSIDriverConfigSpec(ref), - operatorv1alpha1.BackupJobReference{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_BackupJobReference(ref), operatorv1alpha1.ClusterAPI{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_ClusterAPI(ref), operatorv1alpha1.ClusterAPIInstallerComponent{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_ClusterAPIInstallerComponent(ref), operatorv1alpha1.ClusterAPIInstallerComponentImage{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_ClusterAPIInstallerComponentImage(ref), @@ -1343,9 +1334,18 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA operatorv1alpha1.DelegatedAuthentication{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_DelegatedAuthentication(ref), operatorv1alpha1.DelegatedAuthorization{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_DelegatedAuthorization(ref), operatorv1alpha1.EtcdBackup{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackup(ref), + operatorv1alpha1.EtcdBackupJob{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupJob(ref), operatorv1alpha1.EtcdBackupList{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupList(ref), + operatorv1alpha1.EtcdBackupPolicy{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupPolicy(ref), + operatorv1alpha1.EtcdBackupPolicyList{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupPolicyList(ref), + operatorv1alpha1.EtcdBackupPolicyRetentionRule{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupPolicyRetentionRule(ref), + operatorv1alpha1.EtcdBackupPolicySpec{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupPolicySpec(ref), + operatorv1alpha1.EtcdBackupPolicyStatus{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupPolicyStatus(ref), operatorv1alpha1.EtcdBackupSpec{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupSpec(ref), operatorv1alpha1.EtcdBackupStatus{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupStatus(ref), + operatorv1alpha1.EtcdBackupStorage{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupStorage(ref), + operatorv1alpha1.EtcdBackupStorageLocal{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupStorageLocal(ref), + operatorv1alpha1.EtcdBackupStoragePvc{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_EtcdBackupStoragePvc(ref), operatorv1alpha1.GenerationHistory{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_GenerationHistory(ref), operatorv1alpha1.GenericOperatorConfig{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_GenericOperatorConfig(ref), operatorv1alpha1.ImageContentSourcePolicy{}.OpenAPIModelName(): schema_openshift_api_operator_v1alpha1_ImageContentSourcePolicy(ref), @@ -23619,139 +23619,6 @@ func schema_openshift_api_config_v1alpha1_AuthorizationConfig(ref common.Referen } } -func schema_openshift_api_config_v1alpha1_Backup(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "Backup provides configuration for performing backups of the openshift cluster.\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Description: "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - Default: map[string]interface{}{}, - Ref: ref(metav1.ObjectMeta{}.OpenAPIModelName()), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Description: "spec holds user settable values for configuration", - Default: map[string]interface{}{}, - Ref: ref(configv1alpha1.BackupSpec{}.OpenAPIModelName()), - }, - }, - "status": { - SchemaProps: spec.SchemaProps{ - Description: "status holds observed values from the cluster. They may not be overridden.", - Default: map[string]interface{}{}, - Ref: ref(configv1alpha1.BackupStatus{}.OpenAPIModelName()), - }, - }, - }, - Required: []string{"spec"}, - }, - }, - Dependencies: []string{ - configv1alpha1.BackupSpec{}.OpenAPIModelName(), configv1alpha1.BackupStatus{}.OpenAPIModelName(), metav1.ObjectMeta{}.OpenAPIModelName()}, - } -} - -func schema_openshift_api_config_v1alpha1_BackupList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "BackupList is a collection of items\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Description: "metadata is the standard list's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - Default: map[string]interface{}{}, - Ref: ref(metav1.ListMeta{}.OpenAPIModelName()), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref(configv1alpha1.Backup{}.OpenAPIModelName()), - }, - }, - }, - }, - }, - }, - Required: []string{"metadata", "items"}, - }, - }, - Dependencies: []string{ - configv1alpha1.Backup{}.OpenAPIModelName(), metav1.ListMeta{}.OpenAPIModelName()}, - } -} - -func schema_openshift_api_config_v1alpha1_BackupSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "etcd": { - SchemaProps: spec.SchemaProps{ - Description: "etcd specifies the configuration for periodic backups of the etcd cluster", - Default: map[string]interface{}{}, - Ref: ref(configv1alpha1.EtcdBackupSpec{}.OpenAPIModelName()), - }, - }, - }, - Required: []string{"etcd"}, - }, - }, - Dependencies: []string{ - configv1alpha1.EtcdBackupSpec{}.OpenAPIModelName()}, - } -} - -func schema_openshift_api_config_v1alpha1_BackupStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - }, - }, - } -} - func schema_openshift_api_config_v1alpha1_BasicAuth(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -24329,52 +24196,6 @@ func schema_openshift_api_config_v1alpha1_ECDSAKeyConfig(ref common.ReferenceCal } } -func schema_openshift_api_config_v1alpha1_EtcdBackupSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "EtcdBackupSpec provides configuration for automated etcd backups to the cluster-etcd-operator", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "schedule": { - SchemaProps: spec.SchemaProps{ - Description: "schedule defines the recurring backup schedule in Cron format every 2 hours: 0 */2 * * * every day at 3am: 0 3 * * * Empty string means no opinion and the platform is left to choose a reasonable default which is subject to change without notice. The current default is \"no backups\", but will change in the future.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "timeZone": { - SchemaProps: spec.SchemaProps{ - Description: "The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will default to the time zone of the kube-controller-manager process. See https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zones", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "retentionPolicy": { - SchemaProps: spec.SchemaProps{ - Description: "retentionPolicy defines the retention policy for retaining and deleting existing backups.", - Default: map[string]interface{}{}, - Ref: ref(configv1alpha1.RetentionPolicy{}.OpenAPIModelName()), - }, - }, - "pvcName": { - SchemaProps: spec.SchemaProps{ - Description: "pvcName specifies the name of the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup files would be saved The PVC itself must always be created in the \"openshift-etcd\" namespace If the PVC is left unspecified \"\" then the platform will choose a reasonable default location to save the backup. In the future this would be backups saved across the control-plane master nodes.", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - Dependencies: []string{ - configv1alpha1.RetentionPolicy{}.OpenAPIModelName()}, - } -} - func schema_openshift_api_config_v1alpha1_GatherConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -26975,100 +26796,6 @@ func schema_openshift_api_config_v1alpha1_Retention(ref common.ReferenceCallback } } -func schema_openshift_api_config_v1alpha1_RetentionNumberConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RetentionNumberConfig specifies the configuration of the retention policy on the number of backups", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "maxNumberOfBackups": { - SchemaProps: spec.SchemaProps{ - Description: "maxNumberOfBackups defines the maximum number of backups to retain. If the existing number of backups saved is equal to MaxNumberOfBackups then the oldest backup will be removed before a new backup is initiated.", - Default: 0, - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - Required: []string{"maxNumberOfBackups"}, - }, - }, - } -} - -func schema_openshift_api_config_v1alpha1_RetentionPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RetentionPolicy defines the retention policy for retaining and deleting existing backups. This struct is a discriminated union that allows users to select the type of retention policy from the supported types.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "retentionType": { - SchemaProps: spec.SchemaProps{ - Description: "retentionType sets the type of retention policy. Currently, the only valid policies are retention by number of backups (RetentionNumber), by the size of backups (RetentionSize). More policies or types may be added in the future. Empty string means no opinion and the platform is left to choose a reasonable default which is subject to change without notice. The current default is RetentionNumber with 15 backups kept.\n\nPossible enum values:\n - `\"RetentionNumber\"` sets the retention policy based on the number of backup files saved\n - `\"RetentionSize\"` sets the retention policy based on the total size of the backup files saved", - Default: "", - Type: []string{"string"}, - Format: "", - Enum: []interface{}{"RetentionNumber", "RetentionSize"}, - }, - }, - "retentionNumber": { - SchemaProps: spec.SchemaProps{ - Description: "retentionNumber configures the retention policy based on the number of backups", - Ref: ref(configv1alpha1.RetentionNumberConfig{}.OpenAPIModelName()), - }, - }, - "retentionSize": { - SchemaProps: spec.SchemaProps{ - Description: "retentionSize configures the retention policy based on the size of backups", - Ref: ref(configv1alpha1.RetentionSizeConfig{}.OpenAPIModelName()), - }, - }, - }, - Required: []string{"retentionType"}, - }, - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-unions": []interface{}{ - map[string]interface{}{ - "discriminator": "retentionType", - "fields-to-discriminateBy": map[string]interface{}{ - "retentionNumber": "RetentionNumber", - "retentionSize": "RetentionSize", - }, - }, - }, - }, - }, - }, - Dependencies: []string{ - configv1alpha1.RetentionNumberConfig{}.OpenAPIModelName(), configv1alpha1.RetentionSizeConfig{}.OpenAPIModelName()}, - } -} - -func schema_openshift_api_config_v1alpha1_RetentionSizeConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "RetentionSizeConfig specifies the configuration of the retention policy on the total size of backups", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "maxSizeOfBackupsGb": { - SchemaProps: spec.SchemaProps{ - Description: "maxSizeOfBackupsGb defines the total size in GB of backups to retain. If the current total size backups exceeds MaxSizeOfBackupsGb then the oldest backup will be removed before a new backup is initiated.", - Default: 0, - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - Required: []string{"maxSizeOfBackupsGb"}, - }, - }, - } -} - func schema_openshift_api_config_v1alpha1_SecretKeySelector(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -65326,36 +65053,6 @@ func schema_openshift_api_operator_v1_VSphereCSIDriverConfigSpec(ref common.Refe } } -func schema_openshift_api_operator_v1alpha1_BackupJobReference(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "BackupJobReference holds a reference to the batch/v1 Job created to run the etcd backup", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "namespace": { - SchemaProps: spec.SchemaProps{ - Description: "namespace is the namespace of the Job. this is always expected to be \"openshift-etcd\" since the user provided PVC is also required to be in \"openshift-etcd\" Required", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "name": { - SchemaProps: spec.SchemaProps{ - Description: "name is the name of the Job. Required", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"namespace", "name"}, - }, - }, - } -} - func schema_openshift_api_operator_v1alpha1_ClusterAPI(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -66029,6 +65726,43 @@ func schema_openshift_api_operator_v1alpha1_EtcdBackup(ref common.ReferenceCallb } } +func schema_openshift_api_operator_v1alpha1_EtcdBackupJob(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name of the backup job", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "namespace of the backup job", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "uid": { + SchemaProps: spec.SchemaProps{ + Description: "uid of the backup job", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "namespace", "uid"}, + }, + }, + } +} + func schema_openshift_api_operator_v1alpha1_EtcdBackupList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -66078,23 +65812,290 @@ func schema_openshift_api_operator_v1alpha1_EtcdBackupList(ref common.ReferenceC } } -func schema_openshift_api_operator_v1alpha1_EtcdBackupSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_openshift_api_operator_v1alpha1_EtcdBackupPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "# EtcdBackupPolicy sets an automated schedule for taking backups of the etcd cluster\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref(metav1.ObjectMeta{}.OpenAPIModelName()), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "spec holds user settable values for configuration", + Default: map[string]interface{}{}, + Ref: ref(operatorv1alpha1.EtcdBackupPolicySpec{}.OpenAPIModelName()), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "status holds observed values from the cluster. They may not be overridden.", + Default: map[string]interface{}{}, + Ref: ref(operatorv1alpha1.EtcdBackupPolicyStatus{}.OpenAPIModelName()), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + operatorv1alpha1.EtcdBackupPolicySpec{}.OpenAPIModelName(), operatorv1alpha1.EtcdBackupPolicyStatus{}.OpenAPIModelName(), metav1.ObjectMeta{}.OpenAPIModelName()}, + } +} + +func schema_openshift_api_operator_v1alpha1_EtcdBackupPolicyList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "EtcdBackupPolicyList is a collection of items\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref(metav1.ListMeta{}.OpenAPIModelName()), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref(operatorv1alpha1.EtcdBackupPolicy{}.OpenAPIModelName()), + }, + }, + }, + }, + }, + }, + Required: []string{"metadata", "items"}, + }, + }, + Dependencies: []string{ + operatorv1alpha1.EtcdBackupPolicy{}.OpenAPIModelName(), metav1.ListMeta{}.OpenAPIModelName()}, + } +} + +func schema_openshift_api_operator_v1alpha1_EtcdBackupPolicyRetentionRule(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type defined which rule field is set", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "maxQuantity": { + SchemaProps: spec.SchemaProps{ + Description: "maxQuantity enforces the deletion of backups that exceed the given count.", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "maxSize": { + SchemaProps: spec.SchemaProps{ + Description: "maxSize enforces the deletion of backups by the total size of backups on the storage backend. This is a soft threshold. The total size of backups may temporarily exceed the limit when new backups are created.", + Ref: ref(resource.Quantity{}.OpenAPIModelName()), + }, + }, + }, + Required: []string{"type"}, + }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-unions": []interface{}{ + map[string]interface{}{ + "discriminator": "type", + "fields-to-discriminateBy": map[string]interface{}{ + "maxQuantity": "MaxQuantity", + "maxSize": "MaxSize", + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + resource.Quantity{}.OpenAPIModelName()}, + } +} + +func schema_openshift_api_operator_v1alpha1_EtcdBackupPolicySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Type: []string{"object"}, Properties: map[string]spec.Schema{ - "pvcName": { + "schedule": { SchemaProps: spec.SchemaProps{ - Description: "pvcName specifies the name of the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file would be saved The PVC itself must always be created in the \"openshift-etcd\" namespace If the PVC is left unspecified \"\" then the platform will choose a reasonable default location to save the backup. In the future this would be backups saved across the control-plane master nodes.", + Description: "schedule sets the backup schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.", Default: "", Type: []string{"string"}, Format: "", }, }, + "timeZone": { + SchemaProps: spec.SchemaProps{ + Description: "The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will default to the time zone of the cluster-etcd-operator process.", + Type: []string{"string"}, + Format: "", + }, + }, + "nodeSelector": { + SchemaProps: spec.SchemaProps{ + Description: "nodeSelector specifies which master node(s) to run backup jobs on. If no selector is specified, the default node-role.kubernetes.io/master label will be used.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "nodeCount": { + SchemaProps: spec.SchemaProps{ + Description: "nodeCount sets the maximum number of nodes to run backups on when multiple are selected. If a value greater than zero is set, nodes are selected in lexicographical order. Values less than or equal to zero will select all available nodes.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "storage": { + SchemaProps: spec.SchemaProps{ + Description: "storage specifies the location where etcd backup files will be saved.", + Default: map[string]interface{}{}, + Ref: ref(operatorv1alpha1.EtcdBackupStorage{}.OpenAPIModelName()), + }, + }, + "retentionRules": { + SchemaProps: spec.SchemaProps{ + Description: "retentionRules defines the policy for retaining and deleting existing backups. Backups are deleted from the oldest first until all rules are satisfied (logical OR). If no rules are specified then backups created by this policy will not be automatically deleted.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref(operatorv1alpha1.EtcdBackupPolicyRetentionRule{}.OpenAPIModelName()), + }, + }, + }, + }, + }, + }, + Required: []string{"schedule", "storage"}, + }, + }, + Dependencies: []string{ + operatorv1alpha1.EtcdBackupPolicyRetentionRule{}.OpenAPIModelName(), operatorv1alpha1.EtcdBackupStorage{}.OpenAPIModelName()}, + } +} + +func schema_openshift_api_operator_v1alpha1_EtcdBackupPolicyStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "lastScheduleTime": { + SchemaProps: spec.SchemaProps{ + Description: "lastScheduleTime is the time when the last scheduled backup was triggered. This is used by the controller to track when backups have been executed and to prevent duplicate executions on controller restart.", + Ref: ref(metav1.Time{}.OpenAPIModelName()), + }, + }, + "lastScheduleNodes": { + SchemaProps: spec.SchemaProps{ + Description: "lastScheduleNodes is the name of nodes selected during the last scheduled execution.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + metav1.Time{}.OpenAPIModelName()}, + } +} + +func schema_openshift_api_operator_v1alpha1_EtcdBackupSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeName": { + SchemaProps: spec.SchemaProps{ + Description: "nodeName specifies the master node where an etcd backup should be taken. If not specified, a random master node will be selected.", + Type: []string{"string"}, + Format: "", + }, + }, + "storage": { + SchemaProps: spec.SchemaProps{ + Description: "storage specifies the location where etcd backup files will be saved.", + Default: map[string]interface{}{}, + Ref: ref(operatorv1alpha1.EtcdBackupStorage{}.OpenAPIModelName()), + }, + }, }, + Required: []string{"storage"}, }, }, + Dependencies: []string{ + operatorv1alpha1.EtcdBackupStorage{}.OpenAPIModelName()}, } } @@ -66126,17 +66127,134 @@ func schema_openshift_api_operator_v1alpha1_EtcdBackupStatus(ref common.Referenc }, }, }, - "backupJob": { + "job": { + SchemaProps: spec.SchemaProps{ + Description: "job is a reference to the Job created for the backup.", + Ref: ref(operatorv1alpha1.EtcdBackupJob{}.OpenAPIModelName()), + }, + }, + "nodeName": { + SchemaProps: spec.SchemaProps{ + Description: "nodeName is the master node where the backup snapshot was taken.", + Type: []string{"string"}, + Format: "", + }, + }, + "filePath": { + SchemaProps: spec.SchemaProps{ + Description: "filePath is the absolute path to the backup file on the storage backend.", + Type: []string{"string"}, + Format: "", + }, + }, + "fileSize": { + SchemaProps: spec.SchemaProps{ + Description: "fileSize is the size of the backup file on the storage backend.", + Ref: ref(resource.Quantity{}.OpenAPIModelName()), + }, + }, + }, + }, + }, + Dependencies: []string{ + operatorv1alpha1.EtcdBackupJob{}.OpenAPIModelName(), resource.Quantity{}.OpenAPIModelName(), metav1.Condition{}.OpenAPIModelName()}, + } +} + +func schema_openshift_api_operator_v1alpha1_EtcdBackupStorage(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { SchemaProps: spec.SchemaProps{ - Description: "backupJob is the reference to the Job that executes the backup. Optional", - Ref: ref(operatorv1alpha1.BackupJobReference{}.OpenAPIModelName()), + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "pvc": { + SchemaProps: spec.SchemaProps{ + Description: "pvc specifies the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file will be saved. The PVC must always be created in the \"openshift-etcd\" namespace. This field is required when the storage type is \"PVC\"", + Ref: ref(operatorv1alpha1.EtcdBackupStoragePvc{}.OpenAPIModelName()), + }, + }, + "local": { + SchemaProps: spec.SchemaProps{ + Description: "local specifies a host path directory on the master node where the etcd backup file will be saved. This field is required when storage type is \"Local\"", + Ref: ref(operatorv1alpha1.EtcdBackupStorageLocal{}.OpenAPIModelName()), + }, + }, + }, + Required: []string{"type"}, + }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-unions": []interface{}{ + map[string]interface{}{ + "discriminator": "type", + "fields-to-discriminateBy": map[string]interface{}{ + "local": "Local", + "pvc": "PVC", + }, }, }, }, }, }, Dependencies: []string{ - operatorv1alpha1.BackupJobReference{}.OpenAPIModelName(), metav1.Condition{}.OpenAPIModelName()}, + operatorv1alpha1.EtcdBackupStorageLocal{}.OpenAPIModelName(), operatorv1alpha1.EtcdBackupStoragePvc{}.OpenAPIModelName()}, + } +} + +func schema_openshift_api_operator_v1alpha1_EtcdBackupStorageLocal(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "hostPath": { + SchemaProps: spec.SchemaProps{ + Description: "hostPath is a local directory on the master node where the etcd backup file will be saved.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"hostPath"}, + }, + }, + } +} + +func schema_openshift_api_operator_v1alpha1_EtcdBackupStoragePvc(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is a reference to a PVC in the \"openshift-etcd\" namespace where the etcd backup file will be saved.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "path": { + SchemaProps: spec.SchemaProps{ + Description: "path is a directory on the volume where the etcd backup file will be saved.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, } } diff --git a/openapi/openapi.json b/openapi/openapi.json index ee6ecd22773..33b2e6f4975 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -12846,84 +12846,6 @@ } ] }, - "com.github.openshift.api.config.v1alpha1.Backup": { - "description": "Backup provides configuration for performing backups of the openshift cluster.\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", - "type": "object", - "required": [ - "spec" - ], - "properties": { - "apiVersion": { - "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - "type": "string" - }, - "kind": { - "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "type": "string" - }, - "metadata": { - "description": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" - }, - "spec": { - "description": "spec holds user settable values for configuration", - "default": {}, - "$ref": "#/definitions/com.github.openshift.api.config.v1alpha1.BackupSpec" - }, - "status": { - "description": "status holds observed values from the cluster. They may not be overridden.", - "default": {}, - "$ref": "#/definitions/com.github.openshift.api.config.v1alpha1.BackupStatus" - } - } - }, - "com.github.openshift.api.config.v1alpha1.BackupList": { - "description": "BackupList is a collection of items\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", - "type": "object", - "required": [ - "metadata", - "items" - ], - "properties": { - "apiVersion": { - "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - "type": "string" - }, - "items": { - "type": "array", - "items": { - "default": {}, - "$ref": "#/definitions/com.github.openshift.api.config.v1alpha1.Backup" - } - }, - "kind": { - "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "type": "string" - }, - "metadata": { - "description": "metadata is the standard list's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "default": {}, - "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" - } - } - }, - "com.github.openshift.api.config.v1alpha1.BackupSpec": { - "type": "object", - "required": [ - "etcd" - ], - "properties": { - "etcd": { - "description": "etcd specifies the configuration for periodic backups of the etcd cluster", - "default": {}, - "$ref": "#/definitions/com.github.openshift.api.config.v1alpha1.EtcdBackupSpec" - } - } - }, - "com.github.openshift.api.config.v1alpha1.BackupStatus": { - "type": "object" - }, "com.github.openshift.api.config.v1alpha1.BasicAuth": { "description": "BasicAuth defines basic authentication settings for the remote write endpoint URL.", "type": "object", @@ -13268,32 +13190,6 @@ } } }, - "com.github.openshift.api.config.v1alpha1.EtcdBackupSpec": { - "description": "EtcdBackupSpec provides configuration for automated etcd backups to the cluster-etcd-operator", - "type": "object", - "properties": { - "pvcName": { - "description": "pvcName specifies the name of the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup files would be saved The PVC itself must always be created in the \"openshift-etcd\" namespace If the PVC is left unspecified \"\" then the platform will choose a reasonable default location to save the backup. In the future this would be backups saved across the control-plane master nodes.", - "type": "string", - "default": "" - }, - "retentionPolicy": { - "description": "retentionPolicy defines the retention policy for retaining and deleting existing backups.", - "default": {}, - "$ref": "#/definitions/com.github.openshift.api.config.v1alpha1.RetentionPolicy" - }, - "schedule": { - "description": "schedule defines the recurring backup schedule in Cron format every 2 hours: 0 */2 * * * every day at 3am: 0 3 * * * Empty string means no opinion and the platform is left to choose a reasonable default which is subject to change without notice. The current default is \"no backups\", but will change in the future.", - "type": "string", - "default": "" - }, - "timeZone": { - "description": "The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will default to the time zone of the kube-controller-manager process. See https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zones", - "type": "string", - "default": "" - } - } - }, "com.github.openshift.api.config.v1alpha1.GatherConfig": { "description": "gatherConfig provides data gathering configuration options.", "type": "object", @@ -14845,71 +14741,6 @@ } } }, - "com.github.openshift.api.config.v1alpha1.RetentionNumberConfig": { - "description": "RetentionNumberConfig specifies the configuration of the retention policy on the number of backups", - "type": "object", - "required": [ - "maxNumberOfBackups" - ], - "properties": { - "maxNumberOfBackups": { - "description": "maxNumberOfBackups defines the maximum number of backups to retain. If the existing number of backups saved is equal to MaxNumberOfBackups then the oldest backup will be removed before a new backup is initiated.", - "type": "integer", - "format": "int32", - "default": 0 - } - } - }, - "com.github.openshift.api.config.v1alpha1.RetentionPolicy": { - "description": "RetentionPolicy defines the retention policy for retaining and deleting existing backups. This struct is a discriminated union that allows users to select the type of retention policy from the supported types.", - "type": "object", - "required": [ - "retentionType" - ], - "properties": { - "retentionNumber": { - "description": "retentionNumber configures the retention policy based on the number of backups", - "$ref": "#/definitions/com.github.openshift.api.config.v1alpha1.RetentionNumberConfig" - }, - "retentionSize": { - "description": "retentionSize configures the retention policy based on the size of backups", - "$ref": "#/definitions/com.github.openshift.api.config.v1alpha1.RetentionSizeConfig" - }, - "retentionType": { - "description": "retentionType sets the type of retention policy. Currently, the only valid policies are retention by number of backups (RetentionNumber), by the size of backups (RetentionSize). More policies or types may be added in the future. Empty string means no opinion and the platform is left to choose a reasonable default which is subject to change without notice. The current default is RetentionNumber with 15 backups kept.\n\nPossible enum values:\n - `\"RetentionNumber\"` sets the retention policy based on the number of backup files saved\n - `\"RetentionSize\"` sets the retention policy based on the total size of the backup files saved", - "type": "string", - "default": "", - "enum": [ - "RetentionNumber", - "RetentionSize" - ] - } - }, - "x-kubernetes-unions": [ - { - "discriminator": "retentionType", - "fields-to-discriminateBy": { - "retentionNumber": "RetentionNumber", - "retentionSize": "RetentionSize" - } - } - ] - }, - "com.github.openshift.api.config.v1alpha1.RetentionSizeConfig": { - "description": "RetentionSizeConfig specifies the configuration of the retention policy on the total size of backups", - "type": "object", - "required": [ - "maxSizeOfBackupsGb" - ], - "properties": { - "maxSizeOfBackupsGb": { - "description": "maxSizeOfBackupsGb defines the total size in GB of backups to retain. If the current total size backups exceeds MaxSizeOfBackupsGb then the oldest backup will be removed before a new backup is initiated.", - "type": "integer", - "format": "int32", - "default": 0 - } - } - }, "com.github.openshift.api.config.v1alpha1.SecretKeySelector": { "description": "SecretKeySelector selects a key of a Secret in the `openshift-monitoring` namespace.", "type": "object", @@ -37981,26 +37812,6 @@ } } }, - "com.github.openshift.api.operator.v1alpha1.BackupJobReference": { - "description": "BackupJobReference holds a reference to the batch/v1 Job created to run the etcd backup", - "type": "object", - "required": [ - "namespace", - "name" - ], - "properties": { - "name": { - "description": "name is the name of the Job. Required", - "type": "string", - "default": "" - }, - "namespace": { - "description": "namespace is the namespace of the Job. this is always expected to be \"openshift-etcd\" since the user provided PVC is also required to be in \"openshift-etcd\" Required", - "type": "string", - "default": "" - } - } - }, "com.github.openshift.api.operator.v1alpha1.ClusterAPI": { "description": "ClusterAPI provides configuration for the capi-operator.\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", "type": "object", @@ -38398,6 +38209,31 @@ } } }, + "com.github.openshift.api.operator.v1alpha1.EtcdBackupJob": { + "type": "object", + "required": [ + "name", + "namespace", + "uid" + ], + "properties": { + "name": { + "description": "name of the backup job", + "type": "string", + "default": "" + }, + "namespace": { + "description": "namespace of the backup job", + "type": "string", + "default": "" + }, + "uid": { + "description": "uid of the backup job", + "type": "string", + "default": "" + } + } + }, "com.github.openshift.api.operator.v1alpha1.EtcdBackupList": { "description": "EtcdBackupList is a collection of items\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", "type": "object", @@ -38427,23 +38263,179 @@ } } }, - "com.github.openshift.api.operator.v1alpha1.EtcdBackupSpec": { + "com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicy": { + "description": "# EtcdBackupPolicy sets an automated schedule for taking backups of the etcd cluster\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", + "type": "object", + "required": [ + "spec" + ], + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "default": {}, + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "spec holds user settable values for configuration", + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicySpec" + }, + "status": { + "description": "status holds observed values from the cluster. They may not be overridden.", + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicyStatus" + } + } + }, + "com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicyList": { + "description": "EtcdBackupPolicyList is a collection of items\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", "type": "object", + "required": [ + "metadata", + "items" + ], + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "items": { + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicy" + } + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "default": {}, + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + } + }, + "com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicyRetentionRule": { + "type": "object", + "required": [ + "type" + ], "properties": { - "pvcName": { - "description": "pvcName specifies the name of the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file would be saved The PVC itself must always be created in the \"openshift-etcd\" namespace If the PVC is left unspecified \"\" then the platform will choose a reasonable default location to save the backup. In the future this would be backups saved across the control-plane master nodes.", + "maxQuantity": { + "description": "maxQuantity enforces the deletion of backups that exceed the given count.", + "type": "integer", + "format": "int32", + "default": 0 + }, + "maxSize": { + "description": "maxSize enforces the deletion of backups by the total size of backups on the storage backend. This is a soft threshold. The total size of backups may temporarily exceed the limit when new backups are created.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + }, + "type": { + "description": "type defined which rule field is set", "type": "string", "default": "" } + }, + "x-kubernetes-unions": [ + { + "discriminator": "type", + "fields-to-discriminateBy": { + "maxQuantity": "MaxQuantity", + "maxSize": "MaxSize" + } + } + ] + }, + "com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicySpec": { + "type": "object", + "required": [ + "schedule", + "storage" + ], + "properties": { + "nodeCount": { + "description": "nodeCount sets the maximum number of nodes to run backups on when multiple are selected. If a value greater than zero is set, nodes are selected in lexicographical order. Values less than or equal to zero will select all available nodes.", + "type": "integer", + "format": "int32" + }, + "nodeSelector": { + "description": "nodeSelector specifies which master node(s) to run backup jobs on. If no selector is specified, the default node-role.kubernetes.io/master label will be used.", + "type": "object", + "additionalProperties": { + "type": "string", + "default": "" + } + }, + "retentionRules": { + "description": "retentionRules defines the policy for retaining and deleting existing backups. Backups are deleted from the oldest first until all rules are satisfied (logical OR). If no rules are specified then backups created by this policy will not be automatically deleted.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicyRetentionRule" + } + }, + "schedule": { + "description": "schedule sets the backup schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.", + "type": "string", + "default": "" + }, + "storage": { + "description": "storage specifies the location where etcd backup files will be saved.", + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.operator.v1alpha1.EtcdBackupStorage" + }, + "timeZone": { + "description": "The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will default to the time zone of the cluster-etcd-operator process.", + "type": "string" + } } }, - "com.github.openshift.api.operator.v1alpha1.EtcdBackupStatus": { + "com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicyStatus": { "type": "object", "properties": { - "backupJob": { - "description": "backupJob is the reference to the Job that executes the backup. Optional", - "$ref": "#/definitions/com.github.openshift.api.operator.v1alpha1.BackupJobReference" + "lastScheduleNodes": { + "description": "lastScheduleNodes is the name of nodes selected during the last scheduled execution.", + "type": "array", + "items": { + "type": "string", + "default": "" + } }, + "lastScheduleTime": { + "description": "lastScheduleTime is the time when the last scheduled backup was triggered. This is used by the controller to track when backups have been executed and to prevent duplicate executions on controller restart.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + } + } + }, + "com.github.openshift.api.operator.v1alpha1.EtcdBackupSpec": { + "type": "object", + "required": [ + "storage" + ], + "properties": { + "nodeName": { + "description": "nodeName specifies the master node where an etcd backup should be taken. If not specified, a random master node will be selected.", + "type": "string" + }, + "storage": { + "description": "storage specifies the location where etcd backup files will be saved.", + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.operator.v1alpha1.EtcdBackupStorage" + } + } + }, + "com.github.openshift.api.operator.v1alpha1.EtcdBackupStatus": { + "type": "object", + "properties": { "conditions": { "description": "conditions provide details on the status of the etcd backup job.", "type": "array", @@ -38455,6 +38447,82 @@ "type" ], "x-kubernetes-list-type": "map" + }, + "filePath": { + "description": "filePath is the absolute path to the backup file on the storage backend.", + "type": "string" + }, + "fileSize": { + "description": "fileSize is the size of the backup file on the storage backend.", + "$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity" + }, + "job": { + "description": "job is a reference to the Job created for the backup.", + "$ref": "#/definitions/com.github.openshift.api.operator.v1alpha1.EtcdBackupJob" + }, + "nodeName": { + "description": "nodeName is the master node where the backup snapshot was taken.", + "type": "string" + } + } + }, + "com.github.openshift.api.operator.v1alpha1.EtcdBackupStorage": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "local": { + "description": "local specifies a host path directory on the master node where the etcd backup file will be saved. This field is required when storage type is \"Local\"", + "$ref": "#/definitions/com.github.openshift.api.operator.v1alpha1.EtcdBackupStorageLocal" + }, + "pvc": { + "description": "pvc specifies the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file will be saved. The PVC must always be created in the \"openshift-etcd\" namespace. This field is required when the storage type is \"PVC\"", + "$ref": "#/definitions/com.github.openshift.api.operator.v1alpha1.EtcdBackupStoragePvc" + }, + "type": { + "type": "string", + "default": "" + } + }, + "x-kubernetes-unions": [ + { + "discriminator": "type", + "fields-to-discriminateBy": { + "local": "Local", + "pvc": "PVC" + } + } + ] + }, + "com.github.openshift.api.operator.v1alpha1.EtcdBackupStorageLocal": { + "type": "object", + "required": [ + "hostPath" + ], + "properties": { + "hostPath": { + "description": "hostPath is a local directory on the master node where the etcd backup file will be saved.", + "type": "string", + "default": "" + } + } + }, + "com.github.openshift.api.operator.v1alpha1.EtcdBackupStoragePvc": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "name is a reference to a PVC in the \"openshift-etcd\" namespace where the etcd backup file will be saved.", + "type": "string", + "default": "" + }, + "path": { + "description": "path is a directory on the volume where the etcd backup file will be saved.", + "type": "string", + "default": "" } } }, diff --git a/operator/v1alpha1/register.go b/operator/v1alpha1/register.go index ec19cba3a94..64b06c36bc7 100644 --- a/operator/v1alpha1/register.go +++ b/operator/v1alpha1/register.go @@ -39,6 +39,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &OLMList{}, &EtcdBackup{}, &EtcdBackupList{}, + &EtcdBackupPolicy{}, + &EtcdBackupPolicyList{}, &ClusterVersionOperator{}, &ClusterVersionOperatorList{}, &ClusterAPI{}, diff --git a/operator/v1alpha1/types_etcdbackup.go b/operator/v1alpha1/types_etcdbackup.go index dc5d81cea19..96158505dd1 100644 --- a/operator/v1alpha1/types_etcdbackup.go +++ b/operator/v1alpha1/types_etcdbackup.go @@ -1,6 +1,7 @@ package v1alpha1 import ( + "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -31,52 +32,123 @@ type EtcdBackup struct { } type EtcdBackupSpec struct { - // pvcName specifies the name of the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the - // etcd backup file would be saved - // The PVC itself must always be created in the "openshift-etcd" namespace - // If the PVC is left unspecified "" then the platform will choose a reasonable default location to save the backup. - // In the future this would be backups saved across the control-plane master nodes. + // nodeName specifies the master node where an etcd backup should be taken. + // If not specified, a random master node will be selected. + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="nodeName is immutable once set" + // +kubebuilder:validation:Optional // +optional - // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="pvcName is immutable once set" - PVCName string `json:"pvcName"` + NodeName string `json:"nodeName,omitempty"` + + // storage specifies the location where etcd backup files will be saved. + // +kubebuilder:validation:Required + // +required + Storage EtcdBackupStorage `json:"storage"` +} + +// +kubebuilder:validation:XValidation:rule="self.type == 'PVC' ? has(self.pvc) : !has(self.pvc)",message="pvc is required when type is PVC, and forbidden otherwise" +// +kubebuilder:validation:XValidation:rule="self.type == 'Local' ? has(self.local) : !has(self.local)",message="local is required when type is Local, and forbidden otherwise" +// +union +type EtcdBackupStorage struct { + // +kubebuilder:validation:Enum:=PVC;Local; + // +kubebuilder:validation:Required + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="type is immutable once set" + // +required + // +unionDiscriminator + Type EtcdBackupStorageType `json:"type"` + + // pvc specifies the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file will be saved. + // The PVC must always be created in the "openshift-etcd" namespace. + // This field is required when the storage type is "PVC" + // +kubebuilder:validation:Optional + // +optional + // +unionMember + PVC *EtcdBackupStoragePvc `json:"pvc,omitempty"` + + // local specifies a host path directory on the master node where the etcd backup file will be saved. + // This field is required when storage type is "Local" + // +kubebuilder:validation:Optional + // +optional + // +unionMember + Local *EtcdBackupStorageLocal `json:"local,omitempty"` +} + +// EtcdBackupStorageType is an enum of the supported storage backends for backup files +type EtcdBackupStorageType string + +const ( + EtcdBackupStorageTypePVC EtcdBackupStorageType = "PVC" + EtcdBackupStorageTypeLocal EtcdBackupStorageType = "Local" +) + +type EtcdBackupStoragePvc struct { + // name is a reference to a PVC in the "openshift-etcd" namespace where the etcd backup file will be saved. + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="name is immutable once set" + // +kubebuilder:validation:Required + // +required + Name string `json:"name"` + + // path is a directory on the volume where the etcd backup file will be saved. + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="path is immutable once set" + // +kubebuilder:validation:Optional + // +optional + Path string `json:"path"` +} + +type EtcdBackupStorageLocal struct { + // hostPath is a local directory on the master node where the etcd backup file will be saved. + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="hostPath is immutable once set" + // +kubebuilder:validation:Required + // +required + HostPath string `json:"hostPath"` } type EtcdBackupStatus struct { // conditions provide details on the status of the etcd backup job. + // +kubebuilder:validation:Optional // +listType=map // +listMapKey=type // +optional - Conditions []metav1.Condition `json:"conditions,omitempty"` + Conditions []metav1.Condition `json:"conditions"` - // backupJob is the reference to the Job that executes the backup. - // Optional + // job is a reference to the Job created for the backup. + // +kubebuilder:validation:Optional // +optional - BackupJob *BackupJobReference `json:"backupJob"` -} + Job *EtcdBackupJob `json:"job,omitempty"` -// BackupJobReference holds a reference to the batch/v1 Job created to run the etcd backup -type BackupJobReference struct { + // nodeName is the master node where the backup snapshot was taken. + // +kubebuilder:validation:Optional + // +optional + NodeName string `json:"nodeName,omitempty"` - // namespace is the namespace of the Job. - // this is always expected to be "openshift-etcd" since the user provided PVC - // is also required to be in "openshift-etcd" - // Required - // +required - // +kubebuilder:validation:Pattern:=`^openshift-etcd$` - Namespace string `json:"namespace"` + // filePath is the absolute path to the backup file on the storage backend. + // +kubebuilder:validation:Optional + // +optional + FilePath string `json:"filePath,omitempty"` + + // fileSize is the size of the backup file on the storage backend. + // +kubebuilder:validation:Optional + // +optional + FileSize resource.Quantity `json:"fileSize,omitempty"` +} - // name is the name of the Job. - // Required +type EtcdBackupJob struct { + // name of the backup job + // +kubebuilder:validation:Required // +required Name string `json:"name"` + // namespace of the backup job + // +kubebuilder:validation:Required + // +required + Namespace string `json:"namespace"` + // uid of the backup job + // +kubebuilder:validation:Required + // +required + UID string `json:"uid"` } type BackupConditionReason string var ( - // BackupPending is added to the EtcdBackupStatus Conditions when the etcd backup is pending. - BackupPending BackupConditionReason = "BackupPending" - // BackupCompleted is added to the EtcdBackupStatus Conditions when the etcd backup has completed. BackupCompleted BackupConditionReason = "BackupCompleted" diff --git a/operator/v1alpha1/types_etcdbackuppolicy.go b/operator/v1alpha1/types_etcdbackuppolicy.go new file mode 100644 index 00000000000..a128ccf21aa --- /dev/null +++ b/operator/v1alpha1/types_etcdbackuppolicy.go @@ -0,0 +1,126 @@ +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +// # EtcdBackupPolicy sets an automated schedule for taking backups of the etcd cluster +// +// Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. +// +openshift:compatibility-gen:level=4 +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=etcdbackuppolicies,scope=Cluster +// +kubebuilder:subresource:status +// +openshift:api-approved.openshift.io= +// +openshift:file-pattern=cvoRunLevel=0000_10,operatorName=etcd,operatorOrdering=01 +// +openshift:enable:FeatureGate=AutomatedEtcdBackup +type EtcdBackupPolicy struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // spec holds user settable values for configuration + // +required + Spec EtcdBackupPolicySpec `json:"spec"` + // status holds observed values from the cluster. They may not be overridden. + // +optional + Status EtcdBackupPolicyStatus `json:"status"` +} + +type EtcdBackupPolicySpec struct { + // schedule sets the backup schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. + // +kubebuilder:validation:Required + // +required + Schedule string `json:"schedule"` + + // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. + // If not specified, this will default to the time zone of the cluster-etcd-operator process. + // +kubebuilder:validation:Optional + // +optional + TimeZone string `json:"timeZone,omitempty"` + + // nodeSelector specifies which master node(s) to run backup jobs on. + // If no selector is specified, the default node-role.kubernetes.io/master label will be used. + // +kubebuilder:validation:Optional + // +optional + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + + // nodeCount sets the maximum number of nodes to run backups on when multiple are selected. + // If a value greater than zero is set, nodes are selected in lexicographical order. + // Values less than or equal to zero will select all available nodes. + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + // +optional + NodeCount int `json:"nodeCount,omitempty"` + + // storage specifies the location where etcd backup files will be saved. + // +kubebuilder:validation:Required + // +required + Storage EtcdBackupStorage `json:"storage"` + + // retentionRules defines the policy for retaining and deleting existing backups. + // Backups are deleted from the oldest first until all rules are satisfied (logical OR). + // If no rules are specified then backups created by this policy will not be automatically deleted. + // +kubebuilder:validation:Optional + // +optional + RetentionRules []EtcdBackupPolicyRetentionRule `json:"retentionRules,omitzero"` +} + +// +union +type EtcdBackupPolicyRetentionRule struct { + // type defined which rule field is set + // +unionDiscriminator + // +kubebuilder:validation:Enum:=MaxQuantity;MaxSize + // +kubebuilder:validation:Required + // +required + Type EtcdBackupPolicyRetentionRuleType `json:"type"` + + // maxQuantity enforces the deletion of backups that exceed the given count. + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + // +optional + MaxQuantity int `json:"maxQuantity,omitzero"` + + // maxSize enforces the deletion of backups by the total size of backups on the storage backend. + // This is a soft threshold. The total size of backups may temporarily exceed the limit when new backups are created. + // +kubebuilder:validation:Optional + // +optional + MaxSize resource.Quantity `json:"maxSize,omitzero"` +} + +type EtcdBackupPolicyRetentionRuleType string + +const ( + EtcdBackupPolicyRetentionRuleMaxQuantity EtcdBackupPolicyRetentionRuleType = "MaxQuantity" + EtcdBackupPolicyRetentionRuleMaxSize EtcdBackupPolicyRetentionRuleType = "MaxSize" +) + +type EtcdBackupPolicyStatus struct { + // lastScheduleTime is the time when the last scheduled backup was triggered. + // This is used by the controller to track when backups have been executed + // and to prevent duplicate executions on controller restart. + // +kubebuilder:validation:Optional + // +optional + LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"` + + // lastScheduleNodes is the name of nodes selected during the last scheduled execution. + // +kubebuilder:validation:Optional + // +optional + LastScheduleNodes []string `json:"lastScheduleNodes,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// EtcdBackupPolicyList is a collection of items +// +// Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. +// +openshift:compatibility-gen:level=4 +type EtcdBackupPolicyList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []EtcdBackupPolicy `json:"items"` +} diff --git a/operator/v1alpha1/zz_generated.crd-manifests/0000_10_etcd_01_etcdbackuppolicies.crd.yaml b/operator/v1alpha1/zz_generated.crd-manifests/0000_10_etcd_01_etcdbackuppolicies.crd.yaml new file mode 100644 index 00000000000..302b01508c8 --- /dev/null +++ b/operator/v1alpha1/zz_generated.crd-manifests/0000_10_etcd_01_etcdbackuppolicies.crd.yaml @@ -0,0 +1,189 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + api.openshift.io/merged-by-featuregates: "true" + include.release.openshift.io/ibm-cloud-managed: "true" + include.release.openshift.io/self-managed-high-availability: "true" + release.openshift.io/feature-set: CustomNoUpgrade,DevPreviewNoUpgrade,TechPreviewNoUpgrade + name: etcdbackuppolicies.operator.openshift.io +spec: + group: operator.openshift.io + names: + kind: EtcdBackupPolicy + listKind: EtcdBackupPolicyList + plural: etcdbackuppolicies + singular: etcdbackuppolicy + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + # EtcdBackupPolicy sets an automated schedule for taking backups of the etcd cluster + + Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: spec holds user settable values for configuration + properties: + nodeCount: + description: |- + nodeCount sets the maximum number of nodes to run backups on when multiple are selected. + If a value greater than zero is set, nodes are selected in lexicographical order. + Values less than or equal to zero will select all available nodes. + minimum: 0 + type: integer + nodeSelector: + additionalProperties: + type: string + description: |- + nodeSelector specifies which master node(s) to run backup jobs on. + If no selector is specified, the default node-role.kubernetes.io/master label will be used. + type: object + retentionRules: + description: |- + retentionRules defines the policy for retaining and deleting existing backups. + Backups are deleted from the oldest first until all rules are satisfied (logical OR). + If no rules are specified then backups created by this policy will not be automatically deleted. + items: + properties: + maxQuantity: + description: maxQuantity enforces the deletion of backups that + exceed the given count. + minimum: 0 + type: integer + maxSize: + anyOf: + - type: integer + - type: string + description: |- + maxSize enforces the deletion of backups by the total size of backups on the storage backend. + This is a soft threshold. The total size of backups may temporarily exceed the limit when new backups are created. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: + description: type defined which rule field is set + enum: + - MaxQuantity + - MaxSize + type: string + required: + - type + type: object + type: array + schedule: + description: schedule sets the backup schedule in Cron format, see + https://en.wikipedia.org/wiki/Cron. + type: string + storage: + description: storage specifies the location where etcd backup files + will be saved. + properties: + local: + description: |- + local specifies a host path directory on the master node where the etcd backup file will be saved. + This field is required when storage type is "Local" + properties: + hostPath: + description: hostPath is a local directory on the master node + where the etcd backup file will be saved. + type: string + x-kubernetes-validations: + - message: hostPath is immutable once set + rule: self == oldSelf + required: + - hostPath + type: object + pvc: + description: |- + pvc specifies the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file will be saved. + The PVC must always be created in the "openshift-etcd" namespace. + This field is required when the storage type is "PVC" + properties: + name: + description: name is a reference to a PVC in the "openshift-etcd" + namespace where the etcd backup file will be saved. + type: string + x-kubernetes-validations: + - message: name is immutable once set + rule: self == oldSelf + path: + description: path is a directory on the volume where the etcd + backup file will be saved. + type: string + x-kubernetes-validations: + - message: path is immutable once set + rule: self == oldSelf + required: + - name + type: object + type: + description: EtcdBackupStorageType is an enum of the supported + storage backends for backup files + enum: + - PVC + - Local + type: string + x-kubernetes-validations: + - message: type is immutable once set + rule: self == oldSelf + required: + - type + type: object + x-kubernetes-validations: + - message: pvc is required when type is PVC, and forbidden otherwise + rule: 'self.type == ''PVC'' ? has(self.pvc) : !has(self.pvc)' + - message: local is required when type is Local, and forbidden otherwise + rule: 'self.type == ''Local'' ? has(self.local) : !has(self.local)' + timeZone: + description: |- + The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. + If not specified, this will default to the time zone of the cluster-etcd-operator process. + type: string + required: + - schedule + - storage + type: object + status: + description: status holds observed values from the cluster. They may not + be overridden. + properties: + lastScheduleNodes: + description: lastScheduleNodes is the name of nodes selected during + the last scheduled execution. + items: + type: string + type: array + lastScheduleTime: + description: |- + lastScheduleTime is the time when the last scheduled backup was triggered. + This is used by the controller to track when backups have been executed + and to prevent duplicate executions on controller restart. + format: date-time + type: string + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/operator/v1alpha1/zz_generated.crd-manifests/0000_10_etcd_01_etcdbackups.crd.yaml b/operator/v1alpha1/zz_generated.crd-manifests/0000_10_etcd_01_etcdbackups.crd.yaml index 37ed90bc05c..0aa799f7e91 100644 --- a/operator/v1alpha1/zz_generated.crd-manifests/0000_10_etcd_01_etcdbackups.crd.yaml +++ b/operator/v1alpha1/zz_generated.crd-manifests/0000_10_etcd_01_etcdbackups.crd.yaml @@ -45,44 +45,81 @@ spec: spec: description: spec holds user settable values for configuration properties: - pvcName: + nodeName: description: |- - pvcName specifies the name of the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the - etcd backup file would be saved - The PVC itself must always be created in the "openshift-etcd" namespace - If the PVC is left unspecified "" then the platform will choose a reasonable default location to save the backup. - In the future this would be backups saved across the control-plane master nodes. + nodeName specifies the master node where an etcd backup should be taken. + If not specified, a random master node will be selected. type: string x-kubernetes-validations: - - message: pvcName is immutable once set + - message: nodeName is immutable once set rule: self == oldSelf - type: object - status: - description: status holds observed values from the cluster. They may not - be overridden. - properties: - backupJob: - description: |- - backupJob is the reference to the Job that executes the backup. - Optional + storage: + description: storage specifies the location where etcd backup files + will be saved. properties: - name: + local: description: |- - name is the name of the Job. - Required - type: string - namespace: + local specifies a host path directory on the master node where the etcd backup file will be saved. + This field is required when storage type is "Local" + properties: + hostPath: + description: hostPath is a local directory on the master node + where the etcd backup file will be saved. + type: string + x-kubernetes-validations: + - message: hostPath is immutable once set + rule: self == oldSelf + required: + - hostPath + type: object + pvc: description: |- - namespace is the namespace of the Job. - this is always expected to be "openshift-etcd" since the user provided PVC - is also required to be in "openshift-etcd" - Required - pattern: ^openshift-etcd$ + pvc specifies the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file will be saved. + The PVC must always be created in the "openshift-etcd" namespace. + This field is required when the storage type is "PVC" + properties: + name: + description: name is a reference to a PVC in the "openshift-etcd" + namespace where the etcd backup file will be saved. + type: string + x-kubernetes-validations: + - message: name is immutable once set + rule: self == oldSelf + path: + description: path is a directory on the volume where the etcd + backup file will be saved. + type: string + x-kubernetes-validations: + - message: path is immutable once set + rule: self == oldSelf + required: + - name + type: object + type: + description: EtcdBackupStorageType is an enum of the supported + storage backends for backup files + enum: + - PVC + - Local type: string + x-kubernetes-validations: + - message: type is immutable once set + rule: self == oldSelf required: - - name - - namespace + - type type: object + x-kubernetes-validations: + - message: pvc is required when type is PVC, and forbidden otherwise + rule: 'self.type == ''PVC'' ? has(self.pvc) : !has(self.pvc)' + - message: local is required when type is Local, and forbidden otherwise + rule: 'self.type == ''Local'' ? has(self.local) : !has(self.local)' + required: + - storage + type: object + status: + description: status holds observed values from the cluster. They may not + be overridden. + properties: conditions: description: conditions provide details on the status of the etcd backup job. @@ -144,6 +181,39 @@ spec: x-kubernetes-list-map-keys: - type x-kubernetes-list-type: map + filePath: + description: filePath is the absolute path to the backup file on the + storage backend. + type: string + fileSize: + anyOf: + - type: integer + - type: string + description: fileSize is the size of the backup file on the storage + backend. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + job: + description: job is a reference to the Job created for the backup. + properties: + name: + description: name of the backup job + type: string + namespace: + description: namespace of the backup job + type: string + uid: + description: uid of the backup job + type: string + required: + - name + - namespace + - uid + type: object + nodeName: + description: nodeName is the master node where the backup snapshot + was taken. + type: string type: object required: - spec diff --git a/operator/v1alpha1/zz_generated.deepcopy.go b/operator/v1alpha1/zz_generated.deepcopy.go index 3c3dc8e7a53..1fe8fdc1a5e 100644 --- a/operator/v1alpha1/zz_generated.deepcopy.go +++ b/operator/v1alpha1/zz_generated.deepcopy.go @@ -10,22 +10,6 @@ import ( 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 *BackupJobReference) DeepCopyInto(out *BackupJobReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupJobReference. -func (in *BackupJobReference) DeepCopy() *BackupJobReference { - if in == nil { - return nil - } - out := new(BackupJobReference) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterAPI) DeepCopyInto(out *ClusterAPI) { *out = *in @@ -369,7 +353,7 @@ func (in *EtcdBackup) DeepCopyInto(out *EtcdBackup) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) return } @@ -392,6 +376,22 @@ func (in *EtcdBackup) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EtcdBackupJob) DeepCopyInto(out *EtcdBackupJob) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupJob. +func (in *EtcdBackupJob) DeepCopy() *EtcdBackupJob { + if in == nil { + return nil + } + out := new(EtcdBackupJob) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EtcdBackupList) DeepCopyInto(out *EtcdBackupList) { *out = *in @@ -425,9 +425,144 @@ func (in *EtcdBackupList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EtcdBackupPolicy) DeepCopyInto(out *EtcdBackupPolicy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupPolicy. +func (in *EtcdBackupPolicy) DeepCopy() *EtcdBackupPolicy { + if in == nil { + return nil + } + out := new(EtcdBackupPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EtcdBackupPolicy) 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 *EtcdBackupPolicyList) DeepCopyInto(out *EtcdBackupPolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EtcdBackupPolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupPolicyList. +func (in *EtcdBackupPolicyList) DeepCopy() *EtcdBackupPolicyList { + if in == nil { + return nil + } + out := new(EtcdBackupPolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EtcdBackupPolicyList) 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 *EtcdBackupPolicyRetentionRule) DeepCopyInto(out *EtcdBackupPolicyRetentionRule) { + *out = *in + out.MaxSize = in.MaxSize.DeepCopy() + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupPolicyRetentionRule. +func (in *EtcdBackupPolicyRetentionRule) DeepCopy() *EtcdBackupPolicyRetentionRule { + if in == nil { + return nil + } + out := new(EtcdBackupPolicyRetentionRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EtcdBackupPolicySpec) DeepCopyInto(out *EtcdBackupPolicySpec) { + *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 + } + } + in.Storage.DeepCopyInto(&out.Storage) + if in.RetentionRules != nil { + in, out := &in.RetentionRules, &out.RetentionRules + *out = make([]EtcdBackupPolicyRetentionRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupPolicySpec. +func (in *EtcdBackupPolicySpec) DeepCopy() *EtcdBackupPolicySpec { + if in == nil { + return nil + } + out := new(EtcdBackupPolicySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EtcdBackupPolicyStatus) DeepCopyInto(out *EtcdBackupPolicyStatus) { + *out = *in + if in.LastScheduleTime != nil { + in, out := &in.LastScheduleTime, &out.LastScheduleTime + *out = (*in).DeepCopy() + } + if in.LastScheduleNodes != nil { + in, out := &in.LastScheduleNodes, &out.LastScheduleNodes + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupPolicyStatus. +func (in *EtcdBackupPolicyStatus) DeepCopy() *EtcdBackupPolicyStatus { + if in == nil { + return nil + } + out := new(EtcdBackupPolicyStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EtcdBackupSpec) DeepCopyInto(out *EtcdBackupSpec) { *out = *in + in.Storage.DeepCopyInto(&out.Storage) return } @@ -451,11 +586,12 @@ func (in *EtcdBackupStatus) DeepCopyInto(out *EtcdBackupStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.BackupJob != nil { - in, out := &in.BackupJob, &out.BackupJob - *out = new(BackupJobReference) + if in.Job != nil { + in, out := &in.Job, &out.Job + *out = new(EtcdBackupJob) **out = **in } + out.FileSize = in.FileSize.DeepCopy() return } @@ -469,6 +605,64 @@ func (in *EtcdBackupStatus) DeepCopy() *EtcdBackupStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EtcdBackupStorage) DeepCopyInto(out *EtcdBackupStorage) { + *out = *in + if in.PVC != nil { + in, out := &in.PVC, &out.PVC + *out = new(EtcdBackupStoragePvc) + **out = **in + } + if in.Local != nil { + in, out := &in.Local, &out.Local + *out = new(EtcdBackupStorageLocal) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupStorage. +func (in *EtcdBackupStorage) DeepCopy() *EtcdBackupStorage { + if in == nil { + return nil + } + out := new(EtcdBackupStorage) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EtcdBackupStorageLocal) DeepCopyInto(out *EtcdBackupStorageLocal) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupStorageLocal. +func (in *EtcdBackupStorageLocal) DeepCopy() *EtcdBackupStorageLocal { + if in == nil { + return nil + } + out := new(EtcdBackupStorageLocal) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EtcdBackupStoragePvc) DeepCopyInto(out *EtcdBackupStoragePvc) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupStoragePvc. +func (in *EtcdBackupStoragePvc) DeepCopy() *EtcdBackupStoragePvc { + if in == nil { + return nil + } + out := new(EtcdBackupStoragePvc) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GenerationHistory) DeepCopyInto(out *GenerationHistory) { *out = *in diff --git a/operator/v1alpha1/zz_generated.featuregated-crd-manifests.yaml b/operator/v1alpha1/zz_generated.featuregated-crd-manifests.yaml index 3ad442d9d84..ca4e2bcc8e0 100644 --- a/operator/v1alpha1/zz_generated.featuregated-crd-manifests.yaml +++ b/operator/v1alpha1/zz_generated.featuregated-crd-manifests.yaml @@ -68,6 +68,29 @@ etcdbackups.operator.openshift.io: - AutomatedEtcdBackup Version: v1alpha1 +etcdbackuppolicies.operator.openshift.io: + Annotations: {} + ApprovedPRNumber: "" + CRDName: etcdbackuppolicies.operator.openshift.io + Capability: "" + Category: "" + FeatureGates: + - AutomatedEtcdBackup + FilenameOperatorName: etcd + FilenameOperatorOrdering: "01" + FilenameRunLevel: "0000_10" + GroupName: operator.openshift.io + HasStatus: true + KindName: EtcdBackupPolicy + Labels: {} + PluralName: etcdbackuppolicies + PrinterColumns: [] + Scope: Cluster + ShortNames: null + TopLevelFeatureGates: + - AutomatedEtcdBackup + Version: v1alpha1 + imagecontentsourcepolicies.operator.openshift.io: Annotations: release.openshift.io/bootstrap-required: "true" diff --git a/operator/v1alpha1/zz_generated.featuregated-crd-manifests/etcdbackuppolicies.operator.openshift.io/AutomatedEtcdBackup.yaml b/operator/v1alpha1/zz_generated.featuregated-crd-manifests/etcdbackuppolicies.operator.openshift.io/AutomatedEtcdBackup.yaml new file mode 100644 index 00000000000..12f895792fd --- /dev/null +++ b/operator/v1alpha1/zz_generated.featuregated-crd-manifests/etcdbackuppolicies.operator.openshift.io/AutomatedEtcdBackup.yaml @@ -0,0 +1,189 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + api.openshift.io/filename-cvo-runlevel: "0000_10" + api.openshift.io/filename-operator: etcd + api.openshift.io/filename-ordering: "01" + feature-gate.release.openshift.io/AutomatedEtcdBackup: "true" + name: etcdbackuppolicies.operator.openshift.io +spec: + group: operator.openshift.io + names: + kind: EtcdBackupPolicy + listKind: EtcdBackupPolicyList + plural: etcdbackuppolicies + singular: etcdbackuppolicy + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + # EtcdBackupPolicy sets an automated schedule for taking backups of the etcd cluster + + Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: spec holds user settable values for configuration + properties: + nodeCount: + description: |- + nodeCount sets the maximum number of nodes to run backups on when multiple are selected. + If a value greater than zero is set, nodes are selected in lexicographical order. + Values less than or equal to zero will select all available nodes. + minimum: 0 + type: integer + nodeSelector: + additionalProperties: + type: string + description: |- + nodeSelector specifies which master node(s) to run backup jobs on. + If no selector is specified, the default node-role.kubernetes.io/master label will be used. + type: object + retentionRules: + description: |- + retentionRules defines the policy for retaining and deleting existing backups. + Backups are deleted from the oldest first until all rules are satisfied (logical OR). + If no rules are specified then backups created by this policy will not be automatically deleted. + items: + properties: + maxQuantity: + description: maxQuantity enforces the deletion of backups that + exceed the given count. + minimum: 0 + type: integer + maxSize: + anyOf: + - type: integer + - type: string + description: |- + maxSize enforces the deletion of backups by the total size of backups on the storage backend. + This is a soft threshold. The total size of backups may temporarily exceed the limit when new backups are created. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: + description: type defined which rule field is set + enum: + - MaxQuantity + - MaxSize + type: string + required: + - type + type: object + type: array + schedule: + description: schedule sets the backup schedule in Cron format, see + https://en.wikipedia.org/wiki/Cron. + type: string + storage: + description: storage specifies the location where etcd backup files + will be saved. + properties: + local: + description: |- + local specifies a host path directory on the master node where the etcd backup file will be saved. + This field is required when storage type is "Local" + properties: + hostPath: + description: hostPath is a local directory on the master node + where the etcd backup file will be saved. + type: string + x-kubernetes-validations: + - message: hostPath is immutable once set + rule: self == oldSelf + required: + - hostPath + type: object + pvc: + description: |- + pvc specifies the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file will be saved. + The PVC must always be created in the "openshift-etcd" namespace. + This field is required when the storage type is "PVC" + properties: + name: + description: name is a reference to a PVC in the "openshift-etcd" + namespace where the etcd backup file will be saved. + type: string + x-kubernetes-validations: + - message: name is immutable once set + rule: self == oldSelf + path: + description: path is a directory on the volume where the etcd + backup file will be saved. + type: string + x-kubernetes-validations: + - message: path is immutable once set + rule: self == oldSelf + required: + - name + type: object + type: + description: EtcdBackupStorageType is an enum of the supported + storage backends for backup files + enum: + - PVC + - Local + type: string + x-kubernetes-validations: + - message: type is immutable once set + rule: self == oldSelf + required: + - type + type: object + x-kubernetes-validations: + - message: pvc is required when type is PVC, and forbidden otherwise + rule: 'self.type == ''PVC'' ? has(self.pvc) : !has(self.pvc)' + - message: local is required when type is Local, and forbidden otherwise + rule: 'self.type == ''Local'' ? has(self.local) : !has(self.local)' + timeZone: + description: |- + The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. + If not specified, this will default to the time zone of the cluster-etcd-operator process. + type: string + required: + - schedule + - storage + type: object + status: + description: status holds observed values from the cluster. They may not + be overridden. + properties: + lastScheduleNodes: + description: lastScheduleNodes is the name of nodes selected during + the last scheduled execution. + items: + type: string + type: array + lastScheduleTime: + description: |- + lastScheduleTime is the time when the last scheduled backup was triggered. + This is used by the controller to track when backups have been executed + and to prevent duplicate executions on controller restart. + format: date-time + type: string + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/operator/v1alpha1/zz_generated.featuregated-crd-manifests/etcdbackups.operator.openshift.io/AutomatedEtcdBackup.yaml b/operator/v1alpha1/zz_generated.featuregated-crd-manifests/etcdbackups.operator.openshift.io/AutomatedEtcdBackup.yaml index 07becf7e251..7030a69b23a 100644 --- a/operator/v1alpha1/zz_generated.featuregated-crd-manifests/etcdbackups.operator.openshift.io/AutomatedEtcdBackup.yaml +++ b/operator/v1alpha1/zz_generated.featuregated-crd-manifests/etcdbackups.operator.openshift.io/AutomatedEtcdBackup.yaml @@ -45,44 +45,81 @@ spec: spec: description: spec holds user settable values for configuration properties: - pvcName: + nodeName: description: |- - pvcName specifies the name of the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the - etcd backup file would be saved - The PVC itself must always be created in the "openshift-etcd" namespace - If the PVC is left unspecified "" then the platform will choose a reasonable default location to save the backup. - In the future this would be backups saved across the control-plane master nodes. + nodeName specifies the master node where an etcd backup should be taken. + If not specified, a random master node will be selected. type: string x-kubernetes-validations: - - message: pvcName is immutable once set + - message: nodeName is immutable once set rule: self == oldSelf - type: object - status: - description: status holds observed values from the cluster. They may not - be overridden. - properties: - backupJob: - description: |- - backupJob is the reference to the Job that executes the backup. - Optional + storage: + description: storage specifies the location where etcd backup files + will be saved. properties: - name: + local: description: |- - name is the name of the Job. - Required - type: string - namespace: + local specifies a host path directory on the master node where the etcd backup file will be saved. + This field is required when storage type is "Local" + properties: + hostPath: + description: hostPath is a local directory on the master node + where the etcd backup file will be saved. + type: string + x-kubernetes-validations: + - message: hostPath is immutable once set + rule: self == oldSelf + required: + - hostPath + type: object + pvc: description: |- - namespace is the namespace of the Job. - this is always expected to be "openshift-etcd" since the user provided PVC - is also required to be in "openshift-etcd" - Required - pattern: ^openshift-etcd$ + pvc specifies the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file will be saved. + The PVC must always be created in the "openshift-etcd" namespace. + This field is required when the storage type is "PVC" + properties: + name: + description: name is a reference to a PVC in the "openshift-etcd" + namespace where the etcd backup file will be saved. + type: string + x-kubernetes-validations: + - message: name is immutable once set + rule: self == oldSelf + path: + description: path is a directory on the volume where the etcd + backup file will be saved. + type: string + x-kubernetes-validations: + - message: path is immutable once set + rule: self == oldSelf + required: + - name + type: object + type: + description: EtcdBackupStorageType is an enum of the supported + storage backends for backup files + enum: + - PVC + - Local type: string + x-kubernetes-validations: + - message: type is immutable once set + rule: self == oldSelf required: - - name - - namespace + - type type: object + x-kubernetes-validations: + - message: pvc is required when type is PVC, and forbidden otherwise + rule: 'self.type == ''PVC'' ? has(self.pvc) : !has(self.pvc)' + - message: local is required when type is Local, and forbidden otherwise + rule: 'self.type == ''Local'' ? has(self.local) : !has(self.local)' + required: + - storage + type: object + status: + description: status holds observed values from the cluster. They may not + be overridden. + properties: conditions: description: conditions provide details on the status of the etcd backup job. @@ -144,6 +181,39 @@ spec: x-kubernetes-list-map-keys: - type x-kubernetes-list-type: map + filePath: + description: filePath is the absolute path to the backup file on the + storage backend. + type: string + fileSize: + anyOf: + - type: integer + - type: string + description: fileSize is the size of the backup file on the storage + backend. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + job: + description: job is a reference to the Job created for the backup. + properties: + name: + description: name of the backup job + type: string + namespace: + description: namespace of the backup job + type: string + uid: + description: uid of the backup job + type: string + required: + - name + - namespace + - uid + type: object + nodeName: + description: nodeName is the master node where the backup snapshot + was taken. + type: string type: object required: - spec diff --git a/operator/v1alpha1/zz_generated.model_name.go b/operator/v1alpha1/zz_generated.model_name.go index e3fe9897ddc..7b63d88b252 100644 --- a/operator/v1alpha1/zz_generated.model_name.go +++ b/operator/v1alpha1/zz_generated.model_name.go @@ -5,11 +5,6 @@ package v1alpha1 -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in BackupJobReference) OpenAPIModelName() string { - return "com.github.openshift.api.operator.v1alpha1.BackupJobReference" -} - // OpenAPIModelName returns the OpenAPI model name for this type. func (in ClusterAPI) OpenAPIModelName() string { return "com.github.openshift.api.operator.v1alpha1.ClusterAPI" @@ -90,11 +85,41 @@ func (in EtcdBackup) OpenAPIModelName() string { return "com.github.openshift.api.operator.v1alpha1.EtcdBackup" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EtcdBackupJob) OpenAPIModelName() string { + return "com.github.openshift.api.operator.v1alpha1.EtcdBackupJob" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in EtcdBackupList) OpenAPIModelName() string { return "com.github.openshift.api.operator.v1alpha1.EtcdBackupList" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EtcdBackupPolicy) OpenAPIModelName() string { + return "com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EtcdBackupPolicyList) OpenAPIModelName() string { + return "com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicyList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EtcdBackupPolicyRetentionRule) OpenAPIModelName() string { + return "com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicyRetentionRule" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EtcdBackupPolicySpec) OpenAPIModelName() string { + return "com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicySpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EtcdBackupPolicyStatus) OpenAPIModelName() string { + return "com.github.openshift.api.operator.v1alpha1.EtcdBackupPolicyStatus" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in EtcdBackupSpec) OpenAPIModelName() string { return "com.github.openshift.api.operator.v1alpha1.EtcdBackupSpec" @@ -105,6 +130,21 @@ func (in EtcdBackupStatus) OpenAPIModelName() string { return "com.github.openshift.api.operator.v1alpha1.EtcdBackupStatus" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EtcdBackupStorage) OpenAPIModelName() string { + return "com.github.openshift.api.operator.v1alpha1.EtcdBackupStorage" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EtcdBackupStorageLocal) OpenAPIModelName() string { + return "com.github.openshift.api.operator.v1alpha1.EtcdBackupStorageLocal" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in EtcdBackupStoragePvc) OpenAPIModelName() string { + return "com.github.openshift.api.operator.v1alpha1.EtcdBackupStoragePvc" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in GenerationHistory) OpenAPIModelName() string { return "com.github.openshift.api.operator.v1alpha1.GenerationHistory" diff --git a/operator/v1alpha1/zz_generated.swagger_doc_generated.go b/operator/v1alpha1/zz_generated.swagger_doc_generated.go index bf4117768d1..f169a789429 100644 --- a/operator/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/operator/v1alpha1/zz_generated.swagger_doc_generated.go @@ -268,16 +268,6 @@ func (ClusterVersionOperatorStatus) SwaggerDoc() map[string]string { return map_ClusterVersionOperatorStatus } -var map_BackupJobReference = map[string]string{ - "": "BackupJobReference holds a reference to the batch/v1 Job created to run the etcd backup", - "namespace": "namespace is the namespace of the Job. this is always expected to be \"openshift-etcd\" since the user provided PVC is also required to be in \"openshift-etcd\" Required", - "name": "name is the name of the Job. Required", -} - -func (BackupJobReference) SwaggerDoc() map[string]string { - return map_BackupJobReference -} - var map_EtcdBackup = map[string]string{ "": "\n\n# EtcdBackup provides configuration options and status for a one-time backup attempt of the etcd cluster\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", "spec": "spec holds user settable values for configuration", @@ -288,6 +278,16 @@ func (EtcdBackup) SwaggerDoc() map[string]string { return map_EtcdBackup } +var map_EtcdBackupJob = map[string]string{ + "name": "name of the backup job", + "namespace": "namespace of the backup job", + "uid": "uid of the backup job", +} + +func (EtcdBackupJob) SwaggerDoc() map[string]string { + return map_EtcdBackupJob +} + var map_EtcdBackupList = map[string]string{ "": "EtcdBackupList is a collection of items\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", } @@ -297,7 +297,8 @@ func (EtcdBackupList) SwaggerDoc() map[string]string { } var map_EtcdBackupSpec = map[string]string{ - "pvcName": "pvcName specifies the name of the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file would be saved The PVC itself must always be created in the \"openshift-etcd\" namespace If the PVC is left unspecified \"\" then the platform will choose a reasonable default location to save the backup. In the future this would be backups saved across the control-plane master nodes.", + "nodeName": "nodeName specifies the master node where an etcd backup should be taken. If not specified, a random master node will be selected.", + "storage": "storage specifies the location where etcd backup files will be saved.", } func (EtcdBackupSpec) SwaggerDoc() map[string]string { @@ -306,13 +307,92 @@ func (EtcdBackupSpec) SwaggerDoc() map[string]string { var map_EtcdBackupStatus = map[string]string{ "conditions": "conditions provide details on the status of the etcd backup job.", - "backupJob": "backupJob is the reference to the Job that executes the backup. Optional", + "job": "job is a reference to the Job created for the backup.", + "nodeName": "nodeName is the master node where the backup snapshot was taken.", + "filePath": "filePath is the absolute path to the backup file on the storage backend.", + "fileSize": "fileSize is the size of the backup file on the storage backend.", } func (EtcdBackupStatus) SwaggerDoc() map[string]string { return map_EtcdBackupStatus } +var map_EtcdBackupStorage = map[string]string{ + "pvc": "pvc specifies the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file will be saved. The PVC must always be created in the \"openshift-etcd\" namespace. This field is required when the storage type is \"PVC\"", + "local": "local specifies a host path directory on the master node where the etcd backup file will be saved. This field is required when storage type is \"Local\"", +} + +func (EtcdBackupStorage) SwaggerDoc() map[string]string { + return map_EtcdBackupStorage +} + +var map_EtcdBackupStorageLocal = map[string]string{ + "hostPath": "hostPath is a local directory on the master node where the etcd backup file will be saved.", +} + +func (EtcdBackupStorageLocal) SwaggerDoc() map[string]string { + return map_EtcdBackupStorageLocal +} + +var map_EtcdBackupStoragePvc = map[string]string{ + "name": "name is a reference to a PVC in the \"openshift-etcd\" namespace where the etcd backup file will be saved.", + "path": "path is a directory on the volume where the etcd backup file will be saved.", +} + +func (EtcdBackupStoragePvc) SwaggerDoc() map[string]string { + return map_EtcdBackupStoragePvc +} + +var map_EtcdBackupPolicy = map[string]string{ + "": "\n\n# EtcdBackupPolicy sets an automated schedule for taking backups of the etcd cluster\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", + "spec": "spec holds user settable values for configuration", + "status": "status holds observed values from the cluster. They may not be overridden.", +} + +func (EtcdBackupPolicy) SwaggerDoc() map[string]string { + return map_EtcdBackupPolicy +} + +var map_EtcdBackupPolicyList = map[string]string{ + "": "EtcdBackupPolicyList is a collection of items\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", +} + +func (EtcdBackupPolicyList) SwaggerDoc() map[string]string { + return map_EtcdBackupPolicyList +} + +var map_EtcdBackupPolicyRetentionRule = map[string]string{ + "type": "type defined which rule field is set", + "maxQuantity": "maxQuantity enforces the deletion of backups that exceed the given count.", + "maxSize": "maxSize enforces the deletion of backups by the total size of backups on the storage backend. This is a soft threshold. The total size of backups may temporarily exceed the limit when new backups are created.", +} + +func (EtcdBackupPolicyRetentionRule) SwaggerDoc() map[string]string { + return map_EtcdBackupPolicyRetentionRule +} + +var map_EtcdBackupPolicySpec = map[string]string{ + "schedule": "schedule sets the backup schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.", + "timeZone": "The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will default to the time zone of the cluster-etcd-operator process.", + "nodeSelector": "nodeSelector specifies which master node(s) to run backup jobs on. If no selector is specified, the default node-role.kubernetes.io/master label will be used.", + "nodeCount": "nodeCount sets the maximum number of nodes to run backups on when multiple are selected. If a value greater than zero is set, nodes are selected in lexicographical order. Values less than or equal to zero will select all available nodes.", + "storage": "storage specifies the location where etcd backup files will be saved.", + "retentionRules": "retentionRules defines the policy for retaining and deleting existing backups. Backups are deleted from the oldest first until all rules are satisfied (logical OR). If no rules are specified then backups created by this policy will not be automatically deleted.", +} + +func (EtcdBackupPolicySpec) SwaggerDoc() map[string]string { + return map_EtcdBackupPolicySpec +} + +var map_EtcdBackupPolicyStatus = map[string]string{ + "lastScheduleTime": "lastScheduleTime is the time when the last scheduled backup was triggered. This is used by the controller to track when backups have been executed and to prevent duplicate executions on controller restart.", + "lastScheduleNodes": "lastScheduleNodes is the name of nodes selected during the last scheduled execution.", +} + +func (EtcdBackupPolicyStatus) SwaggerDoc() map[string]string { + return map_EtcdBackupPolicyStatus +} + var map_ImageContentSourcePolicy = map[string]string{ "": "ImageContentSourcePolicy holds cluster-wide information about how to handle registry mirror rules. When multiple policies are defined, the outcome of the behavior is defined on each field.\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", diff --git a/payload-manifests/crds/0000_10_config-operator_01_backups.crd.yaml b/payload-manifests/crds/0000_10_config-operator_01_backups.crd.yaml index 7cffedaa00e..f9d0eba0fb5 100644 --- a/payload-manifests/crds/0000_10_config-operator_01_backups.crd.yaml +++ b/payload-manifests/crds/0000_10_config-operator_01_backups.crd.yaml @@ -129,6 +129,20 @@ spec: status: description: status holds observed values from the cluster. They may not be overridden. + properties: + lastScheduledBackupCount: + description: |- + lastScheduledBackupCount is the number of EtcdBackup resources created + in the last scheduled execution. This typically corresponds to the number + of master nodes in the cluster at the time of backup. + type: integer + lastScheduledTime: + description: |- + lastScheduledTime is the time when the last scheduled backup was triggered. + This is used by the controller to track when backups have been executed + and to prevent duplicate executions on controller restart. + format: date-time + type: string type: object required: - spec diff --git a/payload-manifests/crds/0000_10_etcd_01_etcdbackups.crd.yaml b/payload-manifests/crds/0000_10_etcd_01_etcdbackups.crd.yaml index 37ed90bc05c..0aa799f7e91 100644 --- a/payload-manifests/crds/0000_10_etcd_01_etcdbackups.crd.yaml +++ b/payload-manifests/crds/0000_10_etcd_01_etcdbackups.crd.yaml @@ -45,44 +45,81 @@ spec: spec: description: spec holds user settable values for configuration properties: - pvcName: + nodeName: description: |- - pvcName specifies the name of the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the - etcd backup file would be saved - The PVC itself must always be created in the "openshift-etcd" namespace - If the PVC is left unspecified "" then the platform will choose a reasonable default location to save the backup. - In the future this would be backups saved across the control-plane master nodes. + nodeName specifies the master node where an etcd backup should be taken. + If not specified, a random master node will be selected. type: string x-kubernetes-validations: - - message: pvcName is immutable once set + - message: nodeName is immutable once set rule: self == oldSelf - type: object - status: - description: status holds observed values from the cluster. They may not - be overridden. - properties: - backupJob: - description: |- - backupJob is the reference to the Job that executes the backup. - Optional + storage: + description: storage specifies the location where etcd backup files + will be saved. properties: - name: + local: description: |- - name is the name of the Job. - Required - type: string - namespace: + local specifies a host path directory on the master node where the etcd backup file will be saved. + This field is required when storage type is "Local" + properties: + hostPath: + description: hostPath is a local directory on the master node + where the etcd backup file will be saved. + type: string + x-kubernetes-validations: + - message: hostPath is immutable once set + rule: self == oldSelf + required: + - hostPath + type: object + pvc: description: |- - namespace is the namespace of the Job. - this is always expected to be "openshift-etcd" since the user provided PVC - is also required to be in "openshift-etcd" - Required - pattern: ^openshift-etcd$ + pvc specifies the PersistentVolumeClaim (PVC) which binds a PersistentVolume where the etcd backup file will be saved. + The PVC must always be created in the "openshift-etcd" namespace. + This field is required when the storage type is "PVC" + properties: + name: + description: name is a reference to a PVC in the "openshift-etcd" + namespace where the etcd backup file will be saved. + type: string + x-kubernetes-validations: + - message: name is immutable once set + rule: self == oldSelf + path: + description: path is a directory on the volume where the etcd + backup file will be saved. + type: string + x-kubernetes-validations: + - message: path is immutable once set + rule: self == oldSelf + required: + - name + type: object + type: + description: EtcdBackupStorageType is an enum of the supported + storage backends for backup files + enum: + - PVC + - Local type: string + x-kubernetes-validations: + - message: type is immutable once set + rule: self == oldSelf required: - - name - - namespace + - type type: object + x-kubernetes-validations: + - message: pvc is required when type is PVC, and forbidden otherwise + rule: 'self.type == ''PVC'' ? has(self.pvc) : !has(self.pvc)' + - message: local is required when type is Local, and forbidden otherwise + rule: 'self.type == ''Local'' ? has(self.local) : !has(self.local)' + required: + - storage + type: object + status: + description: status holds observed values from the cluster. They may not + be overridden. + properties: conditions: description: conditions provide details on the status of the etcd backup job. @@ -144,6 +181,39 @@ spec: x-kubernetes-list-map-keys: - type x-kubernetes-list-type: map + filePath: + description: filePath is the absolute path to the backup file on the + storage backend. + type: string + fileSize: + anyOf: + - type: integer + - type: string + description: fileSize is the size of the backup file on the storage + backend. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + job: + description: job is a reference to the Job created for the backup. + properties: + name: + description: name of the backup job + type: string + namespace: + description: namespace of the backup job + type: string + uid: + description: uid of the backup job + type: string + required: + - name + - namespace + - uid + type: object + nodeName: + description: nodeName is the master node where the backup snapshot + was taken. + type: string type: object required: - spec