diff --git a/changelog.d/2-features/pr-2935 b/changelog.d/2-features/pr-2935 new file mode 100644 index 0000000000..bd6527bbe4 --- /dev/null +++ b/changelog.d/2-features/pr-2935 @@ -0,0 +1 @@ +Roman charts are now available. diff --git a/charts/roman/.helmignore b/charts/roman/.helmignore new file mode 100644 index 0000000000..0e8a0eb36f --- /dev/null +++ b/charts/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/charts/roman/Chart.yaml b/charts/roman/Chart.yaml new file mode 100644 index 0000000000..319b39cca8 --- /dev/null +++ b/charts/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/charts/roman/README.md b/charts/roman/README.md new file mode 100644 index 0000000000..a06f14ed13 --- /dev/null +++ b/charts/roman/README.md @@ -0,0 +1,7 @@ +This is the helm chart for deploying Roman(https://github.com/wireapp/roman) + +Edit the values.yaml file and put required configuration. + +Refer to the Roman repo README file for details on all the variables. + +Also, Roman needs a PostgreSQL database, for the test purpose you can create a PostgreSQL deployment by using the bitnami/postgresql wrapper available at charts/postgresql diff --git a/charts/roman/templates/NOTES.txt b/charts/roman/templates/NOTES.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/charts/roman/templates/_helpers.tpl b/charts/roman/templates/_helpers.tpl new file mode 100644 index 0000000000..5146dc3c97 --- /dev/null +++ b/charts/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/charts/roman/templates/deployment.yaml b/charts/roman/templates/deployment.yaml new file mode 100644 index 0000000000..9c93297fca --- /dev/null +++ b/charts/roman/templates/deployment.yaml @@ -0,0 +1,83 @@ +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: PROXY_DOMAIN + value: "{{- if .Values.roman.proxyDomain }} {{ .Values.roman.proxyDomain }} {{- end }}" + + - 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/charts/roman/templates/ingress.yaml b/charts/roman/templates/ingress.yaml new file mode 100644 index 0000000000..c7291a9a6d --- /dev/null +++ b/charts/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/charts/roman/templates/secret-or-certificate.yaml b/charts/roman/templates/secret-or-certificate.yaml new file mode 100644 index 0000000000..2aaf48d23e --- /dev/null +++ b/charts/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/charts/roman/templates/secret-token.yaml b/charts/roman/templates/secret-token.yaml new file mode 100644 index 0000000000..5a74c6c3e1 --- /dev/null +++ b/charts/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/charts/roman/templates/service.yaml b/charts/roman/templates/service.yaml new file mode 100644 index 0000000000..b9ffb8122e --- /dev/null +++ b/charts/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/charts/roman/values.yaml b/charts/roman/values.yaml new file mode 100644 index 0000000000..7cbbafacc2 --- /dev/null +++ b/charts/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: # Provide your Postgres DB username. + dbPassword: # Provide your Postgres DB password. + +tls: + issuerRef: + name: letsencrypt-http01