-
Notifications
You must be signed in to change notification settings - Fork 2
Helm keystore feature #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Helm keystore feature #10
Conversation
My current override-polynsi-values.yaml file for reference:
|
chart/values.yaml
Outdated
- "-Djavax.net.ssl.trustStore=/usr/local/etc/polynsi/polynsi-truststore.jks" | ||
- "-Djavax.net.ssl.keyStore=/usr/local/etc/polynsi/polynsi-keystore.jks" | ||
- "-Djavax.net.ssl.trustStore=/usr/local/etc/polynsi/trust/polynsi-truststore.jks" | ||
- "-Djavax.net.ssl.keyStore=/usr/local/etc/polynsi/certs/polynsi-keystore.jks" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks existing uses of the this chart that supply the key and truststore as part of the config configmap that is mounted directly under /usr/local/etc/polynsi/. Is there a specific reason to put the stores in subdirectories?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are challenges mounting multiple files from different secrets into the same directory. Let me revisit and see if I can get something to work.
I was thinking another option would be to dynamically set the path but that can't be done in a values.yaml file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use projected volumes to mount multiple sources (configmaps and secrets) into /usr/local/etc/polynsi/
chart/values.yaml
Outdated
config: | ||
# set to true to prevent helm from overwriting manual changes to configmap | ||
keep: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the Helm documentation, this annotation has a different effect:
The annotation helm.sh/resource-policy: keep instructs Helm to skip deleting this resource when a helm operation (such as helm uninstall, helm upgrade or helm rollback) would result in its deletion. However, this resource becomes orphaned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, that doesn't work as intended. I'll revert that change.
We would like to manage the configmap outside helm after initial install. This will become more important as we update the nl.surf.polynsi.client.certificate.distinguished-names field.
We could do something like
{{- if not (lookup "v1" "ConfigMap" .Release.Namespace "my-configmap") }}
apiVersion: v1
kind: ConfigMap
metadata:
name: my-configmap
data:
key: value
{{- end }}
that will only create the configmap if it doesn't exist. Maybe there's a way to make that if conditional dynamic - i.e., some orgs can use helm to maintain the configmap while others use helm to create it only on install.
How about this?
values.yaml
configmap:
checkExistence: true # Set to false to always create/update
name: "my-configmap"
configmap.yaml
{{- $shouldCreate := true }}
{{- if .Values.configmap.checkExistence }}
{{- $shouldCreate = not (lookup "v1" "ConfigMap" .Release.Namespace .Values.configmap.name) }}
{{- end }}
{{- if $shouldCreate }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.configmap.name }}
data:
key: value
{{- end }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modified the configmap with a checkExistence key. If true
, the helm upgrade pulls the existing values from k8s and sets the configmap to those values. If false
, the helm upgrade overwrites the configmap with values from the helm chart.
213a2b3
to
714a66a
Compare
This enables the use of a keystore provisioned externally or by cert-manager. Uses projected volumes
1a82799
to
2fea666
Compare
b287aaf
to
77e1a5d
Compare
Adds optional keystore to helm chart.
This enables the use of a keystore provisioned externally or by cert-manager.
I moved the file locations so it was easier to mount Secrets without overwriting data in parent directories.
The certificate manifest is not included here but could be. I'm using the generated cert for multiple purposes so it doesn't necessarily make sense to put it in this repo (but I could add it as optional). The cert is used for both PolyNSI and SuPA Ingress as well as the PolyNSI keystore.
I also added a similar feature for a truststore is needed.
Adds feature to keep manual changes to configmap.
If enabled, the configmap resource is not overwritten during a helm upgrade and manual changes are preserved.