<#7690 fix(secrets): deliver flyte-native secrets ...
# flyte-github
a
#7690 fix(secrets): deliver flyte-native secrets to task pods Pull request opened by pingsutw Why are the changes needed? On flyte-binary v2, secrets created via
flyte create secret
are never delivered to task pods — at every scope (project+domain, domain, org). The task pod's injected env var / secret volume references a Kubernetes
Secret
name and data key that the secret service never creates: • Secret service writes:
Secret
named
md5(EncodeSecretName(org, domain, project, name))
(e.g.
d6a91cc8…
for
u__org__flyte__domain____project____key__repro_secret
), value stored under the full encoded ID as data key. • Pod webhook references (default
SecretManagerTypeK8s
injector, empty group fallback):
Secret
named
md5(bare key)
(e.g.
4d2e40ca…
for
repro_secret
), data key = bare key. Neither the name nor the key match. Because the injected
secretKeyRef
/ volume is
optional: true
, the pod starts with nothing mounted and fails later with an opaque downstream error (missing env var,
DefaultCredentialsError
, …) instead of a clear "secret not found". What changes were proposed in this pull request? • Default the webhook to the embedded secret manager with the K8s fetcher (
flyteplugins/.../secret/config/config.go
). The embedded injector resolves the secret at pod admission using the same encoding as the secret service, including scope fallback (project+domain → domain → org) derived from the task pod's `organization`/`project`/`domain` labels, and rejects the pod with a clear admission error when the secret is genuinely missing. Its default K8s namespace is
flyte
, matching the secret service's
kubernetes.namespace
default. • flyte-binary chart: render
secret.kubernetes.namespace
and
webhook.embeddedSecretManagerConfig.k8sConfig.namespace
as
{{ .Release.Namespace }}
so the writer and reader stay aligned in any install namespace. How was this patch tested? • New test `TestServiceCreatedSecretIsReadableByWebhookFetcher`: for each scope, a Secret written by
CreateSecret
must be found by the
K8sSecretFetcher
via the webhook's scope-fallback lookup IDs — the invariant that, when broken, silently delivers no secrets. • Reproduced and verified end-to-end on an EKS dev cluster: 1.
flyte create secret repro_secret --value …
, then ran a task with
secrets=flyte.Secret(key="repro_secret", as_env_var="REPRO_SECRET")
. 2. Before: pod env referenced
Secret
`4d2e40ca…`/key
repro_secret
(
optional: true
) while the real Secret was
d6a91cc8…
with the encoded-ID key → env var absent, task failed with an application-level error. 3. After deploying this branch's image: the task receives the secret value and succeeds. (verification run below) Labels • fixed: Flyte-native secrets (
flyte create secret
) are now delivered to task pods on flyte-binary v2. flyteorg/flyte