feat: add Helm chart scaffolding and core templates - #155
Conversation
✅ Deploy Preview for mcp-lifecycle-operator ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi @Venkatesh1505. 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. |
e41c668 to
54d8880
Compare
|
@aliok Sending it for your review. TIA |
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aliok
left a comment
There was a problem hiding this comment.
Thanks @Venkatesh1505 !
I had a quick look and have some comments. I want to take a 2nd look later, possibly after comments are addressed.
There was a problem hiding this comment.
What would happen if we put the CRD under dist/chart/crds rather then dist/chart/templates?
I understand that keeping it upper level would mean no automatic CRD upgrades with helm install but when one does helm uninstall, CRD and thus all the instances are kept.
If we put it under templates, we would have automatic CRD upgrade but introduce this deletion risk.
I don't have that much Helm experience TBH.
There was a problem hiding this comment.
cc @ibm-adarsh @Cali0707 @matzew @koksay (Helm expert)?
There was a problem hiding this comment.
Helm does not automatically update CRDs during a helm update when they live in the crds directory.
If you expect frequent CRD updates, I suggest moving them to a separate chart. Otherwise, for a couple of updates a year, you can include in the upgrade doc that users update them manually.
There was a problem hiding this comment.
There was a problem hiding this comment.
IMO we should move the CRDs to a separate chart then. Thoughts @aliok ?
There was a problem hiding this comment.
We're gonna have frequent updates, as the project is new. So, let's do a separate chart for that.
There was a problem hiding this comment.
Done in f13ce27 — moved the CRD to a separate dist/chart-crds/ chart (mcp-lifecycle-operator-crds).
The CRD is now a regular template in the new chart, so helm upgrade will update it automatically. The main chart's crds/ directory has been removed, and NOTES.txt updated to mention installing the CRD chart first.
Tested on a kind cluster:
helm install mcp-lifecycle-operator-crds dist/chart-crds/— CRD createdhelm upgrade mcp-lifecycle-operator-crds dist/chart-crds/— CRD updated (revision 2)helm install mcp-lifecycle-operator dist/chart/— pod 1/1 Running, all RBAC resources createdhelm uninstall— both charts cleaned up
|
/ok-to-test |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Venkatesh1505 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 |
creydr
left a comment
There was a problem hiding this comment.
Left two comments.
But I am also wondering if there is a way to keep the chart manifests in sync with what we have actually in config/, so dist would only be the result of some kustomize patches for example 🤔
There was a problem hiding this comment.
This file seems to be out of sync with the CRD in config/crd/bases/mcp.x-k8s.io_mcpservers.yaml.
It seems to miss
- extraAnnotations field
- extraLabels field
- mcp section under spec
Can we make sure those are updated as part of make manifests too?
There was a problem hiding this comment.
FWIW: in #207 we added a Makefile target which checks if the generated files & manifests are up-to-date. This also runs then in a workflow.
There was a problem hiding this comment.
In #204, we added get and list permissions on pods. This seems to be missing here
Add initial Helm chart under dist/chart/ with core templates that produce the same resources as the kustomize deployment: - Chart.yaml, values.yaml, .helmignore - CRD (crds/mcp.x-k8s.io_mcpservers.yaml) - ServiceAccount (conditional via serviceAccount.create) - RBAC: manager ClusterRole/Binding, leader-election Role/Binding, metrics-auth ClusterRole/Binding, metrics-reader ClusterRole (conditional via rbac.create) - Controller manager Deployment with configurable image, resources, nodeSelector, tolerations, affinity, podAnnotations, podLabels - Metrics Service (port 8443) - NOTES.txt with post-install instructions - _helpers.tpl with standard naming/labeling helpers Part of kubernetes-sigs#132 Signed-off-by: Venkatesh1505 <venkyravi97@gmail.com>
Signed-off-by: Ali Ok <aliok@redhat.com>
Signed-off-by: Ali Ok <aliok@redhat.com>
Signed-off-by: Ali Ok <aliok@redhat.com>
Signed-off-by: Ali Ok <aliok@redhat.com>
Signed-off-by: Ali Ok <aliok@redhat.com>
Signed-off-by: Ali Ok <aliok@redhat.com>
Signed-off-by: Ali Ok <aliok@redhat.com>
Signed-off-by: Ali Ok <aliok@redhat.com>
f13ce27 to
a7ee27e
Compare
|
@creydr can you take a new look? |
Looks good from my side (but I can't LGTM because I am not in the org) |
| {{- include "mcp-lifecycle-operator.labels" . | nindent 4 }} | ||
| spec: | ||
| ports: | ||
| - name: metrics |
There was a problem hiding this comment.
The Helm chart has name: metrics, while the kustomize file has name: https ( see line 15), and the ServiceMonitor explicitly expects port: https (line 17, with a comment reinforcing it). A Helm-deployed instance would breakPrometheus scraping if someone applies the existing ServiceMonitor config.
ArangoGutierrez
left a comment
There was a problem hiding this comment.
This has clearly been through solid iteration already — the separate CRDs chart, digest-aware image helper, aggregation roles, and healthProbe wiring all landed well, and the manager ClusterRole now matches config/rbac/role.yaml.
One parity gap that I think is a blocker given the PR's stated goal of matching the kustomize output: the default resources diverge from config/manager/manager.yaml (inline). Two smaller suggestions inline as well.
Not re-raising the CRD-sync and metrics port-name topics — those threads already have owners.
| resources: | ||
| limits: | ||
| cpu: 500m | ||
| memory: 128Mi |
There was a problem hiding this comment.
This diverges from config/manager/manager.yaml, which sets limits.memory: 512Mi and requests.memory: 128Mi. Since the chart's contract is "same resources as the kustomize deployment with default values", these should match — and 128Mi is a tight ceiling for a controller running cluster-wide informers on configmaps, secrets, and pods; large clusters will OOM the manager.
|
|
||
| metrics: | ||
| # -- Metrics bind address | ||
| bindAddress: ":8443" |
There was a problem hiding this comment.
Follow-up to the earlier probe-alignment thread: metrics.bindAddress/metrics.service.port and healthProbe.bindAddress/healthProbe.port are two values encoding one fact each. A user overriding the bind address but not the port (or vice versa) silently breaks the Service or the probes. Suggest keeping only the port values and rendering the args as --metrics-bind-address=:{{ .Values.metrics.service.port }} / --health-probe-bind-address=:{{ .Values.healthProbe.port }} — one knob, nothing to keep in sync.
| NOTE: This chart requires the mcp-lifecycle-operator-crds chart to be installed first. | ||
| If you haven't already, install it with: | ||
|
|
||
| helm install mcp-lifecycle-operator-crds dist/chart-crds/ |
There was a problem hiding this comment.
nit: helm install mcp-lifecycle-operator-crds dist/chart-crds/ only works from a repo checkout. Once the charts are published, this path is wrong — worth phrasing it in terms of the chart name (with the repo/OCI ref once one exists) or noting it's a from-source instruction.
ArangoGutierrez
left a comment
There was a problem hiding this comment.
Nice iteration — the RBAC is now byte-for-byte identical to config/default (manager role plus the admin/edit/view aggregation roles), the CRD chart matches config/crd/bases exactly, the digest-aware image helper works, and the container security context is fully hardened. Two things still block a clean approval. First, the default resources: they match this branch's config, but main has since moved to 512Mi/128Mi, so please rebase and bump the chart to keep the "same as kustomize" contract (128Mi is also a tight limit for cluster-wide informers). Second, metrics/health each expose one port through two values, and a partial override renders the Service and probes on a port the manager never binds — I reproduced a probe crash-loop via helm template — so please collapse each to a single knob and derive the flags. The "metrics" vs "https" port-name thread and the CRD/manifest sync automation (#134) already have owners; worth closing them out. Could you rebase on main, fix the resources and the port-DRY footgun, and re-request review?
| resources: | ||
| limits: | ||
| cpu: 500m | ||
| memory: 128Mi |
There was a problem hiding this comment.
Heads up on the resources contract: at this branch's HEAD they match config/manager/manager.yaml (128Mi/64Mi), but main has since bumped to limits.memory 512Mi / requests.memory 128Mi. After a rebase the chart will diverge again, and 128Mi is a tight ceiling for cluster-wide informers. Suggest rebasing on main and setting limits.memory: 512Mi / requests.memory: 128Mi.
|
|
||
| metrics: | ||
| # -- Metrics bind address | ||
| bindAddress: ":8443" |
There was a problem hiding this comment.
metrics.bindAddress and metrics.service.port encode the same port twice (same for healthProbe). A partial override breaks silently: setting metrics.service.port=9443 and healthProbe.port=9081 alone renders the Service/containerPort/probes on the new ports while the manager still listens on :8443 / :8081 (verified via helm template), so probes crash-loop the pod. Suggest one port key per fact and deriving the arg, e.g. --metrics-bind-address=:{{ .Values.metrics.service.port }}.
| {{- include "mcp-lifecycle-operator.labels" . | nindent 4 }} | ||
| spec: | ||
| ports: | ||
| - name: metrics |
There was a problem hiding this comment.
Naming this port "metrics" keeps the chart internally consistent, but the kustomize Service uses "https" and config/prometheus/monitor.yaml scrapes port: https. A user who applies that ServiceMonitor against a Helm install gets no scraping. Worth aligning the name (or shipping a chart ServiceMonitor) so both paths agree — this thread already has owners, flagging for closure.
| NOTE: This chart requires the mcp-lifecycle-operator-crds chart to be installed first. | ||
| If you haven't already, install it with: | ||
|
|
||
| helm install mcp-lifecycle-operator-crds dist/chart-crds/ |
There was a problem hiding this comment.
nit: helm install mcp-lifecycle-operator-crds dist/chart-crds/ only works from a repo checkout. Once published this path is wrong — phrase by chart name (with the repo/OCI ref) or mark it as a from-source instruction.
| {{- if .Values.serviceAccount.create }} | ||
| {{- default (printf "%s-controller-manager" (include "mcp-lifecycle-operator.fullname" .)) .Values.serviceAccount.name }} | ||
| {{- else }} | ||
| {{- default "default" .Values.serviceAccount.name }} |
There was a problem hiding this comment.
With serviceAccount.create=false and name unset, the Deployment falls back to the namespace "default" ServiceAccount (verified). That's a quiet least-privilege regression; consider requiring serviceAccount.name when create=false, or documenting it.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Venkatesh1505 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 |
What this PR does
Adds an initial Helm chart under
dist/chart/that produces the same resources as the current kustomize deployment with default values.Closes #132
Resources included
crds/mcp.x-k8s.io_mcpservers.yaml) — copied fromconfig/crd/bases/serviceAccount.createrbac.create)Configurability (values.yaml)
All values are documented with
# --comments. Key options:image.repositorymcp-lifecycle-operatorimage.tag""(uses appVersion)replicas1serviceAccount.createtruerbac.createtruenodeSelector{}tolerations[]affinity{}Validation
helm lint— passeshelm template— all 10 resources render correctlyhelm installon Kind cluster — pod 1/1 Running, controller healthyhelm install --dry-run— passesFollow-ups (separate issues)