-
Notifications
You must be signed in to change notification settings - Fork 54
Add helm chart #163
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
Open
honghainguyen777
wants to merge
17
commits into
kubernetes-sigs:main
Choose a base branch
from
honghainguyen777:add-helm-chart
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add helm chart #163
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
24d87f5
Add nrr-controller Helm chart
honghainguyen777 a18bbfb
Update README.md & remove temp files
honghainguyen777 78d2eec
Add test config
honghainguyen777 eaead3b
Add missing eof
honghainguyen777 7a909c7
Fix wrong helm branch - github workflows
honghainguyen777 91cd057
Update crds & rbac & tolerations for image v0.3.0
honghainguyen777 03252a6
Fix Helm chart unit test assertions
sahitya-chandra 5b86372
Align pod annotation assertions with defaults
honghainguyen777 11699bf
Add boilerplate header to verify-chart.sh
honghainguyen777 2f0d613
Fix wire validating webhook service port
honghainguyen777 90557d2
Render full NodeReadinessRule specs
honghainguyen777 f27dd4d
Add CRD drift verification
honghainguyen777 b9e97e6
Reuse existing kind multi-node config
honghainguyen777 78cbb14
Add dryRun to rule example
honghainguyen777 9667275
Sync chart CRD with generated output
honghainguyen777 296ea33
Set leaderElection enabled by default
honghainguyen777 38feff0
Remove extra arg - helm test
honghainguyen777 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| chart-dirs: | ||
| - charts | ||
| helm-extra-args: "--timeout=5m" | ||
| check-version-increment: false | ||
| target-branch: main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| name: Helm | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - release-* | ||
| paths: | ||
| - 'api/**' | ||
| - 'charts/**' | ||
| - 'config/crd/**' | ||
| - '.github/workflows/helm.yaml' | ||
| - '.github/ci/ct.yaml' | ||
| - 'hack/verify-chart-drift.sh' | ||
| - 'Makefile' | ||
| pull_request: | ||
| paths: | ||
| - 'api/**' | ||
| - 'charts/**' | ||
| - 'config/crd/**' | ||
| - '.github/workflows/helm.yaml' | ||
| - '.github/ci/ct.yaml' | ||
| - 'hack/verify-chart-drift.sh' | ||
| - 'Makefile' | ||
|
|
||
| jobs: | ||
| lint-and-test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Helm | ||
| uses: azure/setup-helm@v4.2.0 | ||
| with: | ||
| version: v3.15.1 | ||
|
|
||
| - uses: actions/setup-python@v5.1.1 | ||
| with: | ||
| python-version: 3.12 | ||
|
|
||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
|
|
||
| - name: Run chart drift check | ||
| run: | | ||
| hack/verify-chart-drift.sh | ||
|
|
||
| - name: Set up chart-testing | ||
| uses: helm/chart-testing-action@v2.8.0 | ||
| with: | ||
| version: v3.11.0 | ||
|
|
||
| - name: Install Helm Unit Test Plugin | ||
| run: | | ||
| helm plugin install --version 1.0.3 https://github.com/helm-unittest/helm-unittest | ||
|
|
||
| - name: Run Helm Unit Tests | ||
| run: | | ||
| helm unittest charts/nrr-controller --strict -d | ||
|
|
||
| - name: Run chart-testing (list-changed) | ||
| id: list-changed | ||
| run: | | ||
| changed=$(ct list-changed --config=.github/ci/ct.yaml) | ||
| if [[ -n "$changed" ]]; then | ||
| echo "changed=true" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Run chart-testing (lint) | ||
| run: ct lint --config=.github/ci/ct.yaml --validate-maintainers=false | ||
|
|
||
| # Need a multi node cluster so controller can run with leadership | ||
| - name: Create multi node Kind cluster | ||
| run: make kind-multi-node | ||
|
|
||
| - name: Run chart-testing (install) | ||
| run: ct install --config=.github/ci/ct.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Patterns to ignore when building packages. | ||
| # This supports shell glob matching, relative path matching, and | ||
| # negation (prefixed with !). Only one pattern per line. | ||
| .DS_Store | ||
| # Common VCS dirs | ||
| .git/ | ||
| .gitignore | ||
| .bzr/ | ||
| .bzrignore | ||
| .hg/ | ||
| .hgignore | ||
| .svn/ | ||
| # Common backup files | ||
| *.swp | ||
| *.bak | ||
| *.tmp | ||
| *~ | ||
| # Various IDEs | ||
| .project | ||
| .idea/ | ||
| *.tmproj | ||
| .vscode/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| apiVersion: v2 | ||
| name: nrr-controller | ||
| description: A Helm chart for the Node Readiness Controller | ||
| type: application | ||
| version: 0.1.0 | ||
| appVersion: "v0.3.0" | ||
| kubeVersion: ">=1.25.0-0" | ||
| home: https://github.com/kubernetes-sigs/node-readiness-controller | ||
| sources: | ||
| - https://github.com/kubernetes-sigs/node-readiness-controller | ||
| keywords: | ||
| - kubernetes | ||
| - controller | ||
| - readiness | ||
| - node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # Node Readiness Controller for Kubernetes | ||
|
|
||
| [Node Readiness Controller](https://github.com/kubernetes-sigs/node-readiness-controller) for Kubernetes a Kubernetes controller that provides fine-grained, declarative readiness for nodes. It ensures nodes only accept workloads when all required components eg: network agents, GPU drivers, storage drivers or custom health-checks, are fully ready on the node. | ||
|
|
||
| ## TL;DR: | ||
|
|
||
| ```shell | ||
| helm repo add node-readiness-controller https://kubernetes-sigs.github.io/node-readiness-controller/ | ||
| helm install my-release --namespace kube-system node-readiness-controller/nrr-controller | ||
| ``` | ||
|
|
||
| ## Introduction | ||
|
|
||
| This chart bootstraps a [node-readiness-controller](https://github.com/kubernetes-sigs/node-readiness-controller) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Kubernetes 1.25+ | ||
|
|
||
| ## Installing the Chart | ||
|
|
||
| To install the chart with the release name `my-release`: | ||
|
|
||
| ```shell | ||
| helm install --namespace kube-system my-release node-readiness-controller/nrr-controller | ||
| ``` | ||
|
|
||
| The command deploys the _node-readiness-controller_ on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. | ||
|
|
||
| > **Tip**: List all releases using `helm list` | ||
|
|
||
| ## CRD Upgrades | ||
|
|
||
| Helm installs CRDs from the chart `crds/` directory during initial install, but Helm does not upgrade or delete CRDs from that directory during `helm upgrade` or `helm uninstall`. Before upgrading to a chart version that changes the `NodeReadinessRule` schema, apply the updated CRD from the release artifacts or from `charts/nrr-controller/crds`. | ||
|
|
||
| ## Uninstalling the Chart | ||
|
|
||
| To uninstall/delete the `my-release` deployment: | ||
|
|
||
| ```shell | ||
| helm delete my-release | ||
| ``` | ||
|
|
||
| The command removes all the Kubernetes components associated with the chart and deletes the release. | ||
|
|
||
| ## Configuration | ||
|
|
||
| The following table lists the configurable parameters of the _node-readiness-controller_ chart and their default values. | ||
|
|
||
| | Parameter | Description | Default | | ||
| | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | | ||
| | `image.repository` | Docker repository to use | `registry.k8s.io/node-readiness-controller/node-readiness-controller` | | ||
| | `image.tag` | Docker tag to use | `v[chart appVersion]` | | ||
| | `image.pullPolicy` | Docker image pull policy | `IfNotPresent` | | ||
| | `imagePullSecrets` | Docker repository secrets | `[]` | | ||
| | `nameOverride` | String to partially override `nrr-controller.fullname` template (will prepend the release name) | `""` | | ||
| | `fullnameOverride` | String to fully override `nrr-controller.fullname` template | `""` | | ||
| | `namespaceOverride` | Override the deployment namespace; defaults to .Release.Namespace | `""` | | ||
| | `replicaCount` | The replica count for Deployment | `1` | | ||
| | `leaderElection.enabled` | Enable leader election to support multiple replicas | `true` | | ||
| | `priorityClassName` | The name of the priority class to add to pods | `system-cluster-critical` | | ||
| | `rbac.create` | If `true`, create & use RBAC resources | `true` | | ||
| | `resources` | Node Readiness Controller container CPU and memory requests/limits | _see values.yaml_ | | ||
| | `serviceAccount.create` | If `true`, create a service account | `true` | | ||
| | `serviceAccount.name` | The name of the service account to use, if not set and create is true a name is generated using the fullname template | `nil` | | ||
| | `serviceAccount.annotations` | Specifies custom annotations for the serviceAccount | `{}` | | ||
| | `podAnnotations` | Annotations to add to the node-readiness-controller Pods | `{"kubectl.kubernetes.io/default-container":"manager"}` | | ||
| | `podLabels` | Labels to add to the node-readiness-controller Pods | `{}` | | ||
| | `commonLabels` | Labels to apply to all resources | `{}` | | ||
| | `podSecurityContext` | Security context for pod | _see values.yaml_ | | ||
| | `securityContext` | Security context for container | _see values.yaml_ | | ||
| | `terminationGracePeriodSeconds` | Time to wait before forcefully terminating the pod | `10` | | ||
| | `healthProbeBindAddress` | The bind address for health probes | `:8081` | | ||
| | `livenessProbe` | Liveness probe configuration for the node-readiness-controller container | _see values.yaml_ | | ||
| | `readinessProbe` | Readiness probe configuration for the node-readiness-controller container | _see values.yaml_ | | ||
| | `metrics.secure` | Enable secure metrics endpoint | `false` | | ||
| | `metrics.bindAddress` | The bind address for metrics server | `:8443` | | ||
| | `metrics.service.port` | The port exposed by the metrics service | `8443` | | ||
| | `metrics.service.targetPort` | The target port for the metrics service | `8443` | | ||
| | `metrics.certDir` | Directory for metrics server certificates | `/tmp/k8s-metrics-server/metrics-certs` | | ||
| | `metrics.certSecretName` | Name of the secret containing metrics server certificates | `metrics-server-cert` | | ||
| | `webhook.enabled` | Enable the webhook server | `false` | | ||
| | `webhook.port` | The port for the webhook server | `9443` | | ||
| | `webhook.service.port` | The port exposed by the webhook service | `443` | | ||
| | `webhook.service.targetPort` | The target port for the webhook service | `9443` | | ||
| | `webhook.certDir` | Directory for webhook server certificates | `/tmp/k8s-webhook-server/serving-certs` | | ||
| | `webhook.certSecretName` | Name of the secret containing webhook server certificates | `webhook-server-certs` | | ||
| | `certManager.enabled` | Enable cert-manager integration for automatic TLS certificate generation | `false` | | ||
| | `certManager.issuer.create` | Create a cert-manager issuer | `true` | | ||
| | `certManager.issuer.name` | Name of the cert-manager issuer | `selfsigned-issuer` | | ||
| | `certManager.metricsCertificate.create` | Create a cert-manager certificate for metrics server | `true` | | ||
| | `certManager.metricsCertificate.name` | Name of the metrics certificate | `metrics-certs` | | ||
| | `certManager.webhookCertificate.create` | Create a cert-manager certificate for webhook server | `true` | | ||
| | `certManager.webhookCertificate.name` | Name of the webhook certificate | `serving-cert` | | ||
| | `validatingWebhook.enabled` | Enable the validating webhook | `false` | | ||
| | `validatingWebhook.name` | Name of the ValidatingWebhookConfiguration resource | `validating-webhook-configuration` | | ||
| | `validatingWebhook.webhookName` | Name of the webhook | `vnodereadinessrule.kb.io` | | ||
| | `validatingWebhook.failurePolicy` | Failure policy for the webhook | `Fail` | | ||
| | `validatingWebhook.sideEffects` | Side effects for the webhook | `None` | | ||
| | `validatingWebhook.path` | The path for the webhook | `/validate-readiness-node-x-k8s-io-v1alpha1-nodereadinessrule` | | ||
| | `validatingWebhook.admissionReviewVersions` | Admission review versions supported by the webhook | `["v1"]` | | ||
| | `nodeSelector` | Node selectors to run the controller on specific nodes | `nil` | | ||
| | `tolerations` | Tolerations to run the controller on specific nodes | `nil` | | ||
| | `affinity` | Node affinity to run the controller on specific nodes | `nil` | | ||
| | `nodeReadinessRules` | Custom NodeReadinessRule resources to create. When validating webhooks are enabled, apply rules after the webhook is ready. | `[]` | | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
would this work for helm upgrade? how does future schema changes reach existing installs?
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.
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 duringhelm upgradeorhelm 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 runskubectl applyfor CRDs. For this PR I kept Helm’s standardcrds/behavior and documented that schema-changing upgrades require applying the updated CRD first.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.
Documenting the upgrade flow with this PR sounds good. We should include it also in the project (mdbook) documentation. If this will be a followup PR, please create an issue / action-item on updating installation instruction so it doesnt get missed.
Could you clarify this bit more on how this is dangerous?