Add validation for effect when adding control plane taint
- Dominant language
- Go
- Stars
- 2.1k
- Forks
- 328
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 9
Description
I ran an upgrade where I was adding a control plane taint without specifying an effect, but it failed during the upgrade process. I expected this to throw an error in the validations instead.
Error:
```
Upgrading workload cluster
collecting cluster diagnostics
collecting management cluster diagnostics
⏳ Collecting support bundle from cluster, this can take a while {"cluster": "bootstrap-cluster", "bundle": "demo2/generated/bootstrap-cluster-2022-11-02T05:51:34Z-bundle.yaml", "since": 1667357494051613750, "kubeconfig": "demo2/generated/demo2.kind.kubeconfig"}
Support bundle archive created {"path": "support-bundle-2022-11-02T05_51_35.tar.gz"}
Analyzing support bundle {"bundle": "demo2/generated/bootstrap-cluster-2022-11-02T05:51:34Z-bundle.yaml", "archive": "support-bundle-2022-11-02T05_51_35.tar.gz"}
Analysis output generated {"path": "demo2/generated/bootstrap-cluster-2022-11-02T05:53:02Z-analysis.yaml"}
collecting workload cluster diagnostics
⏳ Collecting support bundle from cluster, this can take a while {"cluster": "demo2", "bundle": "demo2/generated/demo2-2022-11-02T05:53:13Z-bundle.yaml", "since": 1667357593755894231, "kubeconfig": "demo2/demo2-eks-a-cluster.kubeconfig"}
Support bundle archive created {"path": "support-bundle-2022-11-02T05_53_15.tar.gz"}
Analyzing support bundle {"bundle": "demo2/generated/demo2-2022-11-02T05:53:13Z-bundle.yaml", "archive": "support-bundle-2022-11-02T05_53_15.tar.gz"}
Analysis output generated {"path": "demo2/generated/demo2-2022-11-02T05:55:27Z-analysis.yaml"}
Error: failed to upgrade cluster: applying capi control plane spec: executing apply: error: error validating "STDIN": error validating data: [ValidationError(KubeadmControlPlane.spec.kubeadmConfigSpec.initConfiguration.nodeRegistration.taints[0]): missing required field "effect" in io.x-k8s.cluster.controlplane.v1beta1.KubeadmControlPlane.spec.kubeadmConfigSpec.initConfiguration.nodeRegistration.taints, ValidationError(KubeadmControlPlane.spec.kubeadmConfigSpec.joinConfiguration.nodeRegistration.taints[0]): missing required field "effect" in io.x-k8s.cluster.controlplane.v1beta1.KubeadmControlPlane.spec.kubeadmConfigSpec.joinConfiguration.nodeRegistration.taints]; if you choose to ignore these errors, turn validation off with --validate=false
```
Spec:
```
controlPlaneConfiguration:
count: 3
endpoint:
host:
machineGroupRef:
kind: VSphereMachineConfig
name: demo2-cp
taints:
- key: test
value: value
```
Contributor guide
Research direction
Start by tracing validation for controlPlaneConfiguration.taints and the upgrade path that produces the Kubernetes validation error. Reproduce the configuration with a taint missing effect, then verify that validation rejects it before the upgrade begins.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100