Skip to content

fix(kubernetes-managed): omit config block when empty to avoid SSA null - #114

Open
tokio-on-jupiter wants to merge 1 commit into
mainfrom
PLATENG-1222/omit-empty-config-kubernetes-managed
Open

tokio-on-jupiter wants to merge 1 commit into
mainfrom
PLATENG-1222/omit-empty-config-kubernetes-managed

Conversation

@tokio-on-jupiter

@tokio-on-jupiter tokio-on-jupiter commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Problem

jupiterone-int-k8s-managed-{dev,prod-us} ArgoCD apps have been stuck OutOfSync since ~April with:

IntegrationInstance "kubernetes-managed" is invalid: spec.config: Invalid value: "null": spec.config in body must be of type object: "null"

Root cause: the chart renders spec.config: {} when no config values are set. Kubernetes server-side apply serializes that empty map as null, and the CRD's spec.config is a non-nullable object, so the API server rejects it. It only fails when SSA merges {} over an existing non-empty config — which is why #109's switch to {} passed on fresh installs but left long-lived instances broken.

Fix

Omit the config: block entirely when no config values are set, instead of emitting {}. config is optional in the CRD, so an absent config is valid. Changed both the shared chartgen source template and the generated kubernetes-managed chart; bumped the chart to 1.0.9 (required for chart-releaser to publish).

Verification

  • helm template — empty values → no config: key; a set value → config: renders normally
  • helm lint — passes
  • kubectl apply --server-side --dry-run=server of the new (omitted-config) output over a live IntegrationInstancesucceeds (where config: {} fails)
  • Rendered the updated source template standalone to confirm regen output matches (no structural drift)

Notes for reviewers

  • cmd/chartgen/templates/integrationinstance.yaml.tmpl is shared across all 26 collector charts, so the next scheduled generate-charts run will apply the same omit-when-empty change to every chart. Each is a correct fix (same SSA landmine), but heads up that it will produce a fleet-wide regen PR.
  • Pre-existing, out of scope: the source template adds | quote to string config fields but the committed chart renders them unquoted. I left the generated field lines untouched to keep this diff to the actual bug and avoid guessing field types; the next regen will reconcile quoting.

Live mitigation already applied

Both dev and prod-us live IntegrationInstances were json-patched to spec.config: {} so the apps are Synced now. This PR is the durable fix so it doesn't recur.

Ticket: PLATENG-1222

Rendering `config: {}` makes Kubernetes server-side apply serialize the
empty map as `null`, which the non-nullable IntegrationInstance CRD
(spec.config: type object, no nullable) rejects when merging over an
existing non-empty config. This left jupiterone-int-k8s-managed-{dev,
prod-us} stuck OutOfSync/SyncFailed.

Omit the entire config block when no config values are set, instead of
emitting `config: {}`. Verified via `kubectl apply --server-side
--dry-run=server`: an omitted config applies cleanly where `{}` fails.
Completes the incomplete fix from #109 (which switched to `{}`, still
invalid on SSA merge). Applied to both the shared chartgen template and
the generated chart; bumps kubernetes-managed to 1.0.9.

PLATENG-1222

Co-Authored-By: Claude <noreply@anthropic.com>
@tokio-on-jupiter
tokio-on-jupiter requested a review from a team as a code owner July 29, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant