kindcontainer icon indicating copy to clipboard operation
kindcontainer copied to clipboard

[suggestion] Allow to add new labels to the node

Open cmoulliard opened this issue 10 months ago • 3 comments

Suggestion

The kind go project allows to set additonal labels to a node using the type field

// https://github.com/kubernetes-sigs/kind/blob/296749aa2de8577f6865e4db1870d2566a28d14b/pkg/apis/config/v1alpha4/types.go#L108

// Labels are the labels with which the respective node will be labeled
Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`

that a user can define par of the kube config file

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  image: "kindest/node:v1.31.4"
  labels:
    ingress-ready: "true"
  extraPortMappings:
  - containerPort: 443
    hostPort: 8443
    protocol: TCP
...

that the kind go project will render in the template using the field

// https://github.com/kubernetes-sigs/kind/blob/f96632a3c84686f5cf322e1d5f0201b02ca324e9/pkg/cluster/internal/kubeadm/config.go#L243-L248
  kubeletExtraArgs:
    node-ip: "{{ .NodeAddress }}"
    provider-id: "kind://{{.NodeProvider}}/{{.ClusterName}}/{{.NodeName}}"
    node-labels: "{{ .NodeLabels }}"

Such a feature is not supported by this project and is blocking by example the deployment of the ingress controller where a new label has been declared part of the nodeSelector section

// https://github.com/kubernetes/ingress-nginx/blob/main/deploy/static/provider/kind/deploy.yaml#L508
 nodeSelector:
    ingress-ready: "true"
    kubernetes.io/os: linux

cmoulliard avatar Feb 26 '25 16:02 cmoulliard