Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add helm chart #105

Draft
wants to merge 12 commits into
base: staging
Choose a base branch
from
Binary file not shown.
28 changes: 28 additions & 0 deletions helm_chart/external-charts/postgresql-11.9.8/pv_pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgresql-pv
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgresql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
13 changes: 13 additions & 0 deletions helm_chart/external-charts/postgresql-11.9.8/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
global:
postgresql:
enabled: true
auth:
postgresPassword: externalPostgresql
username: externalPostgresql
password: externalPostgresql
database: externalPostgresql
primary:
persistence:
existingClaim: postgresql-pv-claim
volumePermissions:
enabled: true
23 changes: 23 additions & 0 deletions helm_chart/roman/.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/
24 changes: 24 additions & 0 deletions helm_chart/roman/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: roman
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
Empty file.
62 changes: 62 additions & 0 deletions helm_chart/roman/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "roman.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 "roman.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 "roman.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "roman.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "roman.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
80 changes: 80 additions & 0 deletions helm_chart/roman/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: roman
labels:
app: roman
spec:
replicas: {{ .Values.roman.replicaCount }}
selector:
matchLabels:
app: roman
template:
metadata:
labels:
app: roman
spec:
containers:
- name: roman
image: "{{ .Values.roman.image.repository }}:{{ .Values.roman.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: IfNotPresent

ports:
- containerPort: 8080
protocol: TCP
- containerPort: 8081
protocol: TCP
- containerPort: 8082
protocol: TCP

env:
- name: APP_KEY
valueFrom:
secretKeyRef:
name: "roman-secrets"
key: appKey

- name: ROMAN_PUB_KEY_BASE64
valueFrom:
secretKeyRef:
name: "roman-secrets"
key: pubKeyBase64

- name: DB_URL
value: "{{ required "Must specify dbURL" .Values.roman.dbURL }}"

- name: WIRE_API_HOST
value: "{{ required "Must specify wireApiHost" .Values.roman.wireApiHost }}"

- name: DB_USER
value: "{{ required "Must specify dbUser" .Values.roman.dbUser }}"

- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: "roman-secrets"
key: dbPassword

startupProbe:
httpGet:
path: /api/status
port: 8080
failureThreshold: 6
periodSeconds: 5

livenessProbe:
httpGet:
path: /api/status
port: 8080

readinessProbe:
httpGet:
path: /api/status
port: 8080

resources:
requests:
memory: "1500Mi"
cpu: 50m
limits:
memory: "1500Mi"
23 changes: 23 additions & 0 deletions helm_chart/roman/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: roman
labels:
app: roman
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/enable-cors: "true"
spec:
tls:
- hosts:
- "{{ required "Must specify host" .Values.roman.publicURL }}"
# secretName: "{{ include "roman.fullname" . }}"
rules:
- host: "{{ .Values.roman.publicURL }}"
http:
paths:
- path: /
pathType: Prefix
backend:
serviceName: roman
servicePort: 80
34 changes: 34 additions & 0 deletions helm_chart/roman/templates/secret-or-certificate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- if .Values.tls.issuerRef -}}
{{- if or .Values.tls.key .Values.tls.crt }}
{{- fail "ingress.issuer and ingress.{crt,key} are mutually exclusive" -}}
{{- end -}}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: roman
labels:
app: roman
spec:
dnsNames:
- {{ .Values.roman.publicURL }}
secretName: "{{ include "roman.fullname" . }}"
issuerRef:
{{- toYaml .Values.tls.issuerRef | nindent 4 }}
privateKey:
rotationPolicy: Always
algorithm: ECDSA
size: 384
{{- else if and .Values.tls.key .Values.tls.crt -}}
apiVersion: v1
kind: Secret
metadata:
name: "{{ include "roman.fullname" . }}"
labels:
app: roman
type: kubernetes.io/tls
data:
tls.key: {{ required "tls.key is required" .Values.tls.key | b64enc }}
tls.crt: {{ required "tls.crt is required" .Values.tls.crt | b64enc }}
{{- else -}}
{{- fail "must specify tls.key and tls.crt , or tls.issuerRef" -}}
{{- end -}}
9 changes: 9 additions & 0 deletions helm_chart/roman/templates/secret-token.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: "roman-secrets"
type: Opaque
data:
appKey: "{{ required "Must specify serviceToken" .Values.roman.appKey | b64enc }}"
dbPassword: "{{ required "Must specify dbPassword" .Values.roman.dbPassword | b64enc }}"
pubKeyBase64: "{{ required "Must specify dbPassword" .Values.roman.pubKeyBase64 | b64enc }}"
15 changes: 15 additions & 0 deletions helm_chart/roman/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: roman
labels:
app: roman
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8080
protocol: TCP
name: http
selector:
app: roman
25 changes: 25 additions & 0 deletions helm_chart/roman/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Default values for roman.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

roman:
replicaCount: 1
image:
repository: quay.io/wire/roman
# Overrides the image tag whose default is the chart appVersion.
tag: staging
serviceToken: # Provide the roman service token.
# randomly generated for local testing
appKey: b53181dd-6400-4960-8988-f775545588ff-0949f503-421e-4588-a2c5-f64fd9c180fd
wireApiHost: https://nginz-https.example.com
proxyDomain:
# random base 64 string used as certificate, replace with real one
pubKeyBase64: LS0tLS1CRUdJTiBQVcFQvWjcKMlczd1A1TzJveFVCTElDIEtFWS0tLS0tCg==
publicURL: roman.example.com # Link to the subdomain pointing to roman.
dbURL: jdbc:postgresql://postgresql:5432/externalPostgresql # Link to your Postgres server.
dbUser: externalPostgresql # Provide your Postgres DB username.
dbPassword: externalPostgresql # Provide your Postgres DB password.

tls:
issuerRef:
name: letsencrypt-http01