Skip to content

Commit

Permalink
update api validation on minimumKubeletVersion
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hunt <[email protected]>
  • Loading branch information
origin-release-container authored and haircommander committed Oct 30, 2024
1 parent 0a8ec78 commit 85078a8
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,24 @@ tests:
apiVersion: config.openshift.io/v1
kind: Node
spec: {}
- name: Should be able to create a minimumKubeletVersion
initial: |
apiVersion: config.openshift.io/v1
kind: Node
spec:
minimumKubeletVersion: 1.30.0
expected: |
apiVersion: config.openshift.io/v1
kind: Node
spec:
minimumKubeletVersion: 1.30.0
- name: Should be able to create a minimumKubeletVersion
initial: |
apiVersion: config.openshift.io/v1
kind: Node
spec:
minimumKubeletVersion: bogus
expected: |
apiVersion: config.openshift.io/v1
kind: Node
spec: {}
10 changes: 7 additions & 3 deletions config/v1/types_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,18 @@ type NodeSpec struct {
// +optional
WorkerLatencyProfile WorkerLatencyProfileType `json:"workerLatencyProfile,omitempty"`

// MinimumKubeletVersion is the lowest version of a kubelet that can meaningfully join the cluster.
// minimumKubeletVersion is the lowest version of a kubelet that can join the cluster.
// Specifically, the apiserver will deny most authorization requests of kubelets that are older
// than the specified version, only allowing the kubelet to get and update its node object, and perform
// subjectaccessreviews.
// +kubebuilder:validation:Pattern=`^[0-9]*\.[0-9]*\.[0-9]*$`
// This means the kubelet won't be able to view API objects it's responsible for running,
// and will eventually be marked as NotReady.
// Its max length is 8, so maximum version allowed is either "9.999.99" or "99.99.99".
// +kubebuilder:validation:XValidation:rule="self == \"\" || self.matches('^[0-9]*.[0-9]*.[0-9]*$')",message="minmumKubeletVersion must be in a semver compatible format of x.y.z, or empty"
// +kubebuilder:validation:MaxLength:=8
// +openshift:enable:FeatureGate=MinimumKubeletVersion
// +optional
MinimumKubeletVersion string `json:"minimumKubeletVersion,omitempty"`
MinimumKubeletVersion string `json:"minimumKubeletVersion"`
}

type NodeStatus struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ spec:
type: string
minimumKubeletVersion:
description: |-
MinimumKubeletVersion is the lowest version of a kubelet that can meaningfully join the cluster.
minimumKubeletVersion is the lowest version of a kubelet that can join the cluster.
Specifically, the apiserver will deny most authorization requests of kubelets that are older
than the specified version, only allowing the kubelet to get and update its node object, and perform
subjectaccessreviews.
pattern: ^[0-9]*\.[0-9]*\.[0-9]*$
This means the kubelet won't be able to view API objects it's responsible for running,
and will eventually be marked as NotReady.
Its max length is 8, so maximum version allowed is either "9.999.99" or "99.99.99".
maxLength: 8
type: string
x-kubernetes-validations:
- message: minmumKubeletVersion must be in a semver compatible format
of x.y.z, or empty
rule: self == "" || self.matches('^[0-9]*.[0-9]*.[0-9]*$')
workerLatencyProfile:
description: |-
WorkerLatencyProfile determins the how fast the kubelet is updating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ spec:
type: string
minimumKubeletVersion:
description: |-
MinimumKubeletVersion is the lowest version of a kubelet that can meaningfully join the cluster.
minimumKubeletVersion is the lowest version of a kubelet that can join the cluster.
Specifically, the apiserver will deny most authorization requests of kubelets that are older
than the specified version, only allowing the kubelet to get and update its node object, and perform
subjectaccessreviews.
pattern: ^[0-9]*\.[0-9]*\.[0-9]*$
This means the kubelet won't be able to view API objects it's responsible for running,
and will eventually be marked as NotReady.
Its max length is 8, so maximum version allowed is either "9.999.99" or "99.99.99".
maxLength: 8
type: string
x-kubernetes-validations:
- message: minmumKubeletVersion must be in a semver compatible format
of x.y.z, or empty
rule: self == "" || self.matches('^[0-9]*.[0-9]*.[0-9]*$')
workerLatencyProfile:
description: |-
WorkerLatencyProfile determins the how fast the kubelet is updating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ spec:
type: string
minimumKubeletVersion:
description: |-
MinimumKubeletVersion is the lowest version of a kubelet that can meaningfully join the cluster.
minimumKubeletVersion is the lowest version of a kubelet that can join the cluster.
Specifically, the apiserver will deny most authorization requests of kubelets that are older
than the specified version, only allowing the kubelet to get and update its node object, and perform
subjectaccessreviews.
pattern: ^[0-9]*\.[0-9]*\.[0-9]*$
This means the kubelet won't be able to view API objects it's responsible for running,
and will eventually be marked as NotReady.
Its max length is 8, so maximum version allowed is either "9.999.99" or "99.99.99".
maxLength: 8
type: string
x-kubernetes-validations:
- message: minmumKubeletVersion must be in a semver compatible format
of x.y.z, or empty
rule: self == "" || self.matches('^[0-9]*.[0-9]*.[0-9]*$')
workerLatencyProfile:
description: |-
WorkerLatencyProfile determins the how fast the kubelet is updating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ spec:
type: string
minimumKubeletVersion:
description: |-
MinimumKubeletVersion is the lowest version of a kubelet that can meaningfully join the cluster.
minimumKubeletVersion is the lowest version of a kubelet that can join the cluster.
Specifically, the apiserver will deny most authorization requests of kubelets that are older
than the specified version, only allowing the kubelet to get and update its node object, and perform
subjectaccessreviews.
pattern: ^[0-9]*\.[0-9]*\.[0-9]*$
This means the kubelet won't be able to view API objects it's responsible for running,
and will eventually be marked as NotReady.
Its max length is 8, so maximum version allowed is either "9.999.99" or "99.99.99".
maxLength: 8
type: string
x-kubernetes-validations:
- message: minmumKubeletVersion must be in a semver compatible format
of x.y.z, or empty
rule: self == "" || self.matches('^[0-9]*.[0-9]*.[0-9]*$')
workerLatencyProfile:
description: |-
WorkerLatencyProfile determins the how fast the kubelet is updating
Expand Down
2 changes: 1 addition & 1 deletion config/v1/zz_generated.swagger_doc_generated.go

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

4 changes: 3 additions & 1 deletion kubecontrolplane/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ type KubeAPIServerConfig struct {
// TODO this needs to be removed.
APIServerArguments map[string]Arguments `json:"apiServerArguments"`

// MinimumKubeletVersion is the lowest version of a kubelet that can meaningfully join the cluster.
// minimumKubeletVersion is the lowest version of a kubelet that can join the cluster.
// Specifically, the apiserver will deny most authorization requests of kubelets that are older
// than the specified version, only allowing the kubelet to get and update its node object, and perform
// subjectaccessreviews.
// This means the kubelet won't be able to view API objects it's responsible for running,
// and will eventually be marked as NotReady.
// +openshift:enable:FeatureGate=MinimumKubeletVersion
MinimumKubeletVersion string `json:"minimumKubeletVersion,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion kubecontrolplane/v1/zz_generated.swagger_doc_generated.go

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

5 changes: 3 additions & 2 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.

7 changes: 4 additions & 3 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -8271,8 +8271,9 @@
"type": "string"
},
"minimumKubeletVersion": {
"description": "MinimumKubeletVersion is the lowest version of a kubelet that can meaningfully join the cluster. Specifically, the apiserver will deny most authorization requests of kubelets that are older than the specified version, only allowing the kubelet to get and update its node object, and perform subjectaccessreviews.",
"type": "string"
"description": "minimumKubeletVersion is the lowest version of a kubelet that can join the cluster. Specifically, the apiserver will deny most authorization requests of kubelets that are older than the specified version, only allowing the kubelet to get and update its node object, and perform subjectaccessreviews. This means the kubelet won't be able to view API objects it's responsible for running, and will eventually be marked as NotReady. Its max length is 8, so maximum version allowed is either \"9.999.99\" or \"99.99.99\".",
"type": "string",
"default": ""
},
"workerLatencyProfile": {
"description": "WorkerLatencyProfile determins the how fast the kubelet is updating the status and corresponding reaction of the cluster",
Expand Down Expand Up @@ -14791,7 +14792,7 @@
"$ref": "#/definitions/com.github.openshift.api.kubecontrolplane.v1.KubeletConnectionInfo"
},
"minimumKubeletVersion": {
"description": "MinimumKubeletVersion is the lowest version of a kubelet that can meaningfully join the cluster. Specifically, the apiserver will deny most authorization requests of kubelets that are older than the specified version, only allowing the kubelet to get and update its node object, and perform subjectaccessreviews.",
"description": "minimumKubeletVersion is the lowest version of a kubelet that can join the cluster. Specifically, the apiserver will deny most authorization requests of kubelets that are older than the specified version, only allowing the kubelet to get and update its node object, and perform subjectaccessreviews. This means the kubelet won't be able to view API objects it's responsible for running, and will eventually be marked as NotReady.",
"type": "string"
},
"oauthConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ spec:
type: string
minimumKubeletVersion:
description: |-
MinimumKubeletVersion is the lowest version of a kubelet that can meaningfully join the cluster.
minimumKubeletVersion is the lowest version of a kubelet that can join the cluster.
Specifically, the apiserver will deny most authorization requests of kubelets that are older
than the specified version, only allowing the kubelet to get and update its node object, and perform
subjectaccessreviews.
pattern: ^[0-9]*\.[0-9]*\.[0-9]*$
This means the kubelet won't be able to view API objects it's responsible for running,
and will eventually be marked as NotReady.
Its max length is 8, so maximum version allowed is either "9.999.99" or "99.99.99".
maxLength: 8
type: string
x-kubernetes-validations:
- message: minmumKubeletVersion must be in a semver compatible format
of x.y.z, or empty
rule: self == "" || self.matches('^[0-9]*.[0-9]*.[0-9]*$')
workerLatencyProfile:
description: |-
WorkerLatencyProfile determins the how fast the kubelet is updating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ spec:
type: string
minimumKubeletVersion:
description: |-
MinimumKubeletVersion is the lowest version of a kubelet that can meaningfully join the cluster.
minimumKubeletVersion is the lowest version of a kubelet that can join the cluster.
Specifically, the apiserver will deny most authorization requests of kubelets that are older
than the specified version, only allowing the kubelet to get and update its node object, and perform
subjectaccessreviews.
pattern: ^[0-9]*\.[0-9]*\.[0-9]*$
This means the kubelet won't be able to view API objects it's responsible for running,
and will eventually be marked as NotReady.
Its max length is 8, so maximum version allowed is either "9.999.99" or "99.99.99".
maxLength: 8
type: string
x-kubernetes-validations:
- message: minmumKubeletVersion must be in a semver compatible format
of x.y.z, or empty
rule: self == "" || self.matches('^[0-9]*.[0-9]*.[0-9]*$')
workerLatencyProfile:
description: |-
WorkerLatencyProfile determins the how fast the kubelet is updating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ spec:
type: string
minimumKubeletVersion:
description: |-
MinimumKubeletVersion is the lowest version of a kubelet that can meaningfully join the cluster.
minimumKubeletVersion is the lowest version of a kubelet that can join the cluster.
Specifically, the apiserver will deny most authorization requests of kubelets that are older
than the specified version, only allowing the kubelet to get and update its node object, and perform
subjectaccessreviews.
pattern: ^[0-9]*\.[0-9]*\.[0-9]*$
This means the kubelet won't be able to view API objects it's responsible for running,
and will eventually be marked as NotReady.
Its max length is 8, so maximum version allowed is either "9.999.99" or "99.99.99".
maxLength: 8
type: string
x-kubernetes-validations:
- message: minmumKubeletVersion must be in a semver compatible format
of x.y.z, or empty
rule: self == "" || self.matches('^[0-9]*.[0-9]*.[0-9]*$')
workerLatencyProfile:
description: |-
WorkerLatencyProfile determins the how fast the kubelet is updating
Expand Down

0 comments on commit 85078a8

Please sign in to comment.