Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions charts/tails-server/.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/
33 changes: 33 additions & 0 deletions charts/tails-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: v2
name: tails-server
description: Indy Tails Server - receive, store and serve Hyperledger Indy tails files

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

# Application version the chart deploys.
appVersion: "1.2.1"

# Minimum Kubernetes version supported by this chart (HPA v2)
kubeVersion: ">=1.23.0-0"

maintainers:
- email: emiliano.sune@quartech.com
name: esune
url: https://github.com/esune
- email: ivan.polchenko@quartech.com
name: i5okie
url: https://github.com/i5okie

keywords:
- indy
- anoncreds
- tails
- revocation
home: https://github.com/bcgov/indy-tails-server
sources:
- https://github.com/bcgov/indy-tails-server
98 changes: 98 additions & 0 deletions charts/tails-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Tails Server Helm Chart

A simple, production‑ready Helm chart to deploy the Indy Tails Server.

- App: <https://github.com/bcgov/indy-tails-server>
- Kubernetes: >= 1.23 (uses autoscaling/v2)

## TL;DR

```bash
# From repo root
helm upgrade --install tails-server charts/tails-server \
--namespace tails --create-namespace
```

## Prerequisites

- Kubernetes >= 1.23
- Metrics server (if enabling HPA)
- A default StorageClass (if enabling persistence without existingClaim)

## Configuration

Values below are the most commonly tuned. See `values.yaml` for the full list.

| Parameter | Default | Description |
|---|---|---|
| replicaCount | 1 | Desired replicas when HPA disabled |
| autoscaling.enabled | false | Enable HorizontalPodAutoscaler |
| autoscaling.minReplicas | 1 | HPA min replicas |
| autoscaling.maxReplicas | 4 | HPA max replicas |
| autoscaling.targetCPUUtilizationPercentage | 80 | HPA CPU target |
| image.repository | ghcr.io/bcgov/tails-server | Image repository |
| image.tag | chart appVersion | Image tag |
| service.type | ClusterIP | Service type |
| service.port | 6543 | Service port (TCP) |
| service.annotations | {} | Extra Service annotations |
| ingress.enabled | false | Create Ingress (OpenShift will auto‑create Route) |
| persistence.enabled | false | Enable persistent storage for tails files |
| persistence.existingClaim | "" | Use an existing PVC name |
| persistence.size | 5Gi | PVC size when creating new |
| persistence.accessModes | [ReadWriteOnce] | PVC access modes |
| persistence.storageClass | "" | StorageClass name |
| persistence.mountPath | /data | Container mount path for storage |
| server.host | 0.0.0.0 | Bind address inside the pod |
| server.port | "" | Override port (defaults to service.port) |
| server.logLevel | WARNING | Log level (e.g., INFO, WARNING, ERROR) |
| livenessProbe | see values.yaml | TCP liveness probe config |
| readinessProbe | see values.yaml | TCP readiness probe config |
| startupProbe | see values.yaml | TCP startup probe config |
| securityContext | {} | Container security context (see example below) |
| serviceAccount.create | true | Create a ServiceAccount |
| serviceAccount.automount | true | Automount SA token (set false to harden) |
| nodeSelector | {} | Node selector |
| tolerations | [] | Tolerations |
| affinity | {} | Affinity/anti‑affinity |
| pdb.enabled | false | Create PodDisruptionBudget when replicas > 1 |

### OpenShift notes

- Prefer using Ingress. OpenShift will create a Route automatically and may terminate TLS at the edge regardless of `ingress.tls` settings.
- For multi‑replica deployments, use RWX storage if your storage class supports it.

Example RWX values (OpenShift NetApp):

```yaml
persistence:
enabled: true
size: 10Gi
accessModes:
- ReadWriteMany
storageClass: netapp-file-standard
mountPath: /data
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 4
pdb:
enabled: true
minAvailable: 1
```
### Security hardening (example)
```yaml
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
serviceAccount:
automount: false
```
## License
Apache-2.0
23 changes: 23 additions & 0 deletions charts/tails-server/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
1. Get the application URL:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
{{- /* Scheme depends on your ingress/route configuration; OpenShift Routes may terminate TLS regardless of values */ -}}
http(s)://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "tails-server.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
echo "Waiting for LoadBalancer IP..."
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "tails-server.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "tails-server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Port-forward to test locally:"
echo " kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT"
echo "Then open: http://127.0.0.1:8080/match/test"
{{- end }}
69 changes: 69 additions & 0 deletions charts/tails-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "tails-server.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 "tails-server.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 "tails-server.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "tails-server.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "tails-server.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
PVC name helper
*/}}
{{- define "tails-server.dataPvcName" -}}
{{ include "tails-server.fullname" . }}-data
{{- end }}
119 changes: 119 additions & 0 deletions charts/tails-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "tails-server.fullname" . }}
labels:
{{- include "tails-server.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit | default 3 }}
strategy:
{{- toYaml .Values.strategy | nindent 2 }}
selector:
matchLabels:
{{- include "tails-server.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "tails-server.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "tails-server.serviceAccountName" . }}
{{- if not .Values.serviceAccount.automount }}
automountServiceAccountToken: false
{{- end }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["tails-server"]
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
args:
- "--host"
- {{ .Values.server.host | quote }}
- "--port"
- {{ (default .Values.service.port .Values.server.port) | quote }}
- "--storage-path"
- {{ .Values.persistence.mountPath | quote }}
- "--log-level"
- {{ .Values.server.logLevel | quote }}
{{- if .Values.extraArgs }}
{{- toYaml .Values.extraArgs | nindent 12 }}
{{- end }}
{{- with .Values.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.extraEnvFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.startupProbe }}
startupProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: data
mountPath: {{ .Values.persistence.mountPath }}
volumes:
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "tails-server.dataPvcName" .) }}
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Loading