Skip to content

Node Selector Value not Set in Kubernetes CR #529

@dunnderr

Description

@dunnderr

Describe the bug
The default value for the node selector label in the CR:

is set to an empty string. When following the instructions to install confidential containers on a vanilla kubernetes cluster, there is an expectation that we are meant to wait for runtime pods to appear on all nodes marked with the label selector:

spec:
ccNodeSelector:
matchLabels:
node.kubernetes.io/worker: ""

If someone has labeled the nodes with a satisfying criteria that this is set to true, confidential container pods will not be created an the runtime class will not be created. If however, I edit this value using:

kubectl edit -k github.com/confidential-containers/operator/config/samples/ccruntime/default?ref=v0.14.0

spec:
ccNodeSelector:
matchLabels:
node.kubernetes.io/worker: "true"

:wq

pods are created as expected. There is value in not using a null string for the node labels because it allows people to change the label value from true to false if they want to only install confidential containers on some nodes.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the instructions to install cc here:
    2. Click on '....'
  2. Apply the Custom Resource as shown : kubectl apply -k github.com/confidential-containers/operator/config/samples/ccruntime/default?ref=v0.14.0
  3. Execute the watch to wait for pods. Only the controller pod will be observable in the confidential-containers-system namespace. No obvious errors are displayed at the command line.
  4. Tail the logs of the controller pod and you will see: 2025-06-05T15:31:56Z ERROR Reconciler error {"controller": "ccruntime", "controllerGroup": "confidentialcontainers.org", "controllerKind": "CcRuntime", "CcRuntime": {"name":"ccruntime-sample"}, "namespace": "", "name": "ccruntime-sample", "reconcileID": "3c5d8bdd-da47-42b5-9dc6-2a9423492c58", "error": "no suitable worker nodes found for runtime installation. Please make sure to label the nodes with labels specified in CcNodeSelector"}
  5. If you edit the CR as described above, the installation will continue as expected.

Describe the results you expected
A clear and concise description of what you expected to happen.
If the CR was not able to create successfully, I would have expected a more obvious error at the command line. I think that either the label field should be changed to "true" for the node selector label, or an immediate error should be returned at the command line.
Describe the results you received:
Installation hung and no runtime class was created.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions