You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add admission validation for WebhookDeploymentCustomization
Validate WebhookDeploymentCustomization fields on both provisioning.cattle.io/v1
and management.cattle.io/v3 Cluster resources:
- replicaCount must be >= 1
- appendTolerations keys validated against k8s label name rules
- overrideAffinity label selectors validated
- PDB minAvailable/maxUnavailable: non-negative int or 0-100% string,
cannot both be non-zero simultaneously
Copy file name to clipboardExpand all lines: docs.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -245,6 +245,22 @@ Both `minAvailable` and `maxUnavailable` must be a string which represents a non
245
245
^([0-9]|[1-9][0-9]|100)%$
246
246
```
247
247
248
+
##### Feature: Webhook Deployment Customization
249
+
250
+
The `WebhookDeploymentCustomization` field configures the rancher-webhook deployment on downstream clusters. The following sub-fields are validated:
251
+
252
+
-`replicaCount`: If set, must be at least 1.
253
+
-`appendTolerations`: Toleration keys are validated against the upstream apimachinery label name regex:
254
+
```regex
255
+
([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]
256
+
```
257
+
-`overrideAffinity`: Node affinity `nodeSelectorTerms` are validated via label name validation. Pod affinity and pod anti-affinity are validated via label selectors using the [apimachinery label selector validation](https://github.com/kubernetes/apimachinery/blob/02a41040d88da08de6765573ae2b1a51f424e1ca/pkg/apis/meta/v1/validation/validation.go#L56).
258
+
-`podDisruptionBudget.minAvailable` and `podDisruptionBudget.maxUnavailable`: Each must be a non-negative whole integer or a whole number percentage between `0%` and `100%`. Only one of the two fields can have a non-zero or non-empty value at a given time. These fields use the following regex when assessing if a given percentage value is valid:
259
+
```regex
260
+
^([0-9]|[1-9][0-9]|100)%$
261
+
```
262
+
-`overrideResourceRequirements`: Not validated by the webhook — the Kubernetes API server validates `ResourceRequirements` natively.
263
+
248
264
## ClusterProxyConfig
249
265
250
266
### Validation Checks
@@ -805,6 +821,22 @@ Both `minAvailable` and `maxUnavailable` must be a string which represents a non
805
821
^([0-9]|[1-9][0-9]|100)%$
806
822
```
807
823
824
+
##### cluster.spec.webhookDeploymentCustomization
825
+
826
+
The `WebhookDeploymentCustomization` field configures the rancher-webhook deployment on downstream clusters. The following sub-fields are validated:
827
+
828
+
-`replicaCount`: If set, must be at least 1.
829
+
-`appendTolerations`: Toleration keys are validated against the same upstream apimachinery label name regex used for agent deployment customizations:
830
+
```regex
831
+
([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]
832
+
```
833
+
-`overrideAffinity`: Node affinity `nodeSelectorTerms` are validated via label name validation. Pod affinity and pod anti-affinity are validated via label selectors using the [apimachinery label selector validation](https://github.com/kubernetes/apimachinery/blob/02a41040d88da08de6765573ae2b1a51f424e1ca/pkg/apis/meta/v1/validation/validation.go#L56).
834
+
-`podDisruptionBudget.minAvailable` and `podDisruptionBudget.maxUnavailable`: Each must be a non-negative whole integer or a whole number percentage between `0%` and `100%`. Only one of the two fields can have a non-zero or non-empty value at a given time. These fields use the following regex when assessing if a given percentage value is valid:
835
+
```regex
836
+
^([0-9]|[1-9][0-9]|100)%$
837
+
```
838
+
-`overrideResourceRequirements`: Not validated by the webhook — the Kubernetes API server validates `ResourceRequirements` natively.
839
+
808
840
##### NO_PROXY value
809
841
810
842
Prevent the update of objects with an env var (under `spec.agentEnvVars`) with a name of `NO_PROXY` if its value contains one or more spaces. This ensures that the provided value adheres to
Copy file name to clipboardExpand all lines: pkg/resources/management.cattle.io/v3/cluster/Cluster.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,3 +43,19 @@ Both `minAvailable` and `maxUnavailable` must be a string which represents a non
43
43
```regex
44
44
^([0-9]|[1-9][0-9]|100)%$
45
45
```
46
+
47
+
#### Feature: Webhook Deployment Customization
48
+
49
+
The `WebhookDeploymentCustomization` field configures the rancher-webhook deployment on downstream clusters. The following sub-fields are validated:
50
+
51
+
-`replicaCount`: If set, must be at least 1.
52
+
-`appendTolerations`: Toleration keys are validated against the upstream apimachinery label name regex:
53
+
```regex
54
+
([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]
55
+
```
56
+
-`overrideAffinity`: Node affinity `nodeSelectorTerms` are validated via label name validation. Pod affinity and pod anti-affinity are validated via label selectors using the [apimachinery label selector validation](https://github.com/kubernetes/apimachinery/blob/02a41040d88da08de6765573ae2b1a51f424e1ca/pkg/apis/meta/v1/validation/validation.go#L56).
57
+
-`podDisruptionBudget.minAvailable` and `podDisruptionBudget.maxUnavailable`: Each must be a non-negative whole integer or a whole number percentage between `0%` and `100%`. Only one of the two fields can have a non-zero or non-empty value at a given time. These fields use the following regex when assessing if a given percentage value is valid:
58
+
```regex
59
+
^([0-9]|[1-9][0-9]|100)%$
60
+
```
61
+
-`overrideResourceRequirements`: Not validated by the webhook — the Kubernetes API server validates `ResourceRequirements` natively.
errList=append(errList, field.Invalid(path, pdb, "both minAvailable and maxUnavailable cannot be set to a non-zero value, at least one must be omitted or set to zero"))
0 commit comments