Skip to content

Commit

Permalink
autoGenerateCert as object with enabled, ifNotExists properties
Browse files Browse the repository at this point in the history
  • Loading branch information
tomplus committed Oct 31, 2023
1 parent b8aeb9d commit 6dbbb88
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
{{- $caCertEnc := "" }}
{{- $certCrtEnc := "" }}
{{- $certKeyEnc := "" }}
{{- if .Values.admissionWebhooks.autoGenerateCert }}
{{- if .Values.admissionWebhooks.autoGenerateCert.enabled }}
{{- $prevSecret := (lookup "v1" "Secret" .Release.Namespace (default (printf "%s-controller-manager-service-cert" (include "opentelemetry-operator.fullname" .)) .Values.admissionWebhooks.secretName )) }}
{{- $prevHook := (lookup "admissionregistration.k8s.io/v1" "MutatingWebhookConfiguration" .Release.Namespace (print (include "opentelemetry-operator.MutatingWebhookName" . ) "-mutation")) }}
{{- if and .Values.admissionWebhooks.autoGenerateReuseCert $prevSecret $prevHook }}
{{- if and .Values.admissionWebhooks.autoGenerateCert.ifNotExists $prevSecret $prevHook }}
{{- $certCrtEnc = index $prevSecret "data" "tls.crt" }}
{{- $certKeyEnc = index $prevSecret "data" "tls.key" }}
{{- $caCertEnc = (first $prevHook.webhooks).clientConfig.caBundle }}
Expand Down
31 changes: 25 additions & 6 deletions charts/opentelemetry-operator/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1304,12 +1304,31 @@
}]
},
"autoGenerateCert": {
"type": "boolean",
"default": true,
"title": "The autoGenerateCert schema",
"examples": [
true
]
"type": "object",
"default": {},
"title": "The autoGenerateCert Schema",
"required": [
"enabled",
"ifNotExists"
],
"properties": {
"enabled": {
"type": "boolean",
"default": true,
"title": "The enabled Schema",
"examples": [
true
]
},
"ifNotExists": {
"type": "boolean",
"default": true,
"title": "The ifNotExists Schema",
"examples": [
true
]
}
}
},
"secretAnnotations": {
"type": "object",
Expand Down
8 changes: 4 additions & 4 deletions charts/opentelemetry-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ admissionWebhooks:
## TLS Certificate Option 2: Use Helm to automatically generate self-signed certificate.
## certManager must be disabled and autoGenerateCert must be enabled.
## If true and certManager.enabled is false, Helm will automatically create a self-signd cert and secret for you.
autoGenerateCert: true

# Set true to reuse existing cert, autoGenerateCert must be enabled too
autoGenerateCertIfNotExists: true
autoGenerateCert:
enabled: true
# true means generate cert if cert not exists only
ifNotExists: true

## TLS Certificate Option 3: Use your own self-signed certificate.
## certManager and autoGenerateCert must be disabled and cert_file, key_file, and ca_file must be set.
Expand Down

0 comments on commit 6dbbb88

Please sign in to comment.