Repository navigation
Description
Summary
Pre-GA audit of operator/documentdb-helm-chart. The chart works for the current demo/preview use cases, but several gaps will block enterprise adoption (multi-install collisions, Pod Security Admission rejection, broad RBAC, no CRD upgrade story, missing scheduling/security knobs).
This is a tracking issue. Individual fixes can be split into sub-PRs; some items may have better designs than what is suggested here.
Related: #380 (CNPG version compatibility for BYO mode).
Critical (GA blockers)
- C1. Cluster-scoped resources have hardcoded names chart cannot be installed twice in the same cluster.
ClusterRole/documentdb-operator-cluster-role,ClusterRoleBinding/...,ValidatingWebhookConfiguration/documentdb-validating-webhook,Service/documentdb-webhook-service, all three Deployments, and the wal-replica RBAC are all hardcoded. Needs a properdocumentdb-operator.fullnamehelper and consistent use across every cluster-scoped resource.templates/10_documentdb_webhook.yamleven has a comment admitting this. - C2. No CRD upgrade story. CRDs live in
crds/(Helm 3 special dir) installed on first install, never updated byhelm upgrade. Pick a strategy: hook-based install intemplates/, separatedocumentdb-operator-crdschart (Strimzi/CNPG pattern), or documented manualkubectl applystep in release notes. - C3.
Deployment.spec.selector.matchLabels: { app: {{ .Release.Name }} }selectors are immutable; coupling to release name riskshelm upgradefailures. Standardize onapp.kubernetes.io/*labels withselectorLabels/labelshelpers (whathelm createships). - C4. No
resources:requests/limits on operator, sidecar-injector, or wal-replica deployments. LimitRange/ResourceQuota enforcement will reject the install. Expose viavalues.yamlwith sane defaults. - C5. ClusterRole is over-broad.
templates/05_clusterrole.yamlgrants cluster-wide CRUD onsecrets,namespaces,rolebindings,clusterrolebindings,serviceaccounts,configmaps. Several are not justifiable for a DocumentDB operator and will fail security review. Audit each rule against actual controller code. - C6.
wal-replica-managerClusterRole has a literal# TODO trim this down to what's actually neededcomment (templates/03_documentdb_wal_replica.yaml:145). Ships permissions the author already flagged. - C7. CNPG subchart version drift.
Chart.yaml/Chart.lock/ bundledcharts/cloudnative-pg-0.27.0.tgzare pinned to0.27.0, butAGENTS.mdcompatibility matrix declares CNPG1.28.0. Resolve to a single source of truth and add CI to keep them in sync.
Major
- M1. No
templates/NOTES.txtno post-install guidance, verification, or first-step instructions. - M2. No
values.schema.jsonevery value typo becomes a runtime error instead of an install-time validation error. - M3. No
helm templaterendering CI.helm lintis wired up but doesn't catch templates that fail to render under different value combinations (e.g.,walReplica: true, custom namespace, missing values). Add CI that renders +kubectl apply --dry-run=server. - M4. cert-manager is an implicit hard dependency, never declared. Chart unconditionally creates
cert-manager.io/v1resources. If cert-manager isn't installed the chart "succeeds" but the operator never becomes ready. Add a preflight:{{- if not (.Capabilities.APIVersions.Has "cert-manager.io/v1") }}{{- fail "..." }}{{- end }}, and/or make it optional viacertManager.enabled. - M5. No
affinity,nodeSelector,tolerations,topologySpreadConstraints,priorityClassNameexposed. Standard scheduling controls absent. - M6. No
imagePullSecretsair-gapped / private-registry customers can't use the chart. - M7.
pullPolicy: Alwaysfor pinned tags forappVersion-derived tags,IfNotPresentis the convention.Alwaysonly makes sense for floating tags. - M8. Missing
securityContext/podSecurityContext. NorunAsNonRoot,seccompProfile,readOnlyRootFilesystem,allowPrivilegeEscalation: false. Pod Security Admission withrestrictedrejects these pods. Borrow defaults from the upstream CNPG chart's values.yaml. - M9. No
PodDisruptionBudgetfor the operator.replicaCount: 1with no PDB operator stops reconciling during node drains. - M10. Three snowflake webhook/cert mechanisms (operator, sidecar injector, wal-replica) each with its own Issuer/Certificate/Secret/dnsName. Consolidate into a shared template.
- M11. Numbered template filenames (
01_,02_, ...,10_) Kustomize convention, meaningless in Helm. Rename to descriptive names (deployment.yaml,rbac.yaml,webhook.yaml, ...). - M12. Sidecar injector and wal-replica deployments have no probes marked Ready as soon as the container starts. Add readiness/liveness probes that actually verify the gRPC plugin endpoint.
- M13.
creationTimestamp: nullartifacts intemplates/02_documentdb_sidecar_injector.yaml:37andtemplates/03_documentdb_wal_replica.yaml:87leftover fromkubectl get -o yaml. Remove. - M14. Wrong
app.kubernetes.io/managed-by: kustomizelabels intemplates/03_documentdb_wal_replica.yaml. Helm sets this toHelmautomatically; the hardcodedkustomizevalue misleads GitOps tooling and dashboards.
Minor / polish
- N1.
UNIFIED-VERSION-CONTROL.mdin the chart dir is unreferenced. Link from README or move underdocs/. - N2. No chart
README.mdArtifact Hub renders this; without it the listing page is empty. Considerhelm-docs(auto-generates from values.yaml comments). - N3. Missing trailing newlines in
Chart.yaml,templates/01_namespace.yaml,templates/_helpers.tpl.helm lint --strictwould catch. - N4.
_helpers.tplis anemic single helper returning a literal. GA charts usually havename/fullname/chart/labels/selectorLabels/serviceAccountName/namespace. - N5.
namespace:value +.Release.Namespacefallback two ways to set namespace is confusing. Either drop the chart value (let Helm own it via--namespace) or document precedence. - N6.
documentDbVersion(values.yaml) vs. CRD fielddocumentDBVersioncasing mismatch for the same concept across two surfaces. - N7.
walReplicaas top-level boolean. If wal-replica grows config (image/resources/replicas) the API has to be restructured. PreferwalReplica.enabled: falsefrom day one. - N8. RBAC verbs granularity most rules effectively grant
*. Narrow each rule to what controller code actually uses.
Suggested phasing
Pre-GA must-fix: C1, C2, C5, C6, C7, M4, M8 these move the chart from "works in maintainers' demo cluster" to "passes enterprise security review and installs cleanly in customer environments."
Pre-GA strongly recommended: C3, C4, M2, M5, M6, M7, M9, M12, M3.
GA+1 polish: M1, M10, M11, M13, M14, all N items.
Happy to break this into per-area sub-issues if that helps assignment.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(helm): add pod security, resources, and scheduling knobs to chart
chore(helm): remove unambiguously dead ClusterRole grants
chore(helm): trim over-broad ClusterRole permissions
chore(helm): remove unambiguously dead ClusterRole grants
fix(helm): restore pods and endpoints CRUD required by per-CR Role gr…
chore(helm): apply Copilot review suggestions on operator ClusterRole
feat(helm): preflight check for cert-manager presence
feat(helm): add opt-in PDB and probes for CNPG plugin sidecars
feat(helm): add opt-in PDB and probes for CNPG plugin sidecars
WentingWu666666 commentedon Jun 23, 2026
M9 (operator PodDisruptionBudget) — recommend dropping for now
After review, I don't think we should add an operator PDB at this stage, and I've removed it from #384.
Reasoning:
replicaCount: 1. On a single-replica deployment a PDB is either:maxUnavailable: 1/minAvailable: 0), orminAvailable: 1) — it blocks node drains forever, because evicting the only pod always violates the budget. That breaks node maintenance, upgrades, and autoscaler scale-down.Recommendation: defer the operator PDB until we add multi-replica + leader election to the operator. At that point a
maxUnavailable: 1PDB becomes meaningful and should land in that same PR.M12 (plugin readiness probes) is still addressed in #384 — that one has a direct upstream precedent (
plugin-barman-cloudships the sametcpSocketreadiness probe on 9090).WentingWu666666 commentedon Jun 23, 2026
C2 (CRD upgrade story) — satisfied via documented manual apply
The chart intentionally keeps CRDs in the Helm 3
crds/directory and does not automate CRD upgrades. This matches the same pattern used by CloudNative-PG, cert-manager, and Strimzi: CRD lifecycle is handled out-of-band rather than byhelm upgrade.The manual upgrade path is documented in the public docs — operations/upgrades.md, "Step 3: Apply Updated CRDs":
(Server-side apply is required because the DocumentDB CRD is too large for the client-side
last-applied-configurationannotation.)The issue's own acceptance criteria lists "documented manual
kubectl applystep in release notes" as a valid strategy, so C2 is considered satisfied by documentation. The automated route (pre-upgrade Job, #385) was closed deliberately in favor of this manual+documented approach.Marking C2 as done.
WentingWu666666 commentedon Jun 23, 2026
C1 and C3 — deferred (folded into multi-operator support)
Both items only matter once we support multiple operator installs per cluster, which is now tracked as a separate feature issue. Under the current cluster-singleton design they are not GA blockers:
C1 (hardcoded cluster-scoped names) — Intentional for a singleton. Stable, predictable names for cluster-scoped resources (ClusterRole, ValidatingWebhookConfiguration, webhook Service) is the same pattern used by CNPG and cert-manager. Templating these via a
fullnamehelper is a prerequisite of multi-operator support and will be handled there.C3 (
selector.matchLabels: {app: {{ .Release.Name }}}) — Not a correctness issue today:.Release.Name, so the Service always matches its pods regardless of release name — no broken-selector bug.helm upgrade <release>(release name doesn't change), so the immutable-selector constraint is never violated in normal upgrades.app.kubernetes.io/*labels are already present on the Deployment metadata; only the selector uses the bareapp:key.Deferring both C1 and C3 to the multi-operator support issue.