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
eq .Values.service.type "ExternalName" is set, then this takes precedence (for when service is running external to kubernetes). The default in charts/dsv-injector/values.yaml is set to type: ClusterIP. This means unless this is changed, the default behavior will fall through to checking if existing cert found in namespace for this release (aka someone installed their own cert before.
caBundle is not set by default, but could be passed in with the helm install command if desired the caBundle must be a base64 string containing a PEM-encoded certificate chain that validates the certificate per charts/dsv-injector/values.yaml.
Else if existing $tlsSecret that was looked up is found, then it uses this. That doesn't check if it's valid or not, so it will just reuse what's there.
else if no existing cert (meaning fresh install/or expired cert was deleted) then it uses the self signed cert from helm function genSelfSignedCert.
The logic expects caBundle to only be used when designating an external service.
improvement to behavior
The check against {{- else if $tlsSecret }} should check if exists, but also check that the tls secret cert expiration <= in days from recreateSelfSignedCertThreshold.
recreateSelfSignedCertThreshold will default in helm values to 90 days.
webhookCertExpireDays should be exposed in the values.yaml with default of 365, rather than default set in the webhook.yaml so it's more visible
This same check should be on the secret, which creates the cert files separated in: charts/dsv-injector/templates/webhook.yaml. This should be modified to also have the same check for expiration.
should this be gated behind a SelfSignedCertRegeneration to avoid impact to custom provided cert. ANSWER: The logic expects caBundle to only be used when designating an external service. Otherwise genSelfSignedCert is what's used.
we load custom provided cert via config map with DSV_CERT I believe. Validate if this impacts anything here, since it's not exposed as a helm input for this process currently, but expected to be done on app loading. ANSWERED below.
How this Relates to the DSV_CERT and loading in injector
cmd/injector/main.go caused some confusion initially as a container wouldn't have knowledge of "${HOME}". I backtracked this though and recall now why this is set.
…creation
Related to #124
Add expiration check for self-signed certificates in `charts/dsv-injector/templates/webhook.yaml`.
* Add a new variable `recreateSelfSignedCertThreshold` with a default of 90 days.
* Add a check for the expiration of the existing cert in the next n days.
* Update the logic to generate a new self-signed cert if the existing cert is expiring within `recreateSelfSignedCertThreshold` days.
* Update the secret cert value mapping to use the `$tlsCert` value based on it meeting the expiration check requirement.
Expose `webhookCertExpireDays` and `recreateSelfSignedCertThreshold` in `charts/dsv-injector/values.yaml`.
* Expose `webhookCertExpireDays` with a default of 365 days.
* Add `recreateSelfSignedCertThreshold` with a default of 90 days.
---
For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/DelineaXPM/dsv-k8s/issues/124?shareId=XXXX-XXXX-XXXX-XXXX).
current behavior
charts/dsv-injector/templates/webhook.yaml
generates a cert if the user doesn't provide their own.releasename-tls
is found, it defaults to this.So the basics of current behavior
$tlsCert
== self signed cert always generated on run (it's a helm function)$tlsSecret
is a lookup to find the "CurrentReleaseName-tls".The
clientConfig:
value for the webhook:Logic explained:
eq .Values.service.type "ExternalName"
is set, then this takes precedence (for when service is running external to kubernetes). The default incharts/dsv-injector/values.yaml
is set totype: ClusterIP
. This means unless this is changed, the default behavior will fall through to checking if existing cert found in namespace for this release (aka someone installed their own cert before.caBundle
is not set by default, but could be passed in with the helm install command if desiredthe caBundle must be a base64 string containing a PEM-encoded certificate chain that validates the certificate
percharts/dsv-injector/values.yaml
.$tlsSecret
that was looked up is found, then it uses this. That doesn't check if it's valid or not, so it will just reuse what's there.genSelfSignedCert
.caBundle
to only be used when designating an external service.improvement to behavior
{{- else if $tlsSecret }}
should check if exists, but also check that the tls secret cert expiration <= in days fromrecreateSelfSignedCertThreshold
.recreateSelfSignedCertThreshold
will default in helm values to 90 days.webhookCertExpireDays
should be exposed in thevalues.yaml
with default of365
, rather than default set in thewebhook.yaml
so it's more visiblecharts/dsv-injector/templates/webhook.yaml
. This should be modified to also have the same check for expiration.Looking Into
SelfSignedCertRegeneration
to avoid impact to custom provided cert. ANSWER: The logic expectscaBundle
to only be used when designating an external service. OtherwisegenSelfSignedCert
is what's used.DSV_CERT
I believe. Validate if this impacts anything here, since it's not exposed as a helm input for this process currently, but expected to be done on app loading. ANSWERED below.How this Relates to the DSV_CERT and loading in injector
cmd/injector/main.go
caused some confusion initially as a container wouldn't have knowledge of "${HOME}". I backtracked this though and recall now why this is set.nonroot
by convention with them./home/nonroot/credentials
.So yes it was always finding it (else it would error as fatal/termination of Run.
But nothing was checking the expiration of the cert.
related to AB#590946
The text was updated successfully, but these errors were encountered: