Skip to content

Commit

Permalink
install: Update node label prefix
Browse files Browse the repository at this point in the history
For Kubernetes version greater than or equal to 1.16, node label keys
in the 'kubernetes.io' or 'k8s.io' namespace must begin with an allowed
prefix (kubelet.kubernetes.io, node.kubernetes.io).
Update node label from node-role.kubernetes.io to node.kubernetes.io

Fixes: confidential-containers#194
Signed-off-by: Kartik Joshi <kartikjoshi@microsoft.com>
  • Loading branch information
kartikjoshi21 committed Jun 16, 2023
1 parent 83b5134 commit 93323d7
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Setup kind cluster
run: |
kind create cluster --image "kindest/node:v1.26.0-coco" -n coco-sgx --config tests/e2e/enclave-cc-kind-config.yaml --wait 120s
kubectl label node coco-sgx-worker node-role.kubernetes.io/worker=
kubectl label node coco-sgx-worker node.kubernetes.io/worker=
- name: Deploy operator from the local registry
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/enclave-cc-cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Setup kind cluster
run: |
kind create cluster --image "kindest/node:v1.26.0-coco" -n coco-sgx --config tests/e2e/enclave-cc-kind-config.yaml --wait 120s
kubectl label node coco-sgx-worker node-role.kubernetes.io/worker=
kubectl label node coco-sgx-worker node.kubernetes.io/worker=
- name: Deploy operator from the local registry
run: |
Expand Down
2 changes: 1 addition & 1 deletion bundle/manifests/cc-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
"spec": {
"ccNodeSelector": {
"matchLabels": {
"node-role.kubernetes.io/worker": ""
"node.kubernetes.io/worker": ""
}
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion config/samples/ccruntime/base/ccruntime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
runtimeName: kata
ccNodeSelector:
matchLabels:
node-role.kubernetes.io/worker: ""
node.kubernetes.io/worker: ""
config:
installType: bundle
payloadImage: quay.io/confidential-containers/runtime-payload:kata-containers
Expand Down
2 changes: 1 addition & 1 deletion config/samples/enclave-cc/base/ccruntime-enclave-cc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
runtimeName: enclave-cc
ccNodeSelector:
matchLabels:
node-role.kubernetes.io/worker: ""
node.kubernetes.io/worker: ""
config:
installType: bundle
payloadImage: quay.io/confidential-containers/runtime-payload:enclave-cc-HW-cc-kbc-v0.6.1
Expand Down
8 changes: 4 additions & 4 deletions controllers/ccruntime_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func (r *CcRuntimeReconciler) processCcRuntimeInstallRequest() (ctrl.Result, err

if r.ccRuntime.Spec.CcNodeSelector == nil {
r.ccRuntime.Spec.CcNodeSelector = &metav1.LabelSelector{
MatchLabels: map[string]string{"node-role.kubernetes.io/worker": ""},
MatchLabels: map[string]string{"node.kubernetes.io/worker": ""},
}
}

Expand Down Expand Up @@ -535,7 +535,7 @@ func (r *CcRuntimeReconciler) getAllNodes() (*corev1.NodeList, ctrl.Result, erro

if r.ccRuntime.Spec.CcNodeSelector == nil {
r.ccRuntime.Spec.CcNodeSelector = &metav1.LabelSelector{
MatchLabels: map[string]string{"node-role.kubernetes.io/worker": ""},
MatchLabels: map[string]string{"node.kubernetes.io/worker": ""},
}
}

Expand Down Expand Up @@ -629,7 +629,7 @@ func (r *CcRuntimeReconciler) processDaemonset(operation DaemonOperation) *appsv
nodeSelector = r.ccRuntime.Spec.Config.UninstallDoneLabel
} else {
nodeSelector = map[string]string{
"node-role.kubernetes.io/worker": "",
"node.kubernetes.io/worker": "",
}
}

Expand Down Expand Up @@ -839,7 +839,7 @@ func (r *CcRuntimeReconciler) makeHookDaemonset(operation DaemonOperation) *apps
nodeSelector = r.ccRuntime.Spec.CcNodeSelector.MatchLabels
} else {
nodeSelector = map[string]string{
"node-role.kubernetes.io/worker": "",
"node.kubernetes.io/worker": "",
}
}

Expand Down
4 changes: 2 additions & 2 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
- Only containerd runtime based Kubernetes clusters are supported with the current Confidential Containers (CoCo) release
- The minimum Kubernetes version should be 1.24.
- Ensure KUBECONFIG points to the target Kubernetes cluster.
- Ensure at least one Kubernetes node in the cluster is having the label `node-role.kubernetes.io/worker=`
- Ensure at least one Kubernetes node in the cluster is having the label `node.kubernetes.io/worker=`
```
kubectl label node $NODENAME node-role.kubernetes.io/worker=
kubectl label node $NODENAME node.kubernetes.io/worker=
```

## Deploy the Operator
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/cluster/up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ main() {
# Untaint the node so that pods can be scheduled on it.
for role in master control-plane; do
kubectl taint nodes "$(hostname)" \
"node-role.kubernetes.io/$role:NoSchedule-"
"node.kubernetes.io/$role:NoSchedule-"
done
}

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ install_operator() {
start_local_registry

# The node should be 'worker' labeled
local label="node-role.kubernetes.io/worker"
local label="node.kubernetes.io/worker"
if ! kubectl get node "$(hostname)" -o jsonpath='{.metadata.labels}' \
| grep -q "$label"; then
kubectl label node "$(hostname)" "$label="
Expand Down

0 comments on commit 93323d7

Please sign in to comment.