-
Notifications
You must be signed in to change notification settings - Fork 1
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
[scalardb-cluster] Support cert-manager in ScalarDB Cluster chart #263
Conversation
@@ -0,0 +1,83 @@ | |||
{{- if .Values.scalardbCluster.tls.certManager.enabled }} | |||
{{- if not .Values.scalardbCluster.tls.certManager.issuerRef }} |
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.
If you don't specify Issuer
in the issurRef
configuration, this chart deploys self-signed CA to generate certificates.
If you specify the issuerRef
configuration, this chart doesn't deploy self-signed CA.
issuerRef: | ||
{{- if .Values.scalardbCluster.tls.certManager.issuerRef }} | ||
{{- toYaml .Values.scalardbCluster.tls.certManager.issuerRef | nindent 4 }} | ||
{{- else }} | ||
name: {{ include "scalardb-cluster.fullname" . }}-ca-issuer | ||
{{- 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.
If you specify issuerRef
, this chart uses that configuration in the Certificate
resource. If you don't specify issuerRef
, this chart uses a self-signed CA that is deployed by this chart.
{{- if .Values.scalardbCluster.tls.caRootCertSecret }} | ||
- -tls-ca-cert=/tls/certs/ca-root-cert.pem | ||
{{- end }} | ||
- -tls-ca-cert=/tls/scalardb-cluster/certs/ca.crt |
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.
When you enable TLS, the -tls-ca-cert
option is mandatory. In other words, {{- if .Values.scalardbCluster.tls.caRootCertSecret }}
does not make sense. So, I removed that unnecessary condition.
{{- if .Values.scalardbCluster.tls.enabled }} | ||
- name: scalardb-cluster-tls-volume | ||
mountPath: /tls/scalardb-cluster/certs |
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 combine all private keys and certificates into one volume to remove the subPath
configuration.
{{- if and .Values.scalardbCluster.tls.enabled .Values.scalardbCluster.tls.certManager.enabled }} | ||
- name: scalardb-cluster-tls-volume | ||
secret: | ||
secretName: {{ .Values.scalardbCluster.tls.caRootCertSecret }} | ||
secretName: {{ include "scalardb-cluster.fullname" . }}-tls-cert |
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.
If you use cert-manager, it creates one secret resource that includes all private keys and certificates. So, it's enough to mount that one secret here.
{{- if and (.Values.scalardbCluster.tls.enabled) (not .Values.scalardbCluster.tls.certManager.enabled) }} | ||
- name: scalardb-cluster-tls-volume | ||
projected: | ||
sources: | ||
- secret: | ||
name: {{ .Values.scalardbCluster.tls.caRootCertSecret }} | ||
- secret: | ||
name: {{ .Values.scalardbCluster.tls.certChainSecret }} | ||
- secret: | ||
name: {{ .Values.scalardbCluster.tls.privateKeySecret }} |
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.
If you don't use cert-manager (and you want to manage each file separately), you have to create three secrets for the private key, certificate, and CA certificate.
In this case, I want to combine them into one volume to mount them easily under the same directory in the container. So, I use projected
volume here.
dnsNames: | ||
- localhost |
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 set localhost
as a default value of the dnsNames
. This is because:
- The
grpc_health_probe
command accesses ScalarDB Cluster by specifyinglocalhost
like-addr=localhost:60053
. - The
grpc_health_probe
command verifies the certificate by usingSubject Alternative Name (SAN)
instead ofCommon Name (CN)
of the certificate. In other words, at least one SAN configuration is necessary. (I will update the document in another PR.)
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.
LGTM! 👍
I didn't thoroughly review it, though.
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.
LGTM! Thank you!
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.
LGTM! Thank you!
Description
This PR updates ScalarDB Cluster chart to support cert-manager.
Please take a look!
Related issues and/or PRs
Changes made
Mainly, this PR adds/updates the following features (manifests):
Deploy a
Certificate
resource for cert-manager by usingcharts/scalardb-cluster/templates/scalardb-cluster/certmanager.yaml
.Deploy self-signed CA and create certificate for ScalarDB Cluster if you don't specify any
Issuer
resources inissuerRef
configuration.issuerRef
configuration, the Envoy chart will use self-signed CA that is deployed by this chart to create certificate for Envoy.Update
deployment.spec.template.spec.volumes
anddeployment.spec.template.spec.containers.volumeMounts
to removesubPath
configuration.subPath
to specify the mounted file name, Kubernetes does not apply the changes of the secret resource. So, to take advantage of cert-manager's automatically renew feature, we should not usesubPath
. This is because I removedsubPath
from thevolumeMounts
configuration.Update file names of private key and certificate.
cert.pem
->tls.crt
key.pem
->tls.key
ca.pem
->ca.crt
Checklist
Additional notes (optional)
N/A
Release notes
Support cert-manager in ScalarDB Cluster chart. You can manage private key and certificate for TLS connections by using cert-manager.