Skip to content

Commit

Permalink
ci(helm): add helpers and secret
Browse files Browse the repository at this point in the history
  • Loading branch information
brucetony committed Apr 23, 2024
1 parent 6e85791 commit 869cdf6
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 9 deletions.
2 changes: 1 addition & 1 deletion k8s/helm/hub-adapter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: flame-hub-adapter
name: flame-node-hub-adapter
description: A Helm chart for the FLAME Hub Adapter API Gateway

# A chart can be either an 'application' or a 'library' chart.
Expand Down
43 changes: 43 additions & 0 deletions k8s/helm/hub-adapter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{/*
Return the Keycloak endpoint
*/}}
{{- define "adapter.keycloak.endpoint" -}}
{{- if .Values.env.IDP_URL -}}
{{- .Values.env.IDP_URL -}}
{{- else -}}
{{- printf "http://%s-keycloak-headless:8080" .Release.Name -}}
{{- end -}}
{{- end -}}

{{/*
Return the Results service endpoint
*/}}
{{- define "adapter.results.endpoint" -}}
{{- if .Values.env.RESULTS_SERVICE_URL -}}
{{- .Values.env.RESULTS_SERVICE_URL -}}
{{- else -}}
{{- printf "http://%s-node-result-service:8080" .Release.Name -}}
{{- end -}}
{{- end -}}

{{/*
Return the Kong admin service endpoint
*/}}
{{- define "adapter.kong.endpoint" -}}
{{- if .Values.env.KONG_ADMIN_SERVICE_URL -}}
{{- .Values.env.KONG_ADMIN_SERVICE_URL -}}
{{- else -}}
{{- printf "http://%s-kong-service:8000" .Release.Name -}}
{{- end -}}
{{- end -}}

{{/*
Return the pod orchestrator endpoint
*/}}
{{- define "adapter.po.endpoint" -}}
{{- if .Values.env.PODORC_SERVICE_URL -}}
{{- .Values.env.PODORC_SERVICE_URL -}}
{{- else -}}
{{- printf "http://%s-po-service:8000" .Release.Name -}}
{{- end -}}
{{- end -}}
13 changes: 7 additions & 6 deletions k8s/helm/hub-adapter/templates/hub-adapter-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ spec:
- containerPort: 5000
name: healthcp
readinessProbe:
initialDelaySeconds: 15
httpGet:
path: /healthz
port: healthcp
Expand All @@ -34,17 +35,17 @@ spec:
valueFrom:
secretKeyRef:
name: hub-adapter-keycloak-secret
key: kcsecret
key: keycloak
- name: IDP_URL
value: {{ .Values.env.IDP_URL | default "http://keycloak-service:8080" | quote }} # To be replaced
value: {{ include "adapter.keycloak.endpoint" . }}
- name: IDP_REALM
value: {{ .Values.env.IDP_REALM | default "flame" | quote }} # To be replaced
- name: RESULTS_SERVICE_URL
value: {{ .Values.env.RESULTS_SERVICE_URL | default "http://node-result-service:8080" | quote }} # To be properly filled in
value: {{ include "adapter.results.endpoint" . }}
- name: PODORC_SERVICE_URL
value: {{ .Values.env.PODORC_SERVICE_URL | default "http://po-service:8000" | quote }} # To be properly filled in
value: {{ include "adapter.po.endpoint" . }}
- name: KONG_ADMIN_SERVICE_URL
value: {{ .Values.env.KONG_ADMIN_SERVICE_URL | default "http://kong-service:8000" | quote }} # To be properly filled in
value: {{ include "adapter.kong.endpoint" . }}
- name: HUB_SERVICE_URL
value: {{ .Values.env.HUB_SERVICE_URL | default "https://privateaim.net/core" | quote }}
- name: HUB_AUTH_SERVICE_URL
Expand All @@ -59,4 +60,4 @@ spec:
port: healthcp
failureThreshold: 3
periodSeconds: 10
initialDelaySeconds: 30
initialDelaySeconds: 60
6 changes: 4 additions & 2 deletions k8s/helm/hub-adapter/templates/hub-adapter-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ apiVersion: v1
kind: Secret
metadata:
name: hub-adapter-keycloak-secret
stringData:
kcsecret: {{ randAlphaNum 24 | b64enc | quote }}
# stringData:
# kcsecret: {{ randAlphaNum 24 | b64enc | quote }}
data:
keycloak: cFR2THJCS3V5MHZ4cnV2VXByd3NYcEV0dzg0ZEROOUM= # Same as hardcoded secret in keycloak init realm

0 comments on commit 869cdf6

Please sign in to comment.