Skip to content

validatingWebhookExemptNamespacesLabels: values are not quoted, "true" is read as bool #4211

@sanderma

Description

@sanderma

What steps did you take and what happened:

I want to exclude namespaces with selectors. One of the selectors has the value "true"
When configuring a value with a boolean, the template fails, as it writes the value without quotes.

Using the following values with the chart:

validatingWebhookExemptNamespacesLabels:
  example.com/exclude:
    - "string"
  example.com/exclude:
    - "true"

Results in:

    namespaceSelector:
      matchExpressions:
        - key: admission.gatekeeper.sh/ignore
          operator: DoesNotExist
        - key: kubernetes.io/metadata.name
          operator: NotIn
          values:
            - gatekeeper
        - key: example.com/exclude
          operator: NotIn
          values:
            - true
        - key: example.com/exclude
          operator: NotIn
          values:
            - string

What did you expect to happen:

I expected the values to be a list of strings.

    namespaceSelector:
      matchExpressions:
        - key: admission.gatekeeper.sh/ignore
          operator: DoesNotExist
        - key: kubernetes.io/metadata.name
          operator: NotIn
          values:
            - gatekeeper
        - key: example.com/exclude
          operator: NotIn
          values:
            - "true"
        - key: example.com/exclude
          operator: NotIn
          values:
            - "string"

Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]

By quoting the value in the template, the issue seems to be resolved.

Environment:

  • Gatekeeper version:
  • Kubernetes version: (use kubectl version):

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions