Skip to content

Commit

Permalink
helm chart for pg-sni-router (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaporgin authored May 1, 2023
1 parent 952a49f commit fcadbda
Show file tree
Hide file tree
Showing 18 changed files with 711 additions and 0 deletions.
1 change: 1 addition & 0 deletions charts/neon-pg-sni-router/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
values-preview-render.yaml
23 changes: 23 additions & 0 deletions charts/neon-pg-sni-router/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
11 changes: 11 additions & 0 deletions charts/neon-pg-sni-router/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
name: neon-pg-sni-router
description: Neon Postgres SNI Router
type: application
version: 0.0.0
appVersion: "0.1.0"
kubeVersion: "^1.18.x-x"
home: https://neon.tech
sources:
- https://github.com/neondatabase/neon
- https://github.com/neondatabase/helm-charts
80 changes: 80 additions & 0 deletions charts/neon-pg-sni-router/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# neon-pg-sni-router

![Version: 0.0.0](https://img.shields.io/badge/Version-0.0.0-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 Postgres SNI Router

**Homepage:** https://neon.tech

## Source Code

* <https://github.com/neondatabase/neon>
* <https://github.com/neondatabase/helm-charts>

## Installing the Chart

To install the chart with the release name `neon-pg-sni-router`:

```console
$ helm repo add neondatabase https://neondatabase.github.io/helm-charts
$ helm install neon-pg-sni-router neondatabase/neon-pg-sni-router
```

## Requirements

Kubernetes: `^1.18.x-x`

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity for pod assignment |
| containerLifecycle | object | `{}` | container lifecycle hooks specification for neon-pg-sni-router container |
| deploymentStrategy | object | `{"type":"Recreate"}` | strategy override for deployment |
| exposedService.annotations | object | `{}` | Annotations to add to the exposed service |
| exposedService.httpsPort | int | `nil` | Exposed Service https port. If null, https server will not be exposed. |
| exposedService.port | int | `5432` | Exposed Service proxy port |
| exposedService.type | string | `"LoadBalancer"` | Exposed service type |
| extraManifests | list | `[]` | Additional manifests that are created with the chart |
| fullnameOverride | string | `""` | String to fully override neon-pg-sni-router.fullname template |
| image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| image.repository | string | `"neondatabase/neon"` | Neondatabase image repository |
| image.tag | string | `"3113"` | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | `[]` | Specify docker-registry secret names as an array |
| metrics.enabled | bool | `false` | Enable prometheus metrcis autodiscovery |
| metrics.serviceMonitor.enabled | bool | `false` | Create ServiceMonitor resource |
| metrics.serviceMonitor.interval | string | `"10s"` | Interval in which prometheus scrapes |
| metrics.serviceMonitor.namespace | string | `""` | The namespace in which the ServiceMonitor will be created, if empty then Release.Namespace used |
| metrics.serviceMonitor.scrapeTimeout | string | `"10s"` | Scrape Timeout duration for prometheus |
| metrics.serviceMonitor.selector | object | `{}` | Additional labels to attach (used by Prometheus operator) |
| nameOverride | string | `""` | String to partially override neon-pg-sni-router.fullname template (will maintain the release name) |
| nodeSelector | object | `{}` | Node labels for pod assignment. |
| podAnnotations | object | `{}` | Annotations for neon-pg-sni-router pods |
| podLabels | object | `{}` | Additional labels for neon-pg-sni-router pods |
| podSecurityContext | object | `{}` | neon-pg-sni-router's pods Security Context |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| securityContext | object | `{}` | neon-pg-sni-router's containers Security Context |
| service.annotations | object | `{}` | Annotations to add to the service |
| service.httpPort | int | `9090` | Http management port |
| service.port | int | `7000` | Service management port |
| service.type | string | `"ClusterIP"` | Service type |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `""` | |
| settings.authBackend | string | `"link"` | auth method used (console|link|postgres) |
| settings.authEndpoint | string | `""` | auth endpoint, e.g. "http://console.neon/authenticate_proxy_request/" |
| settings.destination | string | `"svc.cluster.local"` | append this domain zone to the transformed SNI hostname to get the destination address, e.g. "svc.cluster.local" |
| settings.domain | string | `"dummy"` | domain used in TLS cert for client postgres connections |
| settings.metricCollectionEndpoint | string | `""` | (url) endpoint used to send metrics to. If null, metrics will not be sent. |
| settings.metricCollectionInterval | string | `""` | (string) how often metrics should be sent. |
| settings.sentryEnvironment | string | `"development"` | "development" or "production". It will be visible in sentry in order to filter issues |
| settings.sentryUrl | string | `""` | url (will be converted into `SENTRY_DSN` environment variable) used by sentry to collect error/panic events in neon-pg-sni-router |
| settings.uri | string | `""` | |
| settings.wssPort | int | `nil` | numeric port used for wss/https connections. If null, wss server will not be started |
| terminationGracePeriodSeconds | int | `30` | Deployment's terminationGracePeriodSeconds |
| tolerations | list | `[]` | Tolerations for pod assignment. |
| useCertManager | bool | `false` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.9.1](https://github.com/norwoodj/helm-docs/releases/v1.9.1)
23 changes: 23 additions & 0 deletions charts/neon-pg-sni-router/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{ template "chart.header" . }}
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}[![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)

{{ template "chart.description" . }}

**Homepage:** {{ template "chart.homepage" . }}

{{ template "chart.sourcesSection" . }}

## Installing the Chart

To install the chart with the release name `{{ template "chart.name" . }}`:

```console
$ helm repo add neondatabase https://neondatabase.github.io/helm-charts
$ helm install {{ template "chart.name" . }} neondatabase/{{ template "chart.name" . }}
```

{{ template "chart.requirementsSection" . }}

{{ template "chart.valuesSection" . }}

{{ template "helm-docs.versionFooter" . }}
17 changes: 17 additions & 0 deletions charts/neon-pg-sni-router/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
TODO: define this.
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.exposedService.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "neon-pg-sni-router.fullname" . }}-exposed)
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo postgres://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.exposedService.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "neon-pg-sni-router.fullname" . }}-exposed'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "neon-pg-sni-router.fullname" . }}-exposed --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo postgres://$SERVICE_IP:{{ .Values.exposedService.port }}
{{- else if contains "ClusterIP" .Values.exposedService.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "neon-pg-sni-router.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit postgres://127.0.0.1:15432 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 15432:$CONTAINER_PORT
{{- end }}
72 changes: 72 additions & 0 deletions charts/neon-pg-sni-router/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "neon-pg-sni-router.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "neon-pg-sni-router.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "neon-pg-sni-router.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "neon-pg-sni-router.labels" -}}
helm.sh/chart: {{ include "neon-pg-sni-router.chart" . }}
{{ include "neon-pg-sni-router.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "neon-pg-sni-router.selectorLabels" -}}
app.kubernetes.io/name: {{ include "neon-pg-sni-router.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "neon-pg-sni-router.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "neon-pg-sni-router.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the name for TLS certificate and it's secret
*/}}
{{- define "neon-pg-sni-router.certificate" -}}
{{- .Values.settings.domain | replace "." "-" | replace "*" "wildcard" }}
{{- end }}
{{- define "neon-pg-sni-router.certificate-secret" -}}
{{ include "neon-pg-sni-router.certificate" . }}-tls
{{- end }}
Loading

0 comments on commit fcadbda

Please sign in to comment.