Add helm chart#163
Conversation
|
Welcome @honghainguyen777! |
|
Hi @honghainguyen777. 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 Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
✅ Deploy Preview for node-readiness-controller ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
eb0d1d7 to
9035670
Compare
There was a problem hiding this comment.
Thanks for working on this chart. I tested the PR locally from the fetched review-pr-163 branch
Commands/results:
helm lint charts/nrr-controllerpassedhelm template test charts/nrr-controller --namespace node-readiness-systemrendered successfullyhelm template test charts/nrr-controller --namespace node-readiness-system --set webhook.enabled=true --set validatingWebhook.enabled=true --set certManager.enabled=truerendered successfullyhelm package ./charts/nrr-controller --dependency-update --destination /tmp/nrr-chart-packagepassed- Installed into a 3-node kind cluster using the PR’s
make kind-multi-node helm install nrr-test charts/nrr-controller --namespace node-readiness-system --create-namespace --wait --timeout 2msucceeded- Controller pod became Ready, the CRD was installed, and a sample
NodeReadinessRulecreated through chart values reconciled successfully across all 3 kind nodes
I also installed the same Helm unittest plugin version used by the workflow and ran:
helm unittest charts/nrr-controller --strict
That currently fails with 4 failing tests:

so the rendered Deployment contains annotations by default
the plugin reports these as expect ... to be an array. These assertions likely need to use equal or target the parent arrays instead
Cc @ajaysundark
|
Hi @sahitya-chandra, thanks a lot for the detailed testing and feedback! I’d actually love to get more contributors involved with the chart so we can maintain it well going forward, so a follow-up fix from you would be more than welcome :) |
|
/assign @ajaysundark for the final review |
|
/ok-to-test |
|
pushing the unittest fix in a bit |
|
/retest |
|
Oh, I forgot that I don't have permissions to directly push to this branch, pushed to my fork instead, @honghainguyen777 can cherry-pick this f9b0a6a or I can raise a pr once this pr gets merged |
| @@ -0,0 +1 @@ | |||
| ${CONTAINER_ENGINE:-docker} run -it --rm --network host --workdir=/data --volume ~/.kube/config:/root/.kube/config:ro --volume $(pwd):/data quay.io/helmpack/chart-testing:v3.7.0 /bin/bash -c "git config --global --add safe.directory /data; ct install --config=.github/ci/ct.yaml --helm-extra-set-args=\"--set=kind=Deployment\"" | |||
There was a problem hiding this comment.
that Prow failure is because the current file starts directly with:
${CONTAINER_ENGINE:-docker} run ...
It needs a shell header like the repo expects:
#!/usr/bin/env bash
# Copyright The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0
There was a problem hiding this comment.
Ah, I just added it :)
Reference: https://github.com/kubernetes/kubernetes/blob/master/hack/boilerplate/boilerplate.sh.txt
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: honghainguyen777 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@sahitya-chandra I have cherry-picked your commit. Thank you very much! <3 |
|
@sahitya-chandra could you take a second look before @ajaysundark does the final review? |
|
Re-reviewed, No blocking issues from my side, looks good |
|
/lgtm since @sahitya-chandra who is more familiar with the project than me has reviewed it twice |
| @@ -0,0 +1,28 @@ | |||
| {{- if and .Values.webhook.enabled .Values.validatingWebhook.enabled }} | |||
| apiVersion: admissionregistration.k8s.io/v1 | |||
| kind: ValidatingWebhookConfiguration | |||
There was a problem hiding this comment.
When I tried this chart, the webhook service was unreachable by API? Did you get a chance to test with webhook?
There was a problem hiding this comment.
Good catch. The issue was that the ValidatingWebhookConfiguration did not set clientConfig.service.port, so the API server defaulted to 443 while the chart service default was 8443. I was too focused on following the install-full.yaml.
I fixed this by aligning the chart default with upstream Kustomize (443 -> 9443) and explicitly wiring .Values.webhook.service.port into the ValidatingWebhookConfiguration.
|
|
||
| affinity: {} | ||
|
|
||
| # NOTE: Before enabling these rules. The CRD `nodereadinessrules.readiness.node.x-k8s.io` must already be installed in the cluster |
There was a problem hiding this comment.
I think this will have install time race with controller / webhook. how do we ensure cert-manager has issued certificates or webhook is serving?
There was a problem hiding this comment.
Agreed. Creating NodeReadinessRule resources in the same install that enables the validating webhook can race with cert-manager issuing certificates and the webhook becoming ready.
I updated the chart comments/README to call this out. The safer flow is to install the controller/webhook first, wait until it is ready, and then apply nodeReadinessRules in a follow-up helm upgrade.
| enforcementMode: {{ $rule.enforcementMode | quote }} | ||
| nodeSelector: | ||
| {{- toYaml $rule.nodeSelector | nindent 4 }} |
There was a problem hiding this comment.
this is missing some fields like dryrun etc
There was a problem hiding this comment.
Fixed. The template now renders the full rule spec except for name, so fields such as dryRun are preserved instead of being individually enumerated. I added helm-unittest coverage for this.
| taint: | ||
| {{- toYaml $rule.taint | nindent 4 }} | ||
| enforcementMode: {{ $rule.enforcementMode | quote }} | ||
| nodeSelector: |
There was a problem hiding this comment.
what if $rule.nodeSelector was omitted in values?
There was a problem hiding this comment.
Fixed. If nodeSelector is omitted from a rule in values, the template now defaults it to {} so the generated resource satisfies the CRD-required field. I added test coverage for omitted and provided nodeSelector.
| @@ -0,0 +1,18 @@ | |||
| kind: Cluster | |||
There was a problem hiding this comment.
is there a reason why existing config/testing/kind/*.configs cannot be leveraged?
There was a problem hiding this comment.
Good point. I removed the new hack/kind_config.yaml and updated kind-multi-node to reuse the existing config/testing/kind/kind-3node-config.yaml.
| ## TL;DR: | ||
|
|
||
| ```shell | ||
| helm repo add node-readiness-controller https://kubernetes-sigs.github.io/node-readiness-controller/ |
There was a problem hiding this comment.
would this work for helm upgrade? how does future schema changes reach existing installs?
There was a problem hiding this comment.
Documented this in the chart README. Helm installs CRDs from the chart crds/ directory during initial install, but does not upgrade or delete those CRDs during helm upgrade or helm uninstall.
For future schema changes, users need to apply the updated CRD before upgrading to a chart version that depends on it. Moving CRDs into templates/ solves the problem, but the CRD lifecycle becomes more dangerous. Alternatively, we can add a pre-install/pre-upgrade hook Job that runs kubectl apply for CRDs. For this PR I kept Helm’s standard crds/ behavior and documented that schema-changing upgrades require applying the updated CRD first.
| @@ -0,0 +1,17 @@ | |||
| #!/usr/bin/env bash | |||
There was a problem hiding this comment.
Can we also add a hack/verify-chart-drift.sh and wire it into both hack/verify-all.sh and .github/workflows/helm.yaml. It doesnt have to be exhaustive check, maybe a simple diff check to match controller-gen output to chart?
There was a problem hiding this comment.
Added hack/verify-chart-drift.sh and wired it into both hack/verify-all.sh and .github/workflows/helm.yaml. The check runs make manifests and diffs the controller-gen CRD against the chart CRD.
| admissionReviewVersions: | ||
| {{- toYaml .Values.validatingWebhook.admissionReviewVersions | nindent 6 }} | ||
| clientConfig: | ||
| service: |
There was a problem hiding this comment.
@honghainguyen777 Your values.yaml sets this default to 8443, but this service config doesnt have a wiring for 'port' field. This seems why webhook was failing.
Can we fix this and also add tests to include coverage for webhook service?
There was a problem hiding this comment.
Fixed and added the tests
| port: 8443 | ||
| targetPort: 9443 |
There was a problem hiding this comment.
Note: this conflicts with current upstream config/webhook/service.yaml that uses 443 -> 9443. This is why we should have guardrails to maintain configuration consistency between helm and kustomize artifacts.
There was a problem hiding this comment.
Fixed. The chart default now matches upstream config/webhook/service.yaml: 443 -> 9443.
|
New changes are detected. LGTM label has been removed. |
711cd53 to
68e3085
Compare


Description
Add a Helm chart for deploying the node-readiness-controller.
This chart installs the node-readiness-controller along with the required
Kubernetes resources, including:
values.yamlThe chart follows conventions used by existing charts in https://github.com/kubernetes-sigs
(e.g. descheduler) and supports customization via Helm values.
Relationship to #128
This PR overlaps with #128 (
feat: provision helm chart). I missed that existing PR when opening this one. Depending on maintainer preference, this PR can either supersede #128 or be reconciled with it so we land a single Helm chart implementation.Related Issue
None
Type of Change
/kind feature
Testing
The chart was tested locally using Helm:
Verified:
NodeReadinessRuleresources render correctly when defined invalues.yamlhelm templateChecklist
make testpassesmake lintpassesmake lint-chartpassesmake build-helmpassesmake ct-helmpassesDoes this PR introduce a user-facing change?