Skip to content

Commit 96acc1e

Browse files
committed
feat: vpn-indexer chart
Signed-off-by: Aurora Gaffney <aurora@blinklabs.io>
1 parent 8e58f17 commit 96acc1e

10 files changed

Lines changed: 400 additions & 0 deletions

File tree

charts/vpn-indexer/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/vpn-indexer/Chart.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: vpn-indexer
3+
description: VPN indexer helm chart
4+
type: application
5+
version: 0.1.0
6+
appVersion: "0.1.0"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "vpn-indexer.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "vpn-indexer.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "vpn-indexer.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "vpn-indexer.labels" -}}
37+
helm.sh/chart: {{ include "vpn-indexer.chart" . }}
38+
{{ include "vpn-indexer.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "vpn-indexer.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "vpn-indexer.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "vpn-indexer.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "vpn-indexer.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "vpn-indexer.fullname" . }}
5+
labels:
6+
{{- include "vpn-indexer.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "vpn-indexer.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
{{- with .Values.podAnnotations }}
15+
annotations:
16+
{{- toYaml . | nindent 8 }}
17+
{{- end }}
18+
labels:
19+
{{- include "vpn-indexer.selectorLabels" . | nindent 8 }}
20+
spec:
21+
{{- with .Values.imagePullSecrets }}
22+
imagePullSecrets:
23+
{{- toYaml . | nindent 8 }}
24+
{{- end }}
25+
serviceAccountName: {{ include "vpn-indexer.serviceAccountName" . }}
26+
securityContext:
27+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
28+
containers:
29+
- name: {{ .Chart.Name }}
30+
securityContext:
31+
{{- toYaml .Values.securityContext | nindent 12 }}
32+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
33+
imagePullPolicy: {{ .Values.image.pullPolicy }}
34+
env:
35+
- name: DATABASE_DIR
36+
value: /data
37+
- name: CA_CERT_FILE
38+
value: /secrets/ca.crt
39+
- name: CA_KEY_FILE
40+
value: /secrets/ca.key
41+
{{- with .Values.ca.passphrase }}
42+
- name: CA_PASSPHRASE_FILE
43+
value: /secrets/ca.passphrase
44+
{{- end }}
45+
- name: CRL_CONFIGMAP_NAMESPACE
46+
value: {{ .Values.crl.configMapNamespace | default .Release.Namespace }}
47+
{{- with .Values.crl.configMapName }}
48+
- name: CRL_CONFIGMAP_NAME
49+
value: {{ . }}
50+
{{- end }}
51+
{{- with .Values.crl.configMapKey }}
52+
- name: CRL_CONFIGMAP_KEY
53+
value: {{ . }}
54+
{{- end }}
55+
{{- with .Values.crl.updateInterval }}
56+
- name: CRL_UPDATE_INTERVAL
57+
value: {{ . }}
58+
{{- end }}
59+
{{- with .Values.crl.revokeSerials }}
60+
- name: CRL_REVOKE_SERIALS
61+
value: {{ . }}
62+
{{- end }}
63+
{{- with .Values.crl.revokeTime }}
64+
- name: CRL_REVOKE_TIME
65+
value: {{ . }}
66+
{{- end }}
67+
# TODO
68+
#ports:
69+
# - name: http
70+
# containerPort: {{ .Values.service.port }}
71+
# protocol: TCP
72+
#livenessProbe:
73+
# httpGet:
74+
# path: /
75+
# port: http
76+
#readinessProbe:
77+
# httpGet:
78+
# path: /
79+
# port: http
80+
resources:
81+
{{- toYaml .Values.resources | nindent 12 }}
82+
volumeMounts:
83+
- name: data
84+
mountPath: /data
85+
- name: secrets
86+
mountPath: /secrets
87+
volumes:
88+
- name: data
89+
{{- if .Values.persistence.enabled }}
90+
persistentVolumeClaim:
91+
claimName: {{ include "vpn-indexer.fullname" . }}
92+
{{- else }}
93+
emptyDir: {}
94+
{{- end }}
95+
- name: secrets
96+
secret:
97+
secretName: {{ include "vpn-indexer.fullname" . }}
98+
{{- with .Values.nodeSelector }}
99+
nodeSelector:
100+
{{- toYaml . | nindent 8 }}
101+
{{- end }}
102+
{{- with .Values.affinity }}
103+
affinity:
104+
{{- toYaml . | nindent 8 }}
105+
{{- end }}
106+
{{- with .Values.tolerations }}
107+
tolerations:
108+
{{- toYaml . | nindent 8 }}
109+
{{- end }}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "vpn-indexer.fullname" . -}}
3+
{{- $svcPort := .Values.service.port -}}
4+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5+
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
6+
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
7+
{{- end }}
8+
{{- end }}
9+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
10+
apiVersion: networking.k8s.io/v1
11+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
12+
apiVersion: networking.k8s.io/v1beta1
13+
{{- else -}}
14+
apiVersion: extensions/v1beta1
15+
{{- end }}
16+
kind: Ingress
17+
metadata:
18+
name: {{ $fullName }}
19+
labels:
20+
{{- include "vpn-indexer.labels" . | nindent 4 }}
21+
{{- with .Values.ingress.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 4 }}
24+
{{- end }}
25+
spec:
26+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.ingress.className }}
28+
{{- end }}
29+
{{- if .Values.ingress.tls }}
30+
tls:
31+
{{- range .Values.ingress.tls }}
32+
- hosts:
33+
{{- range .hosts }}
34+
- {{ . | quote }}
35+
{{- end }}
36+
secretName: {{ .secretName }}
37+
{{- end }}
38+
{{- end }}
39+
rules:
40+
{{- range .Values.ingress.hosts }}
41+
- host: {{ .host | quote }}
42+
http:
43+
paths:
44+
{{- range .paths }}
45+
- path: {{ .path }}
46+
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
47+
pathType: {{ .pathType }}
48+
{{- end }}
49+
backend:
50+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
51+
service:
52+
name: {{ $fullName }}
53+
port:
54+
number: {{ $svcPort }}
55+
{{- else }}
56+
serviceName: {{ $fullName }}
57+
servicePort: {{ $svcPort }}
58+
{{- end }}
59+
{{- end }}
60+
{{- end }}
61+
{{- end }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- if .Values.persistence.enabled }}
2+
---
3+
apiVersion: v1
4+
kind: PersistentVolumeClaim
5+
metadata:
6+
name: {{ include "vpn-indexer.fullname" . }}
7+
labels:
8+
{{- include "vpn-indexer.labels" . | nindent 4 }}
9+
spec:
10+
{{- with .Values.persistence.storageClassName }}
11+
storageClassName: {{ . }}
12+
{{- end }}
13+
volumeMode: Filesystem
14+
accessModes: {{ toYaml .Values.persistence.accessModes }}
15+
resources: {{ toYaml .Values.persistence.resources | nindent 4 }}
16+
{{- end }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ include "vpn-indexer.fullname" . }}
6+
type: Opaque
7+
data:
8+
ca.crt: {{ b64enc .Values.ca.cert }}
9+
ca.key: {{ b64enc .Values.ca.key }}
10+
{{- with .Values.ca.passphrase }}
11+
ca.passphrase: {{ b64enc .Values.ca.passphrase }}
12+
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "vpn-indexer.fullname" . }}
5+
labels:
6+
{{- include "vpn-indexer.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
selector:
15+
{{- include "vpn-indexer.selectorLabels" . | nindent 4 }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "vpn-indexer.serviceAccountName" . }}
6+
labels:
7+
{{- include "vpn-indexer.labels" . | nindent 4 }}
8+
{{- with .Values.serviceAccount.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- end }}

0 commit comments

Comments
 (0)