fix(kubernetes-managed): omit config block when empty to avoid SSA null - #114
Open
tokio-on-jupiter wants to merge 1 commit into
Open
tokio-on-jupiter wants to merge 1 commit into
tokio-on-jupiter wants to merge 1 commit into
Conversation
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>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
jupiterone-int-k8s-managed-{dev,prod-us}ArgoCD apps have been stuck OutOfSync since ~April with:Root cause: the chart renders
spec.config: {}when no config values are set. Kubernetes server-side apply serializes that empty map asnull, and the CRD'sspec.configis a non-nullableobject, 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{}.configis optional in the CRD, so an absent config is valid. Changed both the shared chartgen source template and the generatedkubernetes-managedchart; bumped the chart to1.0.9(required for chart-releaser to publish).Verification
helm template— empty values → noconfig:key; a set value →config:renders normallyhelm lint— passeskubectl apply --server-side --dry-run=serverof the new (omitted-config) output over a liveIntegrationInstance→ succeeds (whereconfig: {}fails)Notes for reviewers
cmd/chartgen/templates/integrationinstance.yaml.tmplis shared across all 26 collector charts, so the next scheduledgenerate-chartsrun 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.| quoteto 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 tospec.config: {}so the apps are Synced now. This PR is the durable fix so it doesn't recur.Ticket: PLATENG-1222