You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because core-secret.yaml contains more than just environment variables (things like secret, secretKey, tls.key, tls.crt), but envFrom is pointing to this Secret, these extra values are also injected as environment variables.
explicitly load the additional environment variables (CONFIG_OVERWRITE_JSON, POSTGRESQL_PASSWORD, REGISTRY_CREDENTIAL_PASSWORD, CRSF_KEY) that core-dpl might need by adjusting the code here. It's probably a good time to check which ones are actually used by core-dpl and skipping the unnecessary ones (if any). The current core-secret.yaml template also renders {{- template "harbor.traceJaegerPassword" . }} (which potentially defines TRACE_JAEGER_PASSWORD), so this one shouldn't be forgotten as well.
stop mass-loading environment variables from a secret via envFrom
An even better solution may be to stop mixing so many things in that single harbor-core secret.
In my deployment, I'm making extensive use of various existingSecret* variables and splitting my secrets based on what they pertain to:
a core-main Secret (pointed to by core.existingSecret), containing a secret field
a core-tls Secret (pointed to by core.secretName - which is confusingly named, btw), containing tls.key and tls.crt fields
a core-xsrf Secret (pointed to by core.existingXsrfSecretKey), containing a CSRF_KEY field
a main Secret (pointed to by existingSecretSecretKey), containing a secretKey field
a main-admin-password Secret (pointed to by existingSecretAdminPassword), containing a HARBOR_ADMIN_PASSWORD field
.. which makes it much easier to reason about. Incidentally, it also helps me avoid this issue.
The text was updated successfully, but these errors were encountered:
Thanks for exploring harbor-helm and reaching out to us ! I could get the point that you intently to make our template more clean and neat.However I would give a a few history and explanation here why we templates looks like so... given the env core.secret and core.secretKey the as an example.
i. both the core.secret and core.secretKey would be stored in a secret, either be the harbor-core-secret or existing secret. However core.secretshould be mounted as an ENV, andcore.secretKeyshould be mounted as a file inside the container, So both of these are needs to be specified in theharbor-core`
eg. mount as an ENV
ii. We support both clear text secret things in values.yaml at the every beginning at the harbor-helm , and then add support for existingSecret for each of them. So for the better backwards compatibility we support both in our current template
The
core-secret.yaml
resource (typically namedharbor-core
) contains various secrets:HARBOR_ADMIN_PASSWORD
,CONFIG_OVERWRITE_JSON
, etc)secret
,secretKey
,tls.key
,tls.crt
, etc)The
core-dpl.yaml
resource blindly loads all fields of theharbor-core
ConfigMap and Secret as environment variables, like this:harbor-helm/templates/core/core-dpl.yaml
Lines 93 to 97 in ebbf6bb
Individual environment variables (among which
HARBOR_ADMIN_PASSWORD
) are also loaded like this:harbor-helm/templates/core/core-dpl.yaml
Lines 98 to 119 in ebbf6bb
Because
core-secret.yaml
contains more than just environment variables (things likesecret
,secretKey
,tls.key
,tls.crt
), butenvFrom
is pointing to this Secret, these extra values are also injected as environment variables.This could be verified by doing something like:
A potential solution might be to:
explicitly load the additional environment variables (
CONFIG_OVERWRITE_JSON
,POSTGRESQL_PASSWORD
,REGISTRY_CREDENTIAL_PASSWORD
,CRSF_KEY
) thatcore-dpl
might need by adjusting the code here. It's probably a good time to check which ones are actually used bycore-dpl
and skipping the unnecessary ones (if any). The currentcore-secret.yaml
template also renders{{- template "harbor.traceJaegerPassword" . }}
(which potentially definesTRACE_JAEGER_PASSWORD
), so this one shouldn't be forgotten as well.stop mass-loading environment variables from a secret via
envFrom
An even better solution may be to stop mixing so many things in that single
harbor-core
secret.In my deployment, I'm making extensive use of various
existingSecret*
variables and splitting my secrets based on what they pertain to:core-main
Secret (pointed to bycore.existingSecret
), containing asecret
fieldcore-tls
Secret (pointed to bycore.secretName
- which is confusingly named, btw), containingtls.key
andtls.crt
fieldscore-xsrf
Secret (pointed to bycore.existingXsrfSecretKey
), containing aCSRF_KEY
fieldmain
Secret (pointed to byexistingSecretSecretKey
), containing asecretKey
fieldmain-admin-password
Secret (pointed to byexistingSecretAdminPassword
), containing aHARBOR_ADMIN_PASSWORD
field.. which makes it much easier to reason about. Incidentally, it also helps me avoid this issue.
The text was updated successfully, but these errors were encountered: