Skip to content

Commit 540a938

Browse files
committed
Resere core taint key prefixes
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
1 parent 73c6fb5 commit 540a938

20 files changed

+234
-34
lines changed

CONTEXT.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ spec:
258258
- type: "network.kubernetes.io/NetworkProxyReady"
259259
requiredStatus: "True"
260260
taint:
261-
key: "readiness.k8s.io/NetworkReady"
261+
key: "readiness.k8s.io/network/not-ready"
262262
effect: "NoSchedule"
263263
value: "pending"
264264
enforcementMode: "bootstrap-only"
@@ -278,7 +278,7 @@ spec:
278278
- type: "storage.kubernetes.io/CSIReady"
279279
requiredStatus: "True"
280280
taint:
281-
key: "readiness.k8s.io/StorageReady"
281+
key: "readiness.k8s.io/storage/not-ready"
282282
effect: "NoSchedule"
283283
enforcementMode: "continuous"
284284
gracePeriod: "60s"
@@ -421,4 +421,4 @@ rules:
421421
### Networking
422422
- Cluster internal only
423423
- Health check endpoints on :8081
424-
- Metrics endpoint on :8080
424+
- Metrics endpoint on :8080

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ spec:
5151
- type: "example.com/CNIReady"
5252
requiredStatus: "True"
5353
taint:
54-
key: "readiness.k8s.io/NetworkReady"
54+
key: "readiness.k8s.io/example.com/network-not-ready"
5555
effect: "NoSchedule"
5656
value: "pending"
5757
enforcementMode: "bootstrap-only"
@@ -62,6 +62,21 @@ spec:
6262
6363
Find a more detailed walkthrough of setting up Node Readiness Controller in your Kind cluster [here](https://github.com/kubernetes-sigs/node-readiness-controller/blob/main/docs/TEST_README.md).
6464
65+
### Taint Key Conventions
66+
67+
All taint keys must use the `readiness.k8s.io/` prefix. The following core prefixes are reserved and not allowed for user rules:
68+
- `readiness.k8s.io/system/*`
69+
- `readiness.k8s.io/core/*`
70+
- `readiness.k8s.io/node/*`
71+
- `readiness.k8s.io/device/*`
72+
- `readiness.k8s.io/network/*`
73+
- `readiness.k8s.io/storage/*`
74+
75+
Use user-space keys under `readiness.k8s.io/*` with a DNS-style component to avoid conflicts, for example:
76+
- `readiness.k8s.io/example.com/network-not-ready`
77+
- `readiness.k8s.io/projectcalico.org/cni-ready`
78+
- `readiness.k8s.io/vendor.io/storage-driver-ready`
79+
6580
## High-level Roadmap
6681

6782
- [X] Release v0.1.0

api/v1alpha1/nodereadinessrule_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ type NodeReadinessRuleSpec struct {
8282
//
8383
// +required
8484
// +kubebuilder:validation:XValidation:rule="self.key.startsWith('readiness.k8s.io/')",message="taint key must start with 'readiness.k8s.io/'"
85+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/system/')",message="reserved taint prefix 'readiness.k8s.io/system/*' is not allowed"
86+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/core/')",message="reserved taint prefix 'readiness.k8s.io/core/*' is not allowed"
87+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/node/')",message="reserved taint prefix 'readiness.k8s.io/node/*' is not allowed"
88+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/device/')",message="reserved taint prefix 'readiness.k8s.io/device/*' is not allowed"
89+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/network/')",message="reserved taint prefix 'readiness.k8s.io/network/*' is not allowed"
90+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/storage/')",message="reserved taint prefix 'readiness.k8s.io/storage/*' is not allowed"
8591
// +kubebuilder:validation:XValidation:rule="self.key.size() <= 253",message="taint key length must be at most 253 characters"
8692
// +kubebuilder:validation:XValidation:rule="size(self.key.split('/')) == 2",message="taint key must have exactly one '/' separator (prefix/name format)"
8793
// +kubebuilder:validation:XValidation:rule="size(self.key.split('/')[1]) > 0 && size(self.key.split('/')[1]) <= 63",message="taint key name part must be 1-63 characters"

config/crd/bases/readiness.node.x-k8s.io_nodereadinessrules.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,24 @@ spec:
200200
x-kubernetes-validations:
201201
- message: taint key must start with 'readiness.k8s.io/'
202202
rule: self.key.startsWith('readiness.k8s.io/')
203+
- message: reserved taint prefix 'readiness.k8s.io/system/*' is not
204+
allowed
205+
rule: '!self.key.startsWith(''readiness.k8s.io/system/'')'
206+
- message: reserved taint prefix 'readiness.k8s.io/core/*' is not
207+
allowed
208+
rule: '!self.key.startsWith(''readiness.k8s.io/core/'')'
209+
- message: reserved taint prefix 'readiness.k8s.io/node/*' is not
210+
allowed
211+
rule: '!self.key.startsWith(''readiness.k8s.io/node/'')'
212+
- message: reserved taint prefix 'readiness.k8s.io/device/*' is not
213+
allowed
214+
rule: '!self.key.startsWith(''readiness.k8s.io/device/'')'
215+
- message: reserved taint prefix 'readiness.k8s.io/network/*' is not
216+
allowed
217+
rule: '!self.key.startsWith(''readiness.k8s.io/network/'')'
218+
- message: reserved taint prefix 'readiness.k8s.io/storage/*' is not
219+
allowed
220+
rule: '!self.key.startsWith(''readiness.k8s.io/storage/'')'
203221
- message: taint key length must be at most 253 characters
204222
rule: self.key.size() <= 253
205223
- message: taint key must have exactly one '/' separator (prefix/name

config/samples/v1alpha1_nodereadinessrule.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
- type: "network.kubernetes.io/CNIReady"
1111
requiredStatus: "True"
1212
taint:
13-
key: "readiness.k8s.io/NetworkReady"
13+
key: "readiness.k8s.io/example.com/network-not-ready"
1414
effect: "NoSchedule"
1515
value: "pending"
1616
enforcementMode: "bootstrap-only"

config/testing/kind/kind-3node-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ nodes:
1111
kubeletExtraArgs:
1212
node-labels: "reserved-for=platform"
1313
register-with-taints: "node-restriction.kubernetes.io/reserved-for=platform:NoExecute"
14-
- role: worker # workers; reserved labels like node-role.kubernetes.io/worker cannot be used in kind ref: kind/issues/3536
14+
- role: worker # workers; reserved labels like node-role.kubernetes.io/worker cannot be used in kind ref: kind/issues/3536
1515
kubeadmConfigPatches:
1616
- |
1717
kind: JoinConfiguration
1818
nodeRegistration:
1919
kubeletExtraArgs:
2020
node-labels: "reserved-for=worker"
21-
register-with-taints: "readiness.k8s.io/NetworkReady=pending:NoSchedule"
21+
register-with-taints: "readiness.k8s.io/projectcalico.org/network-not-ready=pending:NoSchedule"

config/testing/kind/test-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ nodes:
99
kind: JoinConfiguration
1010
nodeRegistration:
1111
kubeletExtraArgs:
12-
register-with-taints: "readiness.k8s.io/NetworkReady=pending:NoSchedule"
12+
register-with-taints: "readiness.k8s.io/projectcalico.org/network-not-ready=pending:NoSchedule"

docs/TEST_README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The test demonstrates a realistic, production-aligned scenario where critical ad
99
The test uses a 3-node Kind cluster:
1010
1. **`nrr-test-control-plane`**: The Kubernetes control plane. The NRR controller will run here unless specifically configured.
1111
2. **`nrr-test-worker` (Platform Node)**: A dedicated node for running cluster-critical addons. It is labeled `reserved-for=platform` and has a corresponding taint to repel normal application workloads. Cert-manager will run here.
12-
3. **`nrr-test-worker2` (Application Node)**: A standard worker node that starts with a `readiness.k8s.io/NetworkReady=pending:NoSchedule` taint, simulating a node that is not yet ready for application traffic.
12+
3. **`nrr-test-worker2` (Application Node)**: A standard worker node that starts with a `readiness.k8s.io/projectcalico.org/network-not-ready=pending:NoSchedule` taint, simulating a node that is not yet ready for application traffic.
1313

1414
## Running the Test
1515

@@ -94,7 +94,7 @@ kubectl apply -f examples/cni-readiness/network-readiness-rule.yaml
9494
Check that the application worker node (`nrr-test-worker2`) has the `NetworkReady` taint.
9595

9696
```bash
97-
# The output should include 'readiness.k8s.io/NetworkReady'
97+
# The output should include 'readiness.k8s.io/projectcalico.org/network-not-ready'
9898
kubectl get node nrr-test-worker2 -o jsonpath='Taints:{"\n"}{range .spec.taints[*]}{.key}{"\n"}{end}'
9999
```
100100

@@ -120,7 +120,7 @@ examples/cni-readiness/apply-calico.sh
120120

121121
2. **Verify the taint has been removed from the application node:**
122122
```bash
123-
# The output should NO LONGER include 'readiness.k8s.io/NetworkReady'
123+
# The output should NO LONGER include 'readiness.k8s.io/projectcalico.org/network-not-ready'
124124
kubectl get node nrr-test-worker2 -o jsonpath='Taints:{"\n"}{range .spec.taints[*]}{.key}{"\n"}{end}'
125125
```
126126

docs/book/src/examples/cni-readiness.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ In many Kubernetes clusters, the CNI plugin runs as a DaemonSet. When a new node
88
This guide demonstrates how to use the Node Readiness Controller to prevent pods from being scheduled on a node until the Container Network Interface (CNI) plugin (e.g., Calico) is fully initialized and ready.
99

1010
The high-level steps are:
11-
1. Node is bootstrapped with a [startup taint](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) `readiness.k8s.io/NetworkReady=pending:NoSchedule` immediately upon joining.
12-
2. A reporter DaemonSet is deployed to monitor the CNI's health and report it to the API server as node-condition (`projectcalico.org/CalicoReady`).
11+
1. Node is bootstrapped with a [startup taint](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) `readiness.k8s.io/projectcalico.org/network-not-ready=pending:NoSchedule` immediately upon joining.
12+
2. A reporter DaemonSet is deployed to monitor the CNI's health and report it to the API server as node-condition (`projectcalico.org/CalicoReady`).
1313
3. Node Readiness Controller will untaint the node only when the CNI reports it is ready.
1414

1515
## Step-by-Step Guide
@@ -85,7 +85,7 @@ subjects:
8585
8686
### 3. Create the Node Readiness Rule
8787
88-
Now define the rule that enforces the requirement. This tells the controller: *"Keep the `readiness.k8s.io/NetworkReady` taint on the node until `projectcalico.org/CalicoReady` is True."*
88+
Now define the rule that enforces the requirement. This tells the controller: *"Keep the `readiness.k8s.io/projectcalico.org/network-not-ready` taint on the node until `projectcalico.org/CalicoReady` is True."*
8989

9090
```yaml
9191
# network-readiness-rule.yaml
@@ -101,7 +101,7 @@ spec:
101101
102102
# The taint to manage
103103
taint:
104-
key: "readiness.k8s.io/NetworkReady"
104+
key: "readiness.k8s.io/projectcalico.org/network-not-ready"
105105
effect: "NoSchedule"
106106
value: "pending"
107107
@@ -135,11 +135,11 @@ To test this, add a new node to the cluster.
135135

136136
1. **Check the Node Taints**:
137137
Immediately upon joining, the node should have the taint:
138-
`readiness.k8s.io/NetworkReady=pending:NoSchedule`.
138+
`readiness.k8s.io/projectcalico.org/network-not-ready=pending:NoSchedule`.
139139

140140
2. **Check Node Conditions**:
141141
Watch the node conditions. You will initially see `projectcalico.org/CalicoReady` as `False` or missing.
142142
Once Calico starts, the reporter will update it to `True`.
143143

144144
3. **Check Taint Removal**:
145-
As soon as the condition becomes `True`, the Node Readiness Controller will remove the taint, and workloads will be scheduled.
145+
As soon as the condition becomes `True`, the Node Readiness Controller will remove the taint, and workloads will be scheduled.

docs/book/src/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ spec:
4949
- type: "example.com/CNIReady"
5050
requiredStatus: "True"
5151
taint:
52-
key: "readiness.k8s.io/NetworkReady"
52+
key: "readiness.k8s.io/example.com/network-not-ready"
5353
effect: "NoSchedule"
5454
value: "pending"
5555
enforcementMode: "bootstrap-only"
@@ -72,4 +72,4 @@ See the Kubernetes community on the [community page](http://kubernetes.io/commun
7272
7373
## Project Status
7474
75-
This project is currently in **alpha**. The API may change in future releases.
75+
This project is currently in **alpha**. The API may change in future releases.

0 commit comments

Comments
 (0)