diff --git a/helm_chart/external-charts/postgresql-11.9.8/postgresql-11.9.8.tgz b/helm_chart/external-charts/postgresql-11.9.8/postgresql-11.9.8.tgz new file mode 100644 index 0000000..1ad6223 Binary files /dev/null and b/helm_chart/external-charts/postgresql-11.9.8/postgresql-11.9.8.tgz differ diff --git a/helm_chart/external-charts/postgresql-11.9.8/pv_pvc.yaml b/helm_chart/external-charts/postgresql-11.9.8/pv_pvc.yaml new file mode 100644 index 0000000..4be6471 --- /dev/null +++ b/helm_chart/external-charts/postgresql-11.9.8/pv_pvc.yaml @@ -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 diff --git a/helm_chart/external-charts/postgresql-11.9.8/values.yaml b/helm_chart/external-charts/postgresql-11.9.8/values.yaml new file mode 100644 index 0000000..490278f --- /dev/null +++ b/helm_chart/external-charts/postgresql-11.9.8/values.yaml @@ -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 diff --git a/helm_chart/roman/.helmignore b/helm_chart/roman/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/helm_chart/roman/.helmignore @@ -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/ diff --git a/helm_chart/roman/Chart.yaml b/helm_chart/roman/Chart.yaml new file mode 100644 index 0000000..319b39c --- /dev/null +++ b/helm_chart/roman/Chart.yaml @@ -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" diff --git a/helm_chart/roman/templates/NOTES.txt b/helm_chart/roman/templates/NOTES.txt new file mode 100644 index 0000000..e69de29 diff --git a/helm_chart/roman/templates/_helpers.tpl b/helm_chart/roman/templates/_helpers.tpl new file mode 100644 index 0000000..5146dc3 --- /dev/null +++ b/helm_chart/roman/templates/_helpers.tpl @@ -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 }} diff --git a/helm_chart/roman/templates/deployment.yaml b/helm_chart/roman/templates/deployment.yaml new file mode 100644 index 0000000..e5d34d5 --- /dev/null +++ b/helm_chart/roman/templates/deployment.yaml @@ -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" diff --git a/helm_chart/roman/templates/ingress.yaml b/helm_chart/roman/templates/ingress.yaml new file mode 100644 index 0000000..c7291a9 --- /dev/null +++ b/helm_chart/roman/templates/ingress.yaml @@ -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 diff --git a/helm_chart/roman/templates/secret-or-certificate.yaml b/helm_chart/roman/templates/secret-or-certificate.yaml new file mode 100644 index 0000000..2aaf48d --- /dev/null +++ b/helm_chart/roman/templates/secret-or-certificate.yaml @@ -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 -}} \ No newline at end of file diff --git a/helm_chart/roman/templates/secret-token.yaml b/helm_chart/roman/templates/secret-token.yaml new file mode 100644 index 0000000..5a74c6c --- /dev/null +++ b/helm_chart/roman/templates/secret-token.yaml @@ -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 }}" diff --git a/helm_chart/roman/templates/service.yaml b/helm_chart/roman/templates/service.yaml new file mode 100644 index 0000000..b9ffb81 --- /dev/null +++ b/helm_chart/roman/templates/service.yaml @@ -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 diff --git a/helm_chart/roman/values.yaml b/helm_chart/roman/values.yaml new file mode 100644 index 0000000..f757304 --- /dev/null +++ b/helm_chart/roman/values.yaml @@ -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