Skip to content

⚠️ Make helm chart values extensible per component #638

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
merged 7 commits into from
Apr 4, 2025

Conversation

rbjorklin
Copy link
Contributor

@rbjorklin rbjorklin commented Nov 25, 2024

What this PR does / why we need it:
When deploying clusters to AKS using Workload Identity an annotation is required on the service account and a label is required on the pod. By extending the chart to expose the already existing functionality to patch provider manifests this PR allows for setting up AKS clusters using Workload Identity.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 25, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @rbjorklin!

It looks like this is your first PR to kubernetes-sigs/cluster-api-operator 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-operator has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @rbjorklin. 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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 25, 2024
Copy link

netlify bot commented Nov 25, 2024

Deploy Preview for kubernetes-sigs-cluster-api-operator ready!

Name Link
🔨 Latest commit 02019c7
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-operator/deploys/67e1e7ab17301c0008a002e2
😎 Deploy Preview https://deploy-preview-638--kubernetes-sigs-cluster-api-operator.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@furkatgofurov7
Copy link
Member

/ok-to-test

@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 Jan 27, 2025
@furkatgofurov7
Copy link
Member

@rbjorklin hey, would you be able to look into failing CI tests and fix them, so that we can start reviewing it ?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 12, 2025
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 12, 2025
@rbjorklin rbjorklin force-pushed the revamp-chart branch 3 times, most recently from 1691bc3 to d22f12b Compare February 12, 2025 22:38
@rbjorklin
Copy link
Contributor Author

@rbjorklin hey, would you be able to look into failing CI tests and fix them, so that we can start reviewing it ?

Fixed, please take a look!

@rbjorklin
Copy link
Contributor Author

@furkatgofurov7 given that this changes the structure of values.yaml should I introduce a values.schema.json to make consumers of the chart aware of the change when they try rendering it?

@furkatgofurov7
Copy link
Member

@furkatgofurov7 given that this changes the structure of values.yaml should I introduce a values.schema.json to make consumers of the chart aware of the change when they try rendering it?

@rbjorklin good idea, it seems to be useful when using helm lint?

@furkatgofurov7
Copy link
Member

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 7, 2025
@rbjorklin
Copy link
Contributor Author

rbjorklin commented Mar 7, 2025

@furkatgofurov7 I have just pushed a minimal values.schema.json to catch the breaking changes to the values.yaml file introduced in this PR. When trying to template the chart a user will be faced with something like this:

helm template test hack/charts/cluster-api-operator
Error: values don't meet the specifications of the schema(s) in the following chart(s):
cluster-api-operator:
- bootstrap: Invalid type. Expected: array, given: string
- controlPlane: Invalid type. Expected: array, given: string
- infrastructure: Invalid type. Expected: array, given: string
- addon: Invalid type. Expected: array, given: string
- ipam: Invalid type. Expected: array, given: string
- core: Invalid type. Expected: object, given: string

@k8s-ci-robot k8s-ci-robot removed the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Mar 8, 2025
@rbjorklin
Copy link
Contributor Author

@furkatgofurov7 @afarbos reworked and tests are passing. Please take a look! 🙏

This introduces a minimal values.schema.json file to catch the
breaking structural changes made to the values.yaml file in the
related commits to this PR.

This will cause the 'helm template' or 'helm lint' commands
to throw errors and require consumers of the chart to fix
their values.yaml before deploying.
This is required because iterating over a list and a dict does not
necessarily result in the same order of elements.
@rbjorklin
Copy link
Contributor Author

I've addressed the review comment by @afarbos. I'd like to believe that this is in merge:able shape now!

@furkatgofurov7 furkatgofurov7 requested a review from afarbos March 25, 2025 09:06
Comment on lines -4 to -9
core: ""
bootstrap: ""
controlPlane: ""
infrastructure: ""
ipam: ""
addon: ""
Copy link
Member

Choose a reason for hiding this comment

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

So, now options have been updated to use structured objects for providers instead of plain strings. Could it be potentially a breaking change since existing deployments rely on the old string format and need to be updated to the new format?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is, this would be a major upgrade for the helm chart.

Copy link
Contributor Author

@rbjorklin rbjorklin Mar 25, 2025

Choose a reason for hiding this comment

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

Yeah this is a breaking change which is why I have put the ⚠️ symbol on the PR. It is also why I introduced the values.schema.json file as that will catch the breaking change and provide an appropriate warning when users try to render. This is what they will see.

Comment on lines -4 to -9
core: ""
bootstrap: ""
controlPlane: ""
infrastructure: ""
ipam: ""
addon: ""
Copy link
Contributor

Choose a reason for hiding this comment

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

It is, this would be a major upgrade for the helm chart.

{{- range $name, $addon := $.Values.addon }}
{{- $addonNamespace := default ( printf "%s-%s" $name "addon-system" ) (get $addon "namespace") }}
{{- $addonName := $name }}
{{- $addonVersion := get $addon "version" }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{- $addonVersion := get $addon "version" }}
{{- $addonVersion := get $addon "version" }}
{{- $addonEnabled := default (get $addon "enabled") true }}
{{- if not $addonEnabled }}
{{- continue }}
{{- end }}

I would have use enabled, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured rangeing over the the dict was sufficient. If the dict is empty no manifests will be created. I can add the enabled check if you prefer though.

Sidenote: Helm does not actually have a continue keyword.

@salasberryfin salasberryfin moved this from PR to be reviewed to Blocked in CAPI / Turtles Apr 1, 2025
@alexander-demicev alexander-demicev moved this from Blocked to PR to be reviewed in CAPI / Turtles Apr 4, 2025
Copy link
Contributor

@alexander-demicev alexander-demicev left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexander-demicev

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 Apr 4, 2025
Copy link
Member

@furkatgofurov7 furkatgofurov7 left a comment

Choose a reason for hiding this comment

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

Thanks @rbjorklin for patience and pushing this to the finish line.

/retitle ⚠️ Make helm chart values extensible per component
/lgtm

@k8s-ci-robot k8s-ci-robot changed the title ⚠️ ✨ Make helm chart values extensible per component ⚠️ Make helm chart values extensible per component Apr 4, 2025
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 4, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 4d06ee6100c17372717d5b17a680038d8669e43f

@k8s-ci-robot k8s-ci-robot merged commit 215e425 into kubernetes-sigs:main Apr 4, 2025
15 of 16 checks passed
@github-project-automation github-project-automation bot moved this from PR to be reviewed to Done in CAPI / Turtles Apr 4, 2025
@furkatgofurov7
Copy link
Member

furkatgofurov7 commented Apr 25, 2025

@rbjorklin hey, I noticed we forgot to have some docs around this breaking change. Would you be willing to contribute to document it, which would greatly help existing/new users facing challenges with the new values schema.

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. 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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants