Skip to content

Commit 3bdfc8e

Browse files
Merge pull request #15 from tahzeer/4.0
[G2P-4188] Fix existing and add new charts for bene-protal-api
2 parents cdf080b + bd80f92 commit 3bdfc8e

File tree

14 files changed

+499
-23
lines changed

14 files changed

+499
-23
lines changed

charts/openg2p-pbms/questions.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,33 @@ questions:
6060
group: Background Task Settings
6161
show_if: "openg2p-pbms-bg-task-celery-workers.enabled=true"
6262

63+
# Portal API Settings
64+
- variable: staffPortalApi.enabled
65+
description: Enable Staff Portal API component
66+
type: boolean
67+
label: Enable Staff Portal API
68+
group: Portal API Settings
69+
70+
- variable: benePortalApi.enabled
71+
description: Enable Bene Portal API component
72+
type: boolean
73+
label: Enable Bene Portal API
74+
group: Portal API Settings
75+
76+
- variable: benePortalApi.envVars.COMMON_AUTH_DEFAULT_ISSUERS
77+
description: Default list of OIDC issuers for Bene Portal API
78+
type: string
79+
label: Bene Portal API Default Issuers
80+
group: Portal API Settings
81+
show_if: "benePortalApi.enabled=true"
82+
83+
- variable: benePortalApi.envVars.COMMON_AUTH_DEFAULT_JWKS_URLS
84+
description: Default list of JWKS URLs for Bene Portal API
85+
type: string
86+
label: Bene Portal API Default JWKS URLs
87+
group: Portal API Settings
88+
show_if: "benePortalApi.enabled=true"
89+
6390
# Registry settings
6491
- variable: global.registryDB
6592
description: Name of the Registry DB in PostgreSQL
@@ -85,4 +112,6 @@ questions:
85112
label: Registry DB Secret Key with User Password
86113
group: Registry
87114

115+
116+
88117
# End of main PBMS/values.yaml-driven questions.

charts/openg2p-pbms/templates/_helper.tpl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,32 @@ Render Env values section for staff-portal-api
192192
{{- include "pbms.baseEnvVars" (dict "envVars" $envVars "context" $) }}
193193
{{- end -}}
194194

195+
{{/*
196+
Templates for openg2p-pbms-bene-portal-api
197+
*/}}
195198

199+
{{/*
200+
Create the name of the service account to use
201+
*/}}
202+
{{- define "pbms.bene-portal-api.serviceAccountName" -}}
203+
{{- if .Values.benePortalApi.serviceAccount.create -}}
204+
{{ default (include "common.names.fullname" .) .Values.benePortalApi.serviceAccount.name }}
205+
{{- else -}}
206+
{{ default "default" .Values.benePortalApi.serviceAccount.name }}
207+
{{- end -}}
208+
{{- end -}}
196209

210+
{{/*
211+
Return the proper Docker Image Registry Secret Names
212+
*/}}
213+
{{- define "pbms.bene-portal-api.imagePullSecrets" -}}
214+
{{- include "common.images.pullSecrets" (dict "images" (list .Values.benePortalApi.image .Values.benePortalApi.postgresCheckerInit.image) "global" .Values.global) -}}
215+
{{- end -}}
216+
217+
{{/*
218+
Render Env values section for bene-portal-api
219+
*/}}
220+
{{- define "pbms.bene-portal-api.envVars" -}}
221+
{{- $envVars := merge (deepCopy .Values.benePortalApi.envVars) (deepCopy .Values.benePortalApi.envVarsFrom) -}}
222+
{{- include "pbms.baseEnvVars" (dict "envVars" $envVars "context" $) }}
223+
{{- end -}}

charts/openg2p-pbms/templates/beat-producers/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ spec:
1515
{{- end }}
1616
selector:
1717
matchLabels: {{- include "common.labels.matchLabels" (dict "customLabels" .podLabels "context" $) | nindent 6 }}
18+
app.kubernetes.io/component: celery-beat-producer
1819
template:
1920
metadata:
2021
labels: {{- include "common.labels.standard" (dict "customLabels" .podLabels "context" $) | nindent 8 }}
22+
app.kubernetes.io/component: celery-beat-producer
2123
{{- if .podAnnotations }}
2224
annotations: {{- include "common.tplvalues.render" (dict "value" .podAnnotations "context" $) | nindent 8 }}
2325
{{- end }}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{{- with .Values.benePortalApi }}
2+
{{- if .enabled }}
3+
apiVersion: {{ include "common.capabilities.deployment.apiVersion" $ }}
4+
kind: Deployment
5+
metadata:
6+
name: {{ include "common.names.fullname" $ }}-bene-portal-api
7+
labels: {{- include "common.labels.standard" (dict "customLabels" .commonLabels "context" $) | nindent 4 }}
8+
{{- if .commonAnnotations }}
9+
annotations: {{- include "common.tplvalues.render" ( dict "value" .commonAnnotations "context" $ ) | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
replicas: {{ .replicaCount }}
13+
{{- if .updateStrategy }}
14+
strategy: {{- include "common.tplvalues.render" (dict "value" .updateStrategy "context" $) | nindent 4 }}
15+
{{- end }}
16+
selector:
17+
matchLabels: {{- include "common.labels.matchLabels" (dict "customLabels" .podLabels "context" $) | nindent 6 }}
18+
app.kubernetes.io/component: bene-portal-api
19+
template:
20+
metadata:
21+
labels: {{- include "common.labels.standard" (dict "customLabels" .podLabels "context" $) | nindent 8 }}
22+
app.kubernetes.io/component: bene-portal-api
23+
{{- if .podAnnotations }}
24+
annotations: {{- include "common.tplvalues.render" (dict "value" .podAnnotations "context" $) | nindent 8 }}
25+
{{- end }}
26+
spec:
27+
serviceAccountName: {{ include "pbms.bene-portal-api.serviceAccountName" $ }}
28+
{{- include "pbms.bene-portal-api.imagePullSecrets" $ | nindent 6 }}
29+
{{- if .hostAliases }}
30+
hostAliases: {{- include "common.tplvalues.render" (dict "value" .hostAliases "context" $) | nindent 8 }}
31+
{{- end }}
32+
{{- if .affinity }}
33+
affinity: {{- include "common.tplvalues.render" ( dict "value" .affinity "context" $) | nindent 8 }}
34+
{{- else }}
35+
affinity:
36+
podAffinity: {{- include "common.affinities.pods" (dict "type" .podAffinityPreset "context" $) | nindent 10 }}
37+
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .podAntiAffinityPreset "context" $) | nindent 10 }}
38+
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .nodeAffinityPreset.type "key" .nodeAffinityPreset.key "values" .nodeAffinityPreset.values) | nindent 10 }}
39+
{{- end }}
40+
{{- if .nodeSelector }}
41+
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .nodeSelector "context" $) | nindent 8 }}
42+
{{- end }}
43+
{{- if .tolerations }}
44+
tolerations: {{- include "common.tplvalues.render" (dict "value" .tolerations "context" $) | nindent 8 }}
45+
{{- end }}
46+
{{- if .priorityClassName }}
47+
priorityClassName: {{ .priorityClassName | quote }}
48+
{{- end }}
49+
{{- if .podSecurityContext.enabled }}
50+
securityContext: {{- include "common.tplvalues.render" (dict "value" (omit .podSecurityContext "enabled") "context" $) | nindent 8 }}
51+
{{- end }}
52+
initContainers:
53+
{{- if .postgresCheckerInit.enabled }}
54+
- name: postgres-checker
55+
image: {{ include "common.images.image" (dict "imageRoot" .postgresCheckerInit.image "global" $.Values.global) }}
56+
imagePullPolicy: {{ .postgresCheckerInit.image.pullPolicy }}
57+
command: {{- include "common.tplvalues.render" (dict "value" .postgresCheckerInit.command "context" $) | nindent 12 }}
58+
env: {{- include "pbms.bene-portal-api.envVars" $ | indent 12 }}
59+
{{- end }}
60+
containers:
61+
- name: g2p-pbms-bene-portal-api
62+
image: {{ include "common.images.image" (dict "imageRoot" .image "global" $.Values.global) }}
63+
imagePullPolicy: {{ .image.pullPolicy }}
64+
{{- if .lifecycleHooks }}
65+
lifecycle: {{- include "common.tplvalues.render" (dict "value" .lifecycleHooks "context" $) | nindent 12 }}
66+
{{- end }}
67+
{{- if .containerSecurityContext.enabled }}
68+
securityContext: {{- include "common.tplvalues.render" (dict "value" (omit .containerSecurityContext "enabled") "context" $) | nindent 12 }}
69+
{{- end }}
70+
env: {{- include "pbms.bene-portal-api.envVars" $ | indent 12 }}
71+
ports:
72+
- name: http
73+
containerPort: {{ .containerPort }}
74+
{{- if .resources }}
75+
resources: {{- include "common.tplvalues.render" (dict "value" .resources "context" $) | nindent 12 }}
76+
{{- end }}
77+
{{- if .startupProbe.enabled }}
78+
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .startupProbe "enabled") "context" $) | nindent 12 }}
79+
{{- end }}
80+
{{- if .livenessProbe.enabled }}
81+
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .livenessProbe "enabled") "context" $) | nindent 12 }}
82+
{{- end }}
83+
{{- if .readinessProbe.enabled }}
84+
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .readinessProbe "enabled") "context" $) | nindent 12 }}
85+
{{- end }}
86+
{{- if .sidecars }}
87+
{{- include "common.tplvalues.render" ( dict "value" .sidecars "context" $) | nindent 8 }}
88+
{{- end }}
89+
{{- end }}
90+
{{- end }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{{- with .Values.benePortalApi }}
2+
{{- if and .enabled .istio.enabled .istio.gateway.enabled }}
3+
apiVersion: networking.istio.io/v1beta1
4+
kind: Gateway
5+
metadata:
6+
name: {{ template "common.names.fullname" $ }}-bene-portal-api
7+
labels: {{- include "common.labels.standard" (dict "customLabels" .commonLabels "context" $) | nindent 4 }}
8+
{{- if .commonAnnotations }}
9+
annotations: {{- include "common.tplvalues.render" ( dict "value" .commonAnnotations "context" $ ) | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
selector: {{- include "common.tplvalues.render" ( dict "value" .istio.gateway.ingressController "context" $) | nindent 4 }}
13+
servers:
14+
{{- if .istio.gateway.httpEnabled }}
15+
- port:
16+
name: http2
17+
number: 8080
18+
protocol: HTTP2
19+
hosts:
20+
- {{ default $.Values.global.g2pPbmsBgTaskHostname .istio.gateway.host | quote }}
21+
{{- if .istio.gateway.httpTlsRedirect }}
22+
tls:
23+
httpsRedirect: true
24+
{{- end }}
25+
{{- end }}
26+
{{- if .istio.gateway.httpsEnabled }}
27+
- port:
28+
name: https
29+
number: 8443
30+
protocol: HTTPS
31+
hosts:
32+
- {{ default $.Values.global.g2pPbmsBgTaskHostname .istio.gateway.host | quote }}
33+
tls: {{- include "common.tplvalues.render" (dict "value" (omit .istio.gateway.tls "enabled") "context" $) | nindent 6 }}
34+
{{- end }}
35+
{{- end }}
36+
{{- end }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{{- with .Values.benePortalApi }}
2+
{{- if and .enabled .autoscaling.enabled }}
3+
apiVersion: autoscaling/v2
4+
kind: HorizontalPodAutoscaler
5+
metadata:
6+
name: {{ include "common.names.fullname" $ }}-bene-portal-api
7+
labels: {{- include "common.labels.standard" (dict "customLabels" .commonLabels "context" $) | nindent 4 }}
8+
{{- if .commonAnnotations }}
9+
annotations: {{- include "common.tplvalues.render" ( dict "value" .commonAnnotations "context" $ ) | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
scaleTargetRef:
13+
apiVersion: apps/v1
14+
kind: Deployment
15+
name: {{ include "common.names.fullname" $ }}-bene-portal-api
16+
minReplicas: {{ .autoscaling.minReplicas }}
17+
maxReplicas: {{ .autoscaling.maxReplicas }}
18+
metrics:
19+
{{- if .autoscaling.targetCPUUtilizationPercentage }}
20+
- type: Resource
21+
resource:
22+
name: cpu
23+
target:
24+
type: Utilization
25+
averageUtilization: {{ .autoscaling.targetCPUUtilizationPercentage }}
26+
{{- end }}
27+
{{- if .autoscaling.targetMemoryUtilizationPercentage }}
28+
- type: Resource
29+
resource:
30+
name: memory
31+
target:
32+
type: Utilization
33+
averageUtilization: {{ .autoscaling.targetMemoryUtilizationPercentage }}
34+
{{- end }}
35+
{{- end }}
36+
{{- end }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- with .Values.benePortalApi }}
2+
{{- if .enabled }}
3+
apiVersion: v1
4+
kind: Service
5+
metadata:
6+
name: {{ template "common.names.fullname" $ }}-bene-portal-api
7+
labels: {{- include "common.labels.standard" (dict "customLabels" .commonLabels "context" $) | nindent 4 }}
8+
{{- if .commonAnnotations }}
9+
annotations: {{- include "common.tplvalues.render" ( dict "value" .commonAnnotations "context" $ ) | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
type: {{ .service.type }}
13+
{{- if (or (eq .service.type "LoadBalancer") (eq .service.type "NodePort")) }}
14+
externalTrafficPolicy: {{ .service.externalTrafficPolicy | quote }}
15+
{{- end }}
16+
{{ if eq .service.type "LoadBalancer" }}
17+
loadBalancerSourceRanges: {{ .service.loadBalancerSourceRanges }}
18+
{{ end }}
19+
{{- if (and (eq .service.type "LoadBalancer") (not (empty .service.loadBalancerIP))) }}
20+
loadBalancerIP: {{ .service.loadBalancerIP }}
21+
{{- end }}
22+
ports:
23+
- name: http
24+
port: {{ .service.port }}
25+
protocol: TCP
26+
targetPort: http
27+
selector: {{- include "common.labels.matchLabels" (dict "customLabels" .podLabels "context" $) | nindent 4 }}
28+
app.kubernetes.io/component: bene-portal-api
29+
{{- end }}
30+
{{- end }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- with .Values.benePortalApi }}
2+
{{- if and .enabled .serviceAccount.create }}
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: {{ include "pbms.bene-portal-api.serviceAccountName" $ }}
7+
labels: {{- include "common.labels.standard" (dict "customLabels" .commonLabels "context" $) | nindent 4 }}
8+
{{- if .commonAnnotations }}
9+
annotations: {{- include "common.tplvalues.render" ( dict "value" .commonAnnotations "context" $ ) | nindent 4 }}
10+
{{- end }}
11+
{{- end }}
12+
{{- end }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{{- with .Values.benePortalApi }}
2+
{{- if and .enabled .istio.enabled .istio.virtualservice.enabled }}
3+
apiVersion: networking.istio.io/v1alpha3
4+
kind: VirtualService
5+
metadata:
6+
name: {{ template "common.names.fullname" $ }}-bene-portal-api
7+
labels: {{- include "common.labels.standard" (dict "customLabels" .commonLabels "context" $) | nindent 4 }}
8+
{{- if .commonAnnotations }}
9+
annotations: {{- include "common.tplvalues.render" ( dict "value" .commonAnnotations "context" $ ) | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
hosts:
13+
- {{ include "common.tplvalues.render" (dict "value" (default $.Values.global.g2pPbmsBgTaskHostname .istio.virtualservice.host) "context" $) | quote }}
14+
gateways:
15+
- {{ default (include "common.names.fullname" $) .istio.virtualservice.gateway }}
16+
http:
17+
- headers:
18+
request:
19+
set:
20+
x-forwarded-host: {{ include "common.tplvalues.render" (dict "value" (default $.Values.global.g2pPbmsBgTaskHostname .istio.virtualservice.host) "context" $) | quote }}
21+
x-forwarded-proto: https
22+
match:
23+
- uri:
24+
prefix: {{ include "common.tplvalues.render" (dict "value" .istio.virtualservice.prefix "context" $) }}
25+
{{- if .istio.virtualservice.rewriteUri }}
26+
rewrite:
27+
uri: {{ include "common.tplvalues.render" (dict "value" .istio.virtualservice.rewriteUri "context" $) }}
28+
{{- end }}
29+
route:
30+
- destination:
31+
host: {{ template "common.names.fullname" $ }}-bene-portal-api
32+
port:
33+
number: {{ .service.port }}
34+
{{- end }}
35+
{{- end }}

charts/openg2p-pbms/templates/celery-workers/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ spec:
1515
{{- end }}
1616
selector:
1717
matchLabels: {{- include "common.labels.matchLabels" (dict "customLabels" .podLabels "context" $) | nindent 6 }}
18+
app.kubernetes.io/component: celery-workers
1819
template:
1920
metadata:
2021
labels: {{- include "common.labels.standard" (dict "customLabels" .podLabels "context" $) | nindent 8 }}
22+
app.kubernetes.io/component: celery-workers
2123
{{- if .podAnnotations }}
2224
annotations: {{- include "common.tplvalues.render" (dict "value" .podAnnotations "context" $) | nindent 8 }}
2325
{{- end }}

0 commit comments

Comments
 (0)