-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Fix invalid hubble yaml if cilium_hubble_tls_generate is enabled #10430
Fix invalid hubble yaml if cilium_hubble_tls_generate is enabled #10430
Conversation
|
Welcome @toonalbers! |
Hi @toonalbers. 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 Once the patch is verified, the new status will be reflected by the 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/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @toonalbers
/ok-to-test
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mzaian, toonalbers 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 |
@@ -61,6 +61,7 @@ spec: | |||
name: tls | |||
readOnly: true | |||
{% endif %} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI @toonalbers
Thanks for the fix :-)
It seems an issue about the whitespace-control of jinjia.
It can be solve by the code:
{%- if cilium_hubble_tls_generate %}
- mountPath: /var/lib/hubble-relay/tls
name: tls
readOnly: true
{%- endif %}
There are simplar usage in the kubespray code :-)
we can check the template in the https://j2live.ttl255.com/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @yankay,
Thank you for the review! I agree that adding the minus does result in neater YAML, but the newline is also still required. On https://j2live.ttl255.com/ it works fine without a newline, but in practice (at least with the Ansible version from requirements.txt) the result is malformed YAML.
Minus only:
$ kubectl apply -f /etc/kubernetes/addons/hubble/hubble-deploy.yml --dry-run=server
error: error parsing /etc/kubernetes/addons/hubble/hubble-deploy.yml: error converting YAML to JSON: yaml: line 61: mapping values are not allowed in this context
With the offending line 61:
59 - mountPath: /var/lib/hubble-relay/tls
60 name: tls
61 readOnly: true restartPolicy: Always
62 serviceAccount: hubble-relay
63 serviceAccountName: hubble-relay
Newline only:
59 - mountPath: /var/lib/hubble-relay/tls
60 name: tls
61 readOnly: true
62
63 restartPolicy: Always
64 serviceAccount: hubble-relay
65 serviceAccountName: hubble-relay
Newline and minus:
59 - mountPath: /var/lib/hubble-relay/tls
60 name: tls
61 readOnly: true
62 restartPolicy: Always
63 serviceAccount: hubble-relay
64 serviceAccountName: hubble-relay
I will update the PR to add the minus to the front of the tags.
@@ -97,6 +98,7 @@ spec: | |||
path: server.key | |||
name: tls | |||
{% endif %} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be solved by the {%-
like the code before :-)
f589d4f
to
cf8f373
Compare
Thanks @toonalbers /lgtm |
…abled (#10430) (#10476) Co-authored-by: Toon Albers <[email protected]>
What type of PR is this?
/kind bug
What this PR does / why we need it:
Fix errors in the Hubble template when
cilium_hubble_tls_generate
due to whitespace issues.Which issue(s) this PR fixes:
Fixes #10429
Does this PR introduce a user-facing change?: