-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ETCD-520: add etcd dbsize field #1736
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this | ||
name: "Etcd" | ||
crdName: etcds.operator.openshift.io | ||
featureGate: EtcdBackendQuota | ||
tests: | ||
onCreate: | ||
- name: Should be able to create with 8 BackendQuotaGiB | ||
initial: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib8 | ||
spec: | ||
backendQuotaGiB: 8 | ||
expected: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: default | ||
spec: | ||
logLevel: Normal | ||
operatorLogLevel: Normal | ||
backendQuotaGiB: 8 | ||
- name: Should be able to create with 16 BackendQuotaGiB | ||
initial: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib16 | ||
spec: | ||
backendQuotaGiB: 16 | ||
expected: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib16 | ||
spec: | ||
logLevel: Normal | ||
operatorLogLevel: Normal | ||
backendQuotaGiB: 16 | ||
- name: Should be able to create with 20 BackendQuotaGiB | ||
initial: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib20 | ||
spec: | ||
backendQuotaGiB: 20 | ||
expected: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib20 | ||
spec: | ||
logLevel: Normal | ||
operatorLogLevel: Normal | ||
backendQuotaGiB: 20 | ||
- name: Should be able to create with 32 BackendQuotaGiB | ||
initial: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib32 | ||
spec: | ||
backendQuotaGiB: 32 | ||
expected: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib32 | ||
spec: | ||
logLevel: Normal | ||
operatorLogLevel: Normal | ||
backendQuotaGiB: 32 | ||
- name: Should not be able to create with less than 8 BackendQuotaGiB | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JoelSpeed this is to test the case of violating the minimum of |
||
initial: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib6 | ||
spec: | ||
backendQuotaGiB: 6 | ||
expectedError: "spec.backendQuotaGiB: Invalid value: 6: spec.backendQuotaGiB in body should be greater than or equal to 8" | ||
- name: Should not be able to create with more than 32 BackendQuotaGiB | ||
initial: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib40 | ||
spec: | ||
backendQuotaGiB: 40 | ||
expectedError: "spec.backendQuotaGiB: Invalid value: 40: spec.backendQuotaGiB in body should be less than or equal to 32" | ||
onUpdate: | ||
- name: Should be able to create with default then upgrade to 16 | ||
initial: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: default | ||
spec: | ||
backendQuotaGiB: 8 | ||
updated: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib16 | ||
spec: | ||
backendQuotaGiB: 16 | ||
expected: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib16 | ||
spec: | ||
logLevel: Normal | ||
operatorLogLevel: Normal | ||
backendQuotaGiB: 16 | ||
- name: Should not be allowed to try to decrease BackendQuotaGiB | ||
initial: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib16 | ||
spec: | ||
backendQuotaGiB: 16 | ||
updated: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib8 | ||
spec: | ||
backendQuotaGiB: 8 | ||
expectedError: etcd backendQuotaGiB may not be decreased | ||
- name: Should not be allowed to upgrade to more than 32 BackendQuotaGiB | ||
initial: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib16 | ||
spec: | ||
backendQuotaGiB: 16 | ||
updated: | | ||
apiVersion: operator.openshift.io/v1 | ||
kind: Etcd | ||
metadata: | ||
name: gib40 | ||
spec: | ||
backendQuotaGiB: 40 | ||
expectedError: "spec.backendQuotaGiB: Invalid value: 40: spec.backendQuotaGiB in body should be less than or equal to 32" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,18 @@ type EtcdSpec struct { | |
// +openshift:enable:FeatureGate=HardwareSpeed | ||
// +optional | ||
HardwareSpeed ControlPlaneHardwareSpeed `json:"controlPlaneHardwareSpeed"` | ||
|
||
// backendQuotaGiB sets the etcd backend storage size limit in gibibytes. | ||
// The value should be an integer not less than 8 and not more than 32. | ||
// When not specified, the default value is 8. | ||
// +kubebuilder:default:=8 | ||
// +kubebuilder:validation:Minimum=8 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JoelSpeed adding |
||
// +kubebuilder:validation:Maximum=32 | ||
Comment on lines
+51
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To have a default, you need
With omtiempty, I expect:
I would hope to see tests for creating both with and without the value initially, and tests for adding the value and trying to increase and decrease the value with the appropriate pass and failure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did the minimum disappear? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JoelSpeed i used the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as we discussed in the call, i used no need to minimum anymore, or ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I think you need a minimum still, otherwise I could create the object with a lower value |
||
// +kubebuilder:validation:XValidation:rule="self>=oldSelf",message="etcd backendQuotaGiB may not be decreased" | ||
// +openshift:enable:FeatureGate=EtcdBackendQuota | ||
// +default=8 | ||
// +optional | ||
BackendQuotaGiB int32 `json:"backendQuotaGiB,omitempty"` | ||
} | ||
|
||
type EtcdStatus struct { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not right, this should be 8, whys the tag not worked 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea why .. the taga are correct