Skip to content

Commit 3af0a75

Browse files
committed
Resere core taint key prefixes
Signed-off-by: Sathvik <Sathvik.S@ibm.com>
1 parent 867445c commit 3af0a75

20 files changed

+231
-35
lines changed

CONTEXT.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ spec:
257257
- type: "network.kubernetes.io/NetworkProxyReady"
258258
requiredStatus: "True"
259259
taint:
260-
key: "readiness.k8s.io/NetworkReady"
260+
key: "readiness.k8s.io/network/not-ready"
261261
effect: "NoSchedule"
262262
value: "pending"
263263
enforcementMode: "bootstrap-only"
@@ -277,7 +277,7 @@ spec:
277277
- type: "storage.kubernetes.io/CSIReady"
278278
requiredStatus: "True"
279279
taint:
280-
key: "readiness.k8s.io/StorageReady"
280+
key: "readiness.k8s.io/storage/not-ready"
281281
effect: "NoSchedule"
282282
enforcementMode: "continuous"
283283
gracePeriod: "60s"
@@ -420,4 +420,4 @@ rules:
420420
### Networking
421421
- Cluster internal only
422422
- Health check endpoints on :8081
423-
- Metrics endpoint on :8080
423+
- 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
@@ -75,6 +75,12 @@ type NodeReadinessRuleSpec struct {
7575
//
7676
// +required
7777
// +kubebuilder:validation:XValidation:rule="self.key.startsWith('readiness.k8s.io/')",message="taint key must start with 'readiness.k8s.io/'"
78+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/system/')",message="reserved taint prefix 'readiness.k8s.io/system/*' is not allowed"
79+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/core/')",message="reserved taint prefix 'readiness.k8s.io/core/*' is not allowed"
80+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/node/')",message="reserved taint prefix 'readiness.k8s.io/node/*' is not allowed"
81+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/device/')",message="reserved taint prefix 'readiness.k8s.io/device/*' is not allowed"
82+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/network/')",message="reserved taint prefix 'readiness.k8s.io/network/*' is not allowed"
83+
// +kubebuilder:validation:XValidation:rule="!self.key.startsWith('readiness.k8s.io/storage/')",message="reserved taint prefix 'readiness.k8s.io/storage/*' is not allowed"
7884
// +kubebuilder:validation:XValidation:rule="self.key.size() <= 253",message="taint key length must be at most 253 characters"
7985
// +kubebuilder:validation:XValidation:rule="!has(self.value) || self.value.size() <= 63",message="taint value length must be at most 63 characters"
8086
// +kubebuilder:validation:XValidation:rule="self.effect in ['NoSchedule', 'PreferNoSchedule', 'NoExecute']",message="taint effect must be one of 'NoSchedule', 'PreferNoSchedule', 'NoExecute'"

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,24 @@ spec:
186186
x-kubernetes-validations:
187187
- message: taint key must start with 'readiness.k8s.io/'
188188
rule: self.key.startsWith('readiness.k8s.io/')
189+
- message: reserved taint prefix 'readiness.k8s.io/system/*' is not
190+
allowed
191+
rule: '!self.key.startsWith(''readiness.k8s.io/system/'')'
192+
- message: reserved taint prefix 'readiness.k8s.io/core/*' is not
193+
allowed
194+
rule: '!self.key.startsWith(''readiness.k8s.io/core/'')'
195+
- message: reserved taint prefix 'readiness.k8s.io/node/*' is not
196+
allowed
197+
rule: '!self.key.startsWith(''readiness.k8s.io/node/'')'
198+
- message: reserved taint prefix 'readiness.k8s.io/device/*' is not
199+
allowed
200+
rule: '!self.key.startsWith(''readiness.k8s.io/device/'')'
201+
- message: reserved taint prefix 'readiness.k8s.io/network/*' is not
202+
allowed
203+
rule: '!self.key.startsWith(''readiness.k8s.io/network/'')'
204+
- message: reserved taint prefix 'readiness.k8s.io/storage/*' is not
205+
allowed
206+
rule: '!self.key.startsWith(''readiness.k8s.io/storage/'')'
189207
- message: taint key length must be at most 253 characters
190208
rule: self.key.size() <= 253
191209
- message: taint value length must be at most 63 characters

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

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

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

@@ -97,7 +97,7 @@ examples/cni-readiness/apply-calico.sh
9797

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

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)