Skip to content

Commit 4af99f9

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

10 files changed

Lines changed: 412 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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v2
2+
name: vpn-indexer
3+
description: VPN indexer helm chart
4+
type: application
5+
6+
version: 0.1.0
7+
8+
appVersion: "0.1.0"
9+
10+
maintainers:
11+
- name: aurora
12+
email: aurora@blinklabs.io
13+
- name: verbotenj
14+
email: verbotenj@blinklabs.io
15+
- name: wolf31o2
16+
email: wolf31o2@blinklabs.io
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: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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+
{{- with .Values.crl.configMapNamespace }}
46+
- name: CRL_CONFIGMAP_NAMESPACE
47+
value: {{ . }}
48+
{{- end }}
49+
{{- with .Values.crl.configMapName }}
50+
- name: CRL_CONFIGMAP_NAME
51+
value: {{ . }}
52+
{{- end }}
53+
{{- with .Values.crl.configMapKey }}
54+
- name: CRL_CONFIGMAP_KEY
55+
value: {{ . }}
56+
{{- end }}
57+
{{- with .Values.crl.updateInterval }}
58+
- name: CRL_UPDATE_INTERVAL
59+
value: {{ . }}
60+
{{- end }}
61+
{{- with .Values.crl.revokeSerials }}
62+
- name: CRL_REVOKE_SERIALS
63+
value: {{ . }}
64+
{{- end }}
65+
{{- with .Values.crl.revokeTime }}
66+
- name: CRL_REVOKE_TIME
67+
value: {{ . }}
68+
{{- end }}
69+
# TODO
70+
#ports:
71+
# - name: http
72+
# containerPort: {{ .Values.service.port }}
73+
# protocol: TCP
74+
#livenessProbe:
75+
# httpGet:
76+
# path: /
77+
# port: http
78+
#readinessProbe:
79+
# httpGet:
80+
# path: /
81+
# port: http
82+
resources:
83+
{{- toYaml .Values.resources | nindent 12 }}
84+
volumeMounts:
85+
- name: data
86+
mountPath: /data
87+
- name: secrets
88+
mountPath: /secrets
89+
volumes:
90+
- name: data
91+
{{- if .Values.persistence.enabled }}
92+
persistentVolumeClaim:
93+
claimName: {{ include "vpn-indexer.fullname" . }}
94+
{{- else }}
95+
emptyDir: {}
96+
{{- end }}
97+
- name: secrets
98+
secret:
99+
secretName: {{ include "vpn-indexer.fullname" . }}
100+
{{- with .Values.nodeSelector }}
101+
nodeSelector:
102+
{{- toYaml . | nindent 8 }}
103+
{{- end }}
104+
{{- with .Values.affinity }}
105+
affinity:
106+
{{- toYaml . | nindent 8 }}
107+
{{- end }}
108+
{{- with .Values.tolerations }}
109+
tolerations:
110+
{{- toYaml . | nindent 8 }}
111+
{{- 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)