Skip to content

Fix indentation issue in Cilium values file and ensure booleans are lowercase #12280

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

Merged

Conversation

spantaleev
Copy link
Contributor

@spantaleev spantaleev commented Jun 4, 2025

This patch fixes the indentation in the encryption section. Previously configuration like this:

cilium_encryption_enabled: true
cilium_encryption_type: wireguard

Would template to a values.yaml file with indentation that looks like this:

encryption:
  enabled: True
    type: wireguard
    nodeEncryption: False

instead of this:

encryption:
  enabled: true
  type: wireguard
  nodeEncryption: false

This syntax issue causes an error during Cilium installation.

This patch also makes all boolean values in this template file to go through the to_json filter. Since values like True and False are not compliant with the YAML v1.2 spec, avoiding them is preferable.

to_json may be used for all other values in this template to ensure we end up with a valid YAML document in all cases (even when various strings include special characters), but this was left for another future patch.

What type of PR is this?
/kind bug

What this PR does / why we need it:

#12101 (part of Kubespray v2.28.0) completely reworked the Cilium installation method, so people who were enabling encryption for Cilium (via cilium_encryption_enabled: true ..) would encounter errors during the cilium install command executed by the Kubespray playbook.

Which issue(s) this PR fixes:

No open issues about this yet, as far as I see.

Special notes for your reviewer:

None

Does this PR introduce a user-facing change?:

Fix Cilium installation issues (caused by templating syntax errors) when certain non-default features (encryption, etc.) are enabled

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 4, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 4, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @spantaleev. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@spantaleev spantaleev force-pushed the cilium-values-fixes branch from dbd3a3b to 4157595 Compare June 4, 2025 12:08
Copy link
Contributor

@cyclinder cyclinder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks!

/lgtm

/cc @tico88612

@k8s-ci-robot k8s-ci-robot requested a review from tico88612 June 5, 2025 01:50
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 5, 2025
@tico88612
Copy link
Member

Duplicate with #12244

@tico88612
Copy link
Member

/ok-to-test

But I like this part of the change better.

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 5, 2025
Copy link
Member

@tico88612 tico88612 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments.

…owercase

This patch fixes the indentation in the `encryption` section.
Previously configuration like this:

```yml
cilium_encryption_enabled: true
cilium_encryption_type: wireguard
```

Would template to a `values.yaml` file with indentation that looks like this:

```yml
encryption:
  enabled: True
    type: wireguard
    nodeEncryption: False
```

instead of this:

```yml
encryption:
  enabled: true
  type: wireguard
  nodeEncryption: false
```

This syntax issue causes an error during Cilium installation.

This patch also makes all boolean values in this template file go through the `to_json` filter.
Since values like `True` and `False` are not compliant with the YAML v1.2 spec,
avoiding them is preferable.

`to_json` may be used for all other values in this template to ensure we end up with
a valid YAML document in all cases (even when various strings include special characters),
but this was left for another (future) patch.
@spantaleev spantaleev force-pushed the cilium-values-fixes branch from 4157595 to b10de2f Compare June 5, 2025 06:26
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 5, 2025
@spantaleev
Copy link
Contributor Author

#12244 only (potentially) fixes stuff around the encryption section.

All the other ifs in this file (now and in the future) would not be fixed by it.

It seems like using #jinja2: trim_blocks: True, lstrip_blocks: True is a better approach long-term, which has also been used elsewhere in the Kubespray playbook (e.g. roles/kubernetes-apps/metallb/templates/pools.yaml.j2, roles/kubernetes-apps/metallb/templates/layer3.yaml.j2 and roles/kubernetes-apps/metallb/templates/layer2.yaml.j2).


With the other if sections (hopefully) all aligned properly now, this PR should be in much better shape than the other one.

@tico88612
Copy link
Member

tico88612 commented Jun 5, 2025

Please edit the release note, this is a patch for the Cilium installation.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jun 5, 2025
@spantaleev
Copy link
Contributor Author

I've updated the Does this PR introduce a user-facing change?: value in the PR description above.

Copy link
Member

@tico88612 tico88612 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cyclinder, spantaleev, tico88612

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 5, 2025
@tico88612
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 5, 2025
@tico88612
Copy link
Member

/cherry-pick release-2.28

@k8s-infra-cherrypick-robot

@tico88612: once the present PR merges, I will cherry-pick it on top of release-2.28 in a new PR and assign it to you.

In response to this:

/cherry-pick release-2.28

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot merged commit d1bd610 into kubernetes-sigs:master Jun 5, 2025
45 checks passed
@k8s-infra-cherrypick-robot

@tico88612: new pull request created: #12283

In response to this:

/cherry-pick release-2.28

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@tico88612
Copy link
Member

/cherry-pick release-2.28

@k8s-infra-cherrypick-robot

@tico88612: new pull request could not be created: failed to create pull request against kubernetes-sigs/kubespray#release-2.28 from head k8s-infra-cherrypick-robot:cherry-pick-12280-to-release-2.28: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for k8s-infra-cherrypick-robot:cherry-pick-12280-to-release-2.28."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"}

In response to this:

/cherry-pick release-2.28

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants