feat(secret): adopt first-class secret base types for K8S::Core::Secret - #66
Merged
Conversation
Extend K8S::Core::Secret to the first-class secret base types so its value
can be sourced as a formae secret. SecretResolvable now extends
formae.MapSecretResolvable (value property "decodedData"); consumers
reference a key with secret.res.secretValue.at("key"). The new write-only
decodedData field is typed with formae.SecretValue so the agent hashes it at
rest and excludes it from drift detection.
Bump the schema dependency and minFormaeVersion to 0.89.0 and regenerate the
per-version schema trees.
Attach the decoded secret data as a read-only decodedData map on the live
state (Create/Read/Update/Status) so secret.res.secretValue.at("key")
resolves. client-go returns Secret.Data already base64-decoded, and the field
is kept separate from data (which round-trips as base64) to avoid perpetual
drift.
Add a unit test for the decode enrichment and assert it in the Secret CRUD
integration lifecycle. The integration harness gains a KUBE_CONTEXT override so
it can run against any local cluster.
The lgtm-observability examples now source the Grafana Target's basic-auth
password live from the managed lgtm-grafana-admin Secret via
secret.res.secretValue.at("admin-password"), instead of requiring a
GRAFANA_AUTH env var at agent start. lgtm.allResources exposes the admin Secret
as grafanaAdminSecret (only its .res resolvable, so no duplicate resource is
created). Bump the examples' formae schema dependency to 0.89.0 for the
map-secret base types.
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.
What
Adopts the formae first-class secret base types for
K8S::Core::Secret, so a Secret's value can be sourced as a formae secret — resolved live at the plugin-call boundary — instead of only its.namemetadata. A Secret is map-shaped, so its value is referenced by key:Changes
schema/pkl-main/core/Secret.pkl):SecretResolvable extends formae.MapSecretResolvable(value propertydecodedData);Secret extends formae.Secret. A new write-onlydecodedDatafield typed(Mapping<String,String> | formae.SecretValue)marks the value opaque, so the agent hashes it at rest and excludes it from drift detection. Regenerated the per-version schema trees. Bumps the schema dependency andminFormaeVersionto0.89.0.pkg/resources/core/secret.go):Read(and Create/Update/Status live state) attach the base64-decoded payload as a read-onlydecodedDatamap. It is kept separate fromdata— which round-trips as base64 — so decoding never causes perpetual drift. client-go returnsSecret.Dataalready decoded, so no second decode.lgtm-observability/*.pklnow source the Grafana target's admin password from the managedlgtm-grafana-adminSecret viasecret.res.secretValue.at("admin-password"), instead of requiring aGRAFANA_AUTHenv var at agent start.Testing
KUBE_CONTEXToverride..at(), resolved live with noGRAFANA_AUTHin the agent's environment — the Grafana Folder is created, the Secret's decoded value is hashed at rest, and destroy cleans up. Verified live against a kind cluster + Grafana.Requires / notes
>= 0.89.0— the secret base types (formae.MapSecretResolvable,formae.Secret) and the resolution engine live there;minFormaeVersionis bumped accordingly. Merge/publish is gated on the 0.89.0 release.username/passwordsupport (formae-plugin-grafana) is required for the lgtm example's credential sourcing.