Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -27274,6 +27274,11 @@
"description": "unsupportedConfigOverrides overrides the final configuration that was computed by the operator. Red Hat does not support the use of this field. Misuse of this field could lead to unexpected behavior or conflict with other configuration options. Seek guidance from the Red Hat support before using this field. Use of this property blocks cluster upgrades, it must be removed before upgrading your cluster.",
"default": {},
"$ref": "#/definitions/io.k8s.apimachinery.pkg.runtime.RawExtension"
},
"vsphereStorageDriver": {
"description": "VSphereStorageDriver indicates the storage driver to use on VSphere clusters. Once this field is set to CSIWithMigrationDriver, it can not be changed. If this is empty, the platform will choose a good default, which may change over time without notice. DEPRECATED: This field will be removed in a future release.",
"type": "string",
"default": ""
}
}
},
Expand Down
13 changes: 13 additions & 0 deletions operator/v1/0000_50_cluster_storage_operator_01_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ spec:
type: object
nullable: true
x-kubernetes-preserve-unknown-fields: true
vsphereStorageDriver:
description: 'VSphereStorageDriver indicates the storage driver to use on VSphere clusters. Once this field is set to CSIWithMigrationDriver, it can not be changed. If this is empty, the platform will choose a good default, which may change over time without notice. DEPRECATED: This field will be removed in a future release.'
type: string
enum:
- ""
- LegacyDeprecatedInTreeDriver
- CSIWithMigrationDriver
x-kubernetes-validations:
- rule: self == oldSelf || oldSelf == "" || self == "CSIWithMigrationDriver"
message: VSphereStorageDriver can not be changed once it is set to CSIWithMigrationDriver
x-kubernetes-validations:
- rule: '!has(oldSelf.vsphereStorageDriver) || has(self.vsphereStorageDriver)'
message: VSphereStorageDriver is required once set
status:
description: status holds observed values from the cluster. They may not be overridden.
type: object
Expand Down
88 changes: 88 additions & 0 deletions operator/v1/stable.storage.testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,91 @@ tests:
spec:
logLevel: Normal
operatorLogLevel: Normal
onUpdate:
- name: Should allow enabling CSI migration for vSphere
initial: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec: {} # No spec is required
updated: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: CSIWithMigrationDriver
expected: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: CSIWithMigrationDriver
logLevel: Normal
operatorLogLevel: Normal
- name: Should allow disabling CSI migration for vSphere
initial: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec: {} # No spec is required
updated: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: LegacyDeprecatedInTreeDriver
expected: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: LegacyDeprecatedInTreeDriver
logLevel: Normal
operatorLogLevel: Normal
- name: Should allow changing LegacyDeprecatedInTreeDriver to CSIWithMigrationDriver
initial: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: LegacyDeprecatedInTreeDriver
updated: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: CSIWithMigrationDriver
expected: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: CSIWithMigrationDriver
logLevel: Normal
operatorLogLevel: Normal
- name: Should not allow changing CSIWithMigrationDriver to LegacyDeprecatedInTreeDriver
initial: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: CSIWithMigrationDriver
updated: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: LegacyDeprecatedInTreeDriver
expectedError: "VSphereStorageDriver can not be changed once it is set to CSIWithMigrationDriver"
- name: Should not allow changing CSIWithMigrationDriver to empty string
initial: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: CSIWithMigrationDriver
updated: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: ""
expectedError: "VSphereStorageDriver can not be changed once it is set to CSIWithMigrationDriver"
- name: Should not allow unsetting VSphereStorageDriver once it is set
initial: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec:
vsphereStorageDriver: CSIWithMigrationDriver
updated: |
apiVersion: operator.openshift.io/v1
kind: Storage
spec: {}
expectedError: "VSphereStorageDriver is required once set"
19 changes: 19 additions & 0 deletions operator/v1/types_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,28 @@ type Storage struct {
Status StorageStatus `json:"status"`
}

// StorageDriverType indicates whether CSI migration should be enabled for drivers where it is optional.
// +kubebuilder:validation:Enum="";LegacyDeprecatedInTreeDriver;CSIWithMigrationDriver
type StorageDriverType string

const (
LegacyDeprecatedInTreeDriver StorageDriverType = "LegacyDeprecatedInTreeDriver"
CSIWithMigrationDriver StorageDriverType = "CSIWithMigrationDriver"
)

// StorageSpec is the specification of the desired behavior of the cluster storage operator.
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.vsphereStorageDriver) || has(self.vsphereStorageDriver)", message="VSphereStorageDriver is required once set"
type StorageSpec struct {
OperatorSpec `json:",inline"`

// VSphereStorageDriver indicates the storage driver to use on VSphere clusters.
// Once this field is set to CSIWithMigrationDriver, it can not be changed.
// If this is empty, the platform will choose a good default,
// which may change over time without notice.
// DEPRECATED: This field will be removed in a future release.
// +kubebuilder:validation:XValidation:rule="self == oldSelf || oldSelf == \"\" || self == \"CSIWithMigrationDriver\"",message="VSphereStorageDriver can not be changed once it is set to CSIWithMigrationDriver"
// +optional
VSphereStorageDriver StorageDriverType `json:"vsphereStorageDriver"`
}

// StorageStatus defines the observed status of the cluster storage operator.
Expand Down
3 changes: 2 additions & 1 deletion operator/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.