Merge pull request #3077 from web-engineer/feat/helm-tls-letsencrypt-support
feat(helm): add TLS/HTTPS support with cert-manager integration
This commit is contained in:
6 files changed
+151
-12
No files matched your search
@@ -26,6 +26,7 @@ Edit `values.yaml` to update:
|
|||||||
- Old: `persistence.redisSize` → New: `persistence.redis.size`
|
- Old: `persistence.redisSize` → New: `persistence.redis.size`
|
||||||
- Add: `persistence.mongo.storageClass` and `persistence.redis.storageClass` (leave empty for default)
|
- Add: `persistence.mongo.storageClass` and `persistence.redis.storageClass` (leave empty for default)
|
||||||
- Secrets under the `secrets` section (`JWT_SECRET`, email credentials, API keys, etc.) — replace all change_me values
|
- Secrets under the `secrets` section (`JWT_SECRET`, email credentials, API keys, etc.) — replace all change_me values
|
||||||
|
- **For TLS/HTTPS**: Configure ingress TLS settings (see section below)
|
||||||
|
|
||||||
### 3. Deploy the Helm chart
|
### 3. Deploy the Helm chart
|
||||||
```bash
|
```bash
|
||||||
@@ -41,3 +42,75 @@ kubectl get svc
|
|||||||
```
|
```
|
||||||
|
|
||||||
Once all pods are `Running` and `Ready`, you can access Checkmate via the configured ingress hosts.
|
Once all pods are `Running` and `Ready`, you can access Checkmate via the configured ingress hosts.
|
||||||
|
|
||||||
|
## Enabling TLS/HTTPS with cert-manager
|
||||||
|
|
||||||
|
If you have [cert-manager](https://cert-manager.io/) installed in your cluster, you can enable automatic TLS certificate provisioning using Let's Encrypt or other certificate issuers.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
- cert-manager installed in your cluster
|
||||||
|
- A ClusterIssuer or Issuer configured (e.g., `letsencrypt-prod`)
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
Edit `values.yaml` to enable TLS (and update protocols to https):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
client:
|
||||||
|
protocol: https
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
host: checkmate.example.com
|
||||||
|
className: nginx
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
|
tls:
|
||||||
|
enabled: true
|
||||||
|
secretName: checkmate-client-tls
|
||||||
|
|
||||||
|
server:
|
||||||
|
protocol: https
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
host: checkmate.example.com
|
||||||
|
className: nginx
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
|
tls:
|
||||||
|
enabled: true
|
||||||
|
secretName: checkmate-server-tls
|
||||||
|
```
|
||||||
|
|
||||||
|
### Alternative: Using --set flags
|
||||||
|
|
||||||
|
You can also enable TLS during installation using Helm's `--set` flags:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
helm install checkmate ./charts/helm/checkmate \
|
||||||
|
--set client.protocol=https \
|
||||||
|
--set server.protocol=https \
|
||||||
|
--set client.ingress.annotations."cert-manager\.io/cluster-issuer"="letsencrypt-prod" \
|
||||||
|
--set client.ingress.tls.enabled=true \
|
||||||
|
--set client.ingress.tls.secretName=checkmate-client-tls \
|
||||||
|
--set server.ingress.annotations."cert-manager\.io/cluster-issuer"="letsencrypt-prod" \
|
||||||
|
--set server.ingress.tls.enabled=true \
|
||||||
|
--set server.ingress.tls.secretName=checkmate-server-tls
|
||||||
|
```
|
||||||
|
|
||||||
|
### Verification
|
||||||
|
|
||||||
|
After deployment, cert-manager will automatically create the TLS secrets. You can verify the certificate status:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check certificates
|
||||||
|
kubectl get certificates
|
||||||
|
|
||||||
|
# Check certificate details
|
||||||
|
kubectl describe certificate checkmate-client-tls
|
||||||
|
kubectl describe certificate checkmate-server-tls
|
||||||
|
|
||||||
|
# Verify the secrets were created
|
||||||
|
kubectl get secrets | grep checkmate-tls
|
||||||
|
```
|
||||||
|
|
||||||
|
The ingress will automatically use these secrets to enable HTTPS access to your Checkmate instance.
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{{- if eq .Values.client.ingress.host "change_me" }}
|
|
||||||
{{- fail "client.ingress.host must be overridden and not set to 'change_me'" }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if eq .Values.server.ingress.host "change_me" }}
|
|
||||||
{{- fail "server.ingress.host must be overridden and not set to 'change_me'" }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- $protocol := .Values.server.protocol }}
|
|
||||||
{{- if not (or (eq $protocol "http") (eq $protocol "https")) }}
|
|
||||||
{{- fail "server.protocol must be either 'http' or 'https'" }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -11,6 +11,12 @@ metadata:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
ingressClassName: {{ .Values.client.ingress.className }}
|
ingressClassName: {{ .Values.client.ingress.className }}
|
||||||
|
{{- if .Values.client.ingress.tls.enabled }}
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- {{ .Values.client.ingress.host }}
|
||||||
|
secretName: {{ default (printf "%s-client-tls" .Release.Name) .Values.client.ingress.tls.secretName }}
|
||||||
|
{{- end }}
|
||||||
rules:
|
rules:
|
||||||
- host: {{ .Values.client.ingress.host }}
|
- host: {{ .Values.client.ingress.host }}
|
||||||
http:
|
http:
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
{{- if eq .Values.client.ingress.host "change_me" }}
|
||||||
|
{{- fail "client.ingress.host must be overridden and not set to 'change_me'" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if eq .Values.server.ingress.host "change_me" }}
|
||||||
|
{{- fail "server.ingress.host must be overridden and not set to 'change_me'" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- $serverProtocol := .Values.server.protocol }}
|
||||||
|
{{- if not (or (eq $serverProtocol "http") (eq $serverProtocol "https")) }}
|
||||||
|
{{- fail "server.protocol must be either 'http' or 'https'" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- $clientProtocol := .Values.client.protocol }}
|
||||||
|
{{- if not (or (eq $clientProtocol "http") (eq $clientProtocol "https")) }}
|
||||||
|
{{- fail "client.protocol must be either 'http' or 'https'" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Enforce protocol when TLS is enabled to avoid mixed-content */}}
|
||||||
|
{{- if and .Values.client.ingress.tls.enabled (ne $clientProtocol "https") }}
|
||||||
|
{{- fail "client.ingress.tls.enabled is true but client.protocol is not 'https'. Set client.protocol: https to avoid mixed content." }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if and .Values.server.ingress.tls.enabled (ne $serverProtocol "https") }}
|
||||||
|
{{- fail "server.ingress.tls.enabled is true but server.protocol is not 'https'. Set server.protocol: https to ensure correct API base URL." }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* If client runs on https, API must also be https to avoid mixed content */}}
|
||||||
|
{{- if and (eq $clientProtocol "https") (ne $serverProtocol "https") }}
|
||||||
|
{{- fail "client.protocol is 'https' but server.protocol is not. Set server.protocol: https to prevent browser mixed-content issues." }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Fail early if TLS enabled without cert-manager annotations (cluster-issuer or issuer) */}}
|
||||||
|
{{- $cAnn := .Values.client.ingress.annotations | default dict }}
|
||||||
|
{{- $sAnn := .Values.server.ingress.annotations | default dict }}
|
||||||
|
|
||||||
|
{{- $clientHasIssuer := or (hasKey $cAnn "cert-manager.io/cluster-issuer") (hasKey $cAnn "cert-manager.io/issuer") }}
|
||||||
|
{{- $serverHasIssuer := or (hasKey $sAnn "cert-manager.io/cluster-issuer") (hasKey $sAnn "cert-manager.io/issuer") }}
|
||||||
|
|
||||||
|
{{- if and .Values.client.ingress.tls.enabled (not $clientHasIssuer) }}
|
||||||
|
{{- fail "client.ingress.tls.enabled is true but no cert-manager issuer annotation found. Add 'cert-manager.io/cluster-issuer' or 'cert-manager.io/issuer'." }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if and .Values.server.ingress.tls.enabled (not $serverHasIssuer) }}
|
||||||
|
{{- fail "server.ingress.tls.enabled is true but no cert-manager issuer annotation found. Add 'cert-manager.io/cluster-issuer' or 'cert-manager.io/issuer'." }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* Secret name can be omitted; we default to <release>-client|server-tls in templates */}}
|
||||||
@@ -18,6 +18,12 @@ metadata:
|
|||||||
#nginx.ingress.kubernetes.io/cors-allow-credentials: "true"*/}}
|
#nginx.ingress.kubernetes.io/cors-allow-credentials: "true"*/}}
|
||||||
spec:
|
spec:
|
||||||
ingressClassName: {{ .Values.server.ingress.className }}
|
ingressClassName: {{ .Values.server.ingress.className }}
|
||||||
|
{{- if .Values.server.ingress.tls.enabled }}
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- {{ .Values.server.ingress.host }}
|
||||||
|
secretName: {{ default (printf "%s-server-tls" .Release.Name) .Values.server.ingress.tls.secretName }}
|
||||||
|
{{- end }}
|
||||||
rules:
|
rules:
|
||||||
- host: {{ .Values.server.ingress.host }}
|
- host: {{ .Values.server.ingress.host }}
|
||||||
http:
|
http:
|
||||||
|
|||||||
@@ -7,6 +7,15 @@ client:
|
|||||||
host: change_me
|
host: change_me
|
||||||
className: nginx
|
className: nginx
|
||||||
annotations: {}
|
annotations: {}
|
||||||
|
# Example annotations for cert-manager:
|
||||||
|
# annotations:
|
||||||
|
# cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
|
tls:
|
||||||
|
enabled: false
|
||||||
|
# secretName: {{ .Release.Name }}-client-tls # Optional; defaults to <release>-client-tls if omitted
|
||||||
|
# Note: when enabling TLS, also set client.protocol: https and add
|
||||||
|
# a cert-manager issuer annotation (e.g. cert-manager.io/cluster-issuer: "letsencrypt-prod").
|
||||||
|
# The secret will be automatically created by cert-manager when using the cert-manager.io/cluster-issuer annotation
|
||||||
|
|
||||||
server:
|
server:
|
||||||
image: ghcr.io/bluewave-labs/checkmate-backend:v3.2.0
|
image: ghcr.io/bluewave-labs/checkmate-backend:v3.2.0
|
||||||
@@ -17,6 +26,15 @@ server:
|
|||||||
host: change_me
|
host: change_me
|
||||||
className: nginx
|
className: nginx
|
||||||
annotations: {}
|
annotations: {}
|
||||||
|
# Example annotations for cert-manager:
|
||||||
|
# annotations:
|
||||||
|
# cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
|
tls:
|
||||||
|
enabled: false
|
||||||
|
# secretName: {{ .Release.Name }}-server-tls # Optional; defaults to <release>-server-tls if omitted
|
||||||
|
# Note: when enabling TLS, also set server.protocol: https and add
|
||||||
|
# a cert-manager issuer annotation (e.g. cert-manager.io/cluster-issuer: "letsencrypt-prod").
|
||||||
|
# The secret will be automatically created by cert-manager when using the cert-manager.io/cluster-issuer annotation
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|||||||
Reference in new issue
Block a user