Automated cherry pick of #7185: fix unrendered templates#7329
Conversation
after upgrade some of `{{ ca_crt }}` were unrendered in the static-resources configmap
this is because `kubectl -o yaml` wraps long lines:
https://stackoverflow.com/questions/65996363/generating-yaml-output-using-kubectl-result-in-splits-line
Signed-off-by: Nikita Sokolov <faucct@tracto.ai>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical templating issue within the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates several kubectl get configmap commands from outputting YAML to JSON format across various scripts and templates, including a pre-upgrade job, a README example, and e2e test scripts. The change aims to improve the reliability of subsequent sed operations. A review comment highlights a potential issue where the sed command's delimiter (/) could conflict with characters in the karmada_ca variable (a base64 encoded certificate), suggesting the use of an alternative delimiter like # to prevent failures.
| kubectl get configmap {{ $name }}-static-resources -n {{ $namespace }} -o json | sed -e "s/{{ print "{{ ca_crt }}" }}/${karmada_ca}/g" | kubectl apply -f - | ||
| kubectl get configmap {{ $name }}-crds-patches -n {{ $namespace }} -o json | sed -e "s/{{ print "{{ ca_crt }}" }}/${karmada_ca}/g" | kubectl apply -f - |
There was a problem hiding this comment.
The karmada_ca variable contains a base64 encoded certificate, which can include the / character. Using / as the delimiter in the sed command can cause the command to fail if the certificate contains a /. It's safer to use an alternative delimiter, like #, to avoid this issue.
kubectl get configmap {{ $name }}-static-resources -n {{ $namespace }} -o json | sed -e "s#{{ print '{{ ca_crt }}' }}#${karmada_ca}#g" | kubectl apply -f -
kubectl get configmap {{ $name }}-crds-patches -n {{ $namespace }} -o json | sed -e "s#{{ print '{{ ca_crt }}' }}#${karmada_ca}#g" | kubectl apply -f -|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-1.15 #7329 +/- ##
=============================================
Coverage 46.24% 46.24%
=============================================
Files 688 688
Lines 46656 46656
=============================================
+ Hits 21574 21576 +2
+ Misses 23477 23476 -1
+ Partials 1605 1604 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: XiShanYongYe-Chang, zhzhuang-zju The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Cherry pick of #7185 on release-1.15.
#7185: fix unrendered templates, Part of #7292
For details on the cherry pick process, see the cherry pick requests page.