patch-operator icon indicating copy to clipboard operation
patch-operator copied to clipboard

Label a node?

Open omlet05 opened this issue 1 year ago • 1 comments

Dear,

We would like to have a way to add label to our openshift node (oc label node, ...), Do you think that this is possible via patch operator?

We tried without success

Regards,

omlet05 avatar Dec 12 '24 08:12 omlet05

This works for me:

apiVersion: redhatcop.redhat.io/v1alpha1
kind: Patch
metadata:
  name: patch-node-1
spec:
  patches:
    node-patch:
      patchTemplate: |
        metadata:
          labels:
            topology.kubernetes.io/region: "region1"
            topology.kubernetes.io/zone: "region1-az2"
      patchType: application/merge-patch+json
      targetObjectRef:
        apiVersion: v1
        kind: Node
        name: node-1
  serviceAccountRef:
    name: patch-node-labels

And the service Account must have a clusterrolebinding to patch nodes.

duritong avatar Jul 16 '25 12:07 duritong