Skip to content

Commit

Permalink
Add TLS support in scram-proxy (#12)
Browse files Browse the repository at this point in the history
* Add TLS support in scram-proxy

* Bump chart version

* review fix: quote domain

Co-authored-by: Stas Kelvich <[email protected]>
  • Loading branch information
SergeyMelnikov and kelvich authored May 5, 2022
1 parent 05bb526 commit e69c245
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/neon-proxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: neon-proxy
description: Neon Proxy
type: application
version: 1.2.3
version: 1.2.4
appVersion: "0.1.0"
kubeVersion: "^1.18.x-x"
home: https://neon.tech
Expand Down
3 changes: 2 additions & 1 deletion charts/neon-proxy/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# neon-proxy

![Version: 1.2.3](https://img.shields.io/badge/Version-1.2.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![Lint and Test Charts](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml/badge.svg)](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml)
![Version: 1.2.4](https://img.shields.io/badge/Version-1.2.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![Lint and Test Charts](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml/badge.svg)](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml)

Neon Proxy

Expand Down Expand Up @@ -59,6 +59,7 @@ Kubernetes: `^1.18.x-x`
| serviceAccount.name | string | `""` | |
| settings.authBackend | string | `"legacy"` | auth method used (legacy|console|link|postgres) |
| settings.authEndpoint | string | `""` | auth endpoint, e.g. "http://console.neon/authenticate_proxy_request/" |
| settings.domain | string | `""` | domain used in TLS cert for client postgres connections |
| settings.uri | string | `""` | |
| tolerations | list | `[]` | Tolerations for pod assignment. |

Expand Down
10 changes: 10 additions & 0 deletions charts/neon-proxy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,13 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the name for TLS certificate and it's secret
*/}}
{{- define "neon-proxy.certificate" -}}
{{- .Values.settings.domain | replace "." "-" | replace "*" "wildcard" }}
{{- end }}
{{- define "neon-proxy.certificate-secret" -}}
{{ include "neon-proxy.certificate" . }}-tls
{{- end }}
17 changes: 17 additions & 0 deletions charts/neon-proxy/templates/certificate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.settings.domain }}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ include "neon-proxy.certificate" . }}
spec:
commonName: '{{ .Values.settings.domain | quote }}'
dnsNames:
- '{{ .Values.settings.domain }}'
issuerRef:
group: cert-manager.io
kind: ClusterIssuer
name: cert-manager-clusterissuer
secretName: {{ include "neon-proxy.certificate-secret" . }}
privateKey:
encoding: PKCS8
{{- end }}
18 changes: 18 additions & 0 deletions charts/neon-proxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ spec:
- {{ . }}
{{- end }}
{{- end }}
{{- if .Values.settings.domain }}
- --tls-key
- /certs/tls.key
- --tls-cert
- /certs/tls.crt
{{ end }}
{{- if .Values.settings.domain }}
volumeMounts:
- mountPath: "/certs"
name: certs
readOnly: true
{{- end }}
ports:
- name: proxy
containerPort: 5432
Expand Down Expand Up @@ -100,6 +112,12 @@ spec:
timeoutSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.settings.domain }}
volumes:
- name: certs
secret:
secretName: {{ include "neon-proxy.certificate-secret" . }}
{{ end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
2 changes: 2 additions & 0 deletions charts/neon-proxy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ settings:
uri: ""
# settings.authBackend -- auth method used (legacy|console|link|postgres)
authBackend: "legacy"
# settings.domain -- domain used in TLS cert for client postgres connections
domain: ""

serviceAccount:
# serviceAccount.create - Specifies whether a service account should be created
Expand Down

0 comments on commit e69c245

Please sign in to comment.