Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add regex support for node names or labels #5

Open
m-yosefpor opened this issue Aug 31, 2021 · 0 comments
Open

add regex support for node names or labels #5

m-yosefpor opened this issue Aug 31, 2021 · 0 comments

Comments

@m-yosefpor
Copy link

There is another node label operator by redhat (https://github.com/openshift-kni/node-label-operator) which supports node name patterns (regex) for labeling, however it doesn't support taints. We need to taint and label nodes based on their name, e.g:

node-infra-0
node-infra-1

It would be really nice if we could have a selector with regex match, like a mixture of these operators to have Labeler objects such as:

apiVersion: labeler.barpilot.io/v1alpha1
kind: Labeler
metadata:
  name: spare-prefer-taint
  labels:
    operator: node-labeler-operator
spec:
  nodeNamePatterns:
    - "node-infra-.*"
  nodeSelectorTerms:
  - matchExpressions:
    - key: kubernetes.io/os
      operator: In
      values:
      - "linux"
   merge:
    labels:
      node-role.kubernetes.io/infra: "true"
    taints:
    - effect: NoExecute
      key: node-role.kubernetes.io/infra

Which selects all nodes which match nodeSelectorTerms AND then filters the ones which match one of nodeNamePatterns, and only apply the labels and taints to those.

Another more general method is to have this regex matching for labels, with introducing a new seletor operator such as key: "kubernetes.io/host", operator: "match", values: ["somepattern.*"]

however as it violates the standard of matchExpressions of k8s, I think this latter method is not good, and the first one is more clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant