Skip to content

Commit 1527027

Browse files
i5okiejamshale
andauthored
Create Acapy Helm Chart (openwallet-foundation#3599)
* Create Acapy Helm chart Signed-off-by: Ivan P <[email protected]> * Update templates, values, create readme Signed-off-by: Ivan P <[email protected]> * remove ledger from default values Signed-off-by: Ivan P <[email protected]> * Update Readme Signed-off-by: Ivan P <[email protected]> * Update acapy version Signed-off-by: Ivan P <[email protected]> * Cleanup helpers file Signed-off-by: Ivan P <[email protected]> * Implement websockets flag Signed-off-by: Ivan P <[email protected]> * Update Readme Signed-off-by: Ivan P <[email protected]> * Addressing comments Signed-off-by: Ivan P <[email protected]> --------- Signed-off-by: Ivan P <[email protected]> Co-authored-by: jamshale <[email protected]>
1 parent ddc70ae commit 1527027

21 files changed

+2079
-0
lines changed

charts/acapy/.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/acapy/Chart.lock

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dependencies:
2+
- name: postgresql
3+
repository: https://charts.bitnami.com/bitnami/
4+
version: 15.5.38
5+
- name: common
6+
repository: https://charts.bitnami.com/bitnami/
7+
version: 2.27.0
8+
digest: sha256:b97fd206aee47f3869935fdbe062eded88b9c429a411b32335e4effa99318c36
9+
generated: "2025-03-06T09:40:05.890168-08:00"

charts/acapy/Chart.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v2
2+
name: acapy
3+
description: A Helm chart for ACA-Py - A Cloud Agent - Python
4+
type: application
5+
6+
version: 0.1.0
7+
appVersion: "1.2.4"
8+
9+
dependencies:
10+
- name: postgresql
11+
version: 15.5.38
12+
repository: https://charts.bitnami.com/bitnami/
13+
condition: postgresql.enabled
14+
- name: common
15+
repository: https://charts.bitnami.com/bitnami/
16+
tags:
17+
- bitnami-common
18+
version: 2.x.x

charts/acapy/README.md

Lines changed: 314 additions & 0 deletions
Large diffs are not rendered by default.
15.3 KB
Binary file not shown.
74 KB
Binary file not shown.

charts/acapy/templates/NOTES.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CHART NAME: {{ .Chart.Name }}
2+
CHART VERSION: {{ .Chart.Version }}
3+
APP VERSION: {{ .Chart.AppVersion }}
4+
5+
1. Get the application URL by running these commands:
6+
{{- if contains "LoadBalancer" .Values.service.type }}
7+
8+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
9+
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ include "common.names.fullname" . }}'
10+
11+
export SERVICE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].port}" services {{ include "common.names.fullname" . }})
12+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
13+
echo "http://${SERVICE_IP}:${SERVICE_PORT}"
14+
15+
{{- else if contains "ClusterIP" .Values.service.type }}
16+
17+
export SERVICE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].port}" services {{ include "common.names.fullname" . }})
18+
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "common.names.fullname" . }} ${SERVICE_PORT}:${SERVICE_PORT} &
19+
echo "http://127.0.0.1:${SERVICE_PORT}"
20+
21+
{{- else if contains "NodePort" .Values.service.type }}
22+
23+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.names.fullname" . }})
24+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
25+
echo "http://${NODE_IP}:${NODE_PORT}"
26+
27+
{{- end }}
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "acapy.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create URL based on hostname and TLS status
10+
*/}}
11+
{{- define "acapy.agent.url" -}}
12+
{{- if .Values.ingress.agent.tls -}}
13+
{{- printf "https://%s" (include "acapy.host" .) }}
14+
{{- else -}}
15+
{{- printf "http://%s" (include "acapy.host" .) }}
16+
{{- end -}}
17+
{{- end }}
18+
19+
{{/*
20+
Create Websockets URL based on hostname and TLS status
21+
*/}}
22+
{{- define "acapy.agent.wsUrl" -}}
23+
{{- if .Values.ingress.agent.tls -}}
24+
{{- printf "wss://%s" (include "acapy.host" .) }}
25+
{{- else -}}
26+
{{- printf "ws://%s" (include "acapy.host" .) }}
27+
{{- end -}}
28+
{{- end }}
29+
30+
{{/*
31+
generate hosts if not overriden
32+
*/}}
33+
{{- define "acapy.host" -}}
34+
{{- if .Values.ingress.agent.enabled -}}
35+
{{ .Values.ingress.agent.hostname }}
36+
{{- else -}}
37+
{{ .Values.agentUrl }}
38+
{{- end -}}
39+
{{- end -}}
40+
41+
{{/*
42+
Returns a secret if it already in Kubernetes, otherwise it creates
43+
it randomly.
44+
45+
Usage:
46+
{{ include "getOrGeneratePass" (dict "Namespace" .Release.Namespace "Kind" "Secret" "Name" (include "acapy.databaseSecretName" .) "Key" "postgres-password" "Length" 32) }}
47+
48+
*/}}
49+
{{- define "getOrGeneratePass" }}
50+
{{- $len := (default 16 .Length) | int -}}
51+
{{- $obj := (lookup "v1" .Kind .Namespace .Name).data -}}
52+
{{- if $obj }}
53+
{{- index $obj .Key -}}
54+
{{- else if (eq (lower .Kind) "secret") -}}
55+
{{- randAlphaNum $len | b64enc -}}
56+
{{- else -}}
57+
{{- randAlphaNum $len -}}
58+
{{- end -}}
59+
{{- end }}
60+
61+
{{/*
62+
Create a default fully qualified postgresql name.
63+
*/}}
64+
{{- define "acapy.database.secretName" -}}
65+
{{- if .Values.walletStorageCredentials.existingSecret -}}
66+
{{- .Values.walletStorageCredentials.existingSecret -}}
67+
{{- else -}}
68+
{{ printf "%s-postgresql" (include "common.names.fullname" .) }}
69+
{{- end -}}
70+
{{- end -}}
71+
72+
{{/*
73+
Create a default fully qualified app name for the postgres requirement.
74+
*/}}
75+
{{- define "global.postgresql.fullname" -}}
76+
{{- if .Values.postgresql.fullnameOverride }}
77+
{{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" }}
78+
{{- else }}
79+
{{- $postgresContext := dict "Values" .Values.postgresql "Release" .Release "Chart" (dict "Name" "postgresql") -}}
80+
{{ template "postgresql.v1.primary.fullname" $postgresContext }}
81+
{{- end -}}
82+
{{- end -}}
83+
84+
{{/*
85+
Generate acapy wallet storage config
86+
*/}}
87+
{{- define "acapy.walletStorageConfig" -}}
88+
{{- if .Values.walletStorageConfig.json -}}
89+
{{- .Values.walletStorageConfig.json -}}
90+
{{- else if .Values.walletStorageConfig.url -}}
91+
'{"url":"{{ .Values.walletStorageConfig.url }}","max_connections":"{{ .Values.walletStorageConfig.max_connection | default 10 }}", "wallet_scheme":"{{ .Values.walletStorageConfig.wallet_scheme }}"}'
92+
{{- else if .Values.postgresql.enabled -}}
93+
'{"url":"{{ include "global.postgresql.fullname" . }}:{{ .Values.postgresql.primary.service.ports.postgresql }}","max_connections":"{{ .Values.walletStorageConfig.max_connections }}","wallet_scheme":"{{ .Values.walletStorageConfig.wallet_scheme }}"}'
94+
{{- else -}}
95+
''
96+
{{ end }}
97+
{{- end -}}
98+
99+
{{/*
100+
Generate acapy wallet storage credentials
101+
*/}}
102+
{{- define "acapy.walletStorageCredentials" -}}
103+
{{- if .Values.walletStorageCredentials.json -}}
104+
{{- .Values.walletStorageCredentials.json -}}
105+
{{- else if .Values.postgresql.enabled -}}
106+
'{"account":"{{ .Values.postgresql.auth.username }}","password":"$(POSTGRES_PASSWORD)","admin_account":"{{ .Values.walletStorageCredentials.admin_account }}","admin_password":"$(POSTGRES_POSTGRES_PASSWORD)"}'
107+
{{- else -}}
108+
'{"account":"{{ .Values.walletStorageCredentials.account | default "acapy" }}","password":"$(POSTGRES_PASSWORD)","admin_account":"{{ .Values.walletStorageCredentials.admin_account }}","admin_password":"$(POSTGRES_POSTGRES_PASSWORD)"}'
109+
{{- end -}}
110+
{{- end -}}
111+
112+
{{/*
113+
Create chart name and version as used by the chart label.
114+
*/}}
115+
{{- define "acapy.chart" -}}
116+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
117+
{{- end }}
118+
119+
{{/*
120+
Common labels
121+
*/}}
122+
{{- define "acapy.labels" -}}
123+
helm.sh/chart: {{ include "acapy.chart" . }}
124+
{{ include "acapy.selectorLabels" . }}
125+
{{- if .Chart.AppVersion }}
126+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
127+
{{- end }}
128+
app.kubernetes.io/managed-by: {{ .Release.Service }}
129+
{{- end }}
130+
131+
{{/*
132+
Selector labels
133+
*/}}
134+
{{- define "acapy.selectorLabels" -}}
135+
app.kubernetes.io/name: {{ include "acapy.name" . }}
136+
app.kubernetes.io/instance: {{ .Release.Name }}
137+
{{- end }}
138+
139+
{{/*
140+
Return the proper Docker Image Registry Secret Names
141+
*/}}
142+
{{- define "acapy.imagePullSecrets" -}}
143+
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image) "global" .Values.global) -}}
144+
{{- end -}}
145+
146+
{{/*
147+
Create the name of the service account to use
148+
*/}}
149+
{{- define "acapy.serviceAccountName" -}}
150+
{{- if .Values.serviceAccount.create -}}
151+
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
152+
{{- else -}}
153+
{{ default "default" .Values.serviceAccount.name }}
154+
{{- end -}}
155+
{{- end -}}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{ $secretName := printf "%s-api" (include "common.names.fullname" .) }}
2+
{{ $adminApiKey := include "getOrGeneratePass" (dict "Namespace" .Release.Namespace "Kind" "Secret" "Name" $secretName "Key" "adminApiKey" "Length" 32) }}
3+
{{ $walletKey := include "getOrGeneratePass" (dict "Namespace" .Release.Namespace "Kind" "Secret" "Name" $secretName "Key" "walletKey" "Length" 32) }}
4+
apiVersion: v1
5+
kind: Secret
6+
metadata:
7+
annotations:
8+
helm.sh/resource-policy: keep
9+
{{- if .Values.commonAnnotations }}
10+
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
11+
{{- end }}
12+
name: {{ printf "%s-api" (include "common.names.fullname" .) }}
13+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
14+
app.kubernetes.io/component: agent
15+
namespace: {{ .Release.Namespace }}
16+
type: Opaque
17+
data:
18+
{{- if not (index .Values "argfile.yml" "admin-insecure-mode") }}
19+
adminApiKey: {{ $adminApiKey }}
20+
{{- end }}
21+
walletKey: {{ $walletKey }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ printf "%s-config" (include "common.names.fullname" .) }}
5+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
6+
app.kubernetes.io/component: agent0
7+
{{- if .Values.commonAnnotations }}
8+
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
9+
{{- end }}
10+
data:
11+
argfile.yml: |
12+
label: '{{ include "common.names.fullname" . }}'
13+
{{- include "common.tplvalues.render" ( dict "value" (index .Values "argfile.yml") "context" $) | nindent 4 }}
14+
{{- if index .Values "ledgers.yml" }}
15+
ledgers.yml: |
16+
{{- include "common.tplvalues.render" ( dict "value" (index .Values "ledgers.yml") "context" $) | nindent 4 }}
17+
{{- end }}
18+
{{- if index .Values "plugin-config.yml" }}
19+
plugin-config.yml: |
20+
{{- include "common.tplvalues.render" ( dict "value" (index .Values "plugin-config.yml") "context" $) | nindent 4 }}
21+
{{- end }}

0 commit comments

Comments
 (0)