Skip to content

Commit a641c36

Browse files
author
Your Name
committed
app-auth
1 parent e755635 commit a641c36

File tree

12 files changed

+249
-3
lines changed

12 files changed

+249
-3
lines changed

charts/opencloud-full/templates/_common/_tplvalues.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Adds the app names to the scope and set the name of the app based on the input p
7777
{{- $_ := set .scope "appNameAppRegistry" "appregistry" -}}
7878
{{- $_ := set .scope "appNameAudit" "audit" -}}
7979
{{- $_ := set .scope "appNameAuthMachine" "authmachine" -}}
80+
{{- $_ := set .scope "appNameAuthApp" "authapp" -}}
8081
{{- $_ := set .scope "appNameAuthService" "authservice" -}}
8182
{{- $_ := set .scope "appNameAntivirus" "antivirus" -}}
8283
{{- $_ := set .scope "appNameClientlog" "clientlog" -}}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{- if not .Values.configRefs.authServiceConfigRef }}
2+
{{- $params := (dict)}}
3+
{{- $_ := set $params "service-account-id" (uuidv4) }}
4+
{{- include "oc.configMap" (dict "scope" . "name" "auth-service" "params" $params)}}
5+
{{- end }}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{{- include "oc.basicServiceTemplates" (dict "scope" . "appName" "appNameAuthService" "appNameSuffix" "") -}}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
{{ include "oc.metadata" . }}
5+
spec:
6+
{{- include "oc.selector" . | nindent 2 }}
7+
{{- if and (not .Values.autoscaling.enabled) (.Values.replicas) }}
8+
replicas: {{ .Values.replicas }}
9+
{{- end }}
10+
{{- include "oc.deploymentStrategy" . | nindent 2 }}
11+
template:
12+
{{- include "oc.templateMetadata" (dict "scope" $ "configCheck" false) | nindent 4 }}
13+
spec:
14+
{{- include "oc.affinity" $ | nindent 6 }}
15+
{{- include "oc.securityContextAndtopologySpreadConstraints" . | nindent 6 }}
16+
{{- include "oc.priorityClassName" $.priorityClassName | nindent 6 }}
17+
{{- include "oc.hostAliases" $ | nindent 6 }}
18+
nodeSelector: {{ toYaml $.nodeSelector | nindent 8 }}
19+
containers:
20+
- name: {{ .appName }}
21+
{{- include "oc.image" $ | nindent 10 }}
22+
command: ["opencloud"]
23+
args: ["auth-service", "server"]
24+
{{- include "oc.containerSecurityContext" . | nindent 10 }}
25+
env:
26+
{{- include "oc.serviceRegistry" . | nindent 12 }}
27+
28+
- name: AUTH_SERVICE_LOG_COLOR
29+
value: {{ .Values.logging.color | quote }}
30+
- name: AUTH_SERVICE_LOG_LEVEL
31+
value: {{ .Values.logging.level | quote }}
32+
- name: AUTH_SERVICE_LOG_PRETTY
33+
value: {{ .Values.logging.pretty | quote }}
34+
35+
- name: AUTH_SERVICE_TRACING_ENABLED
36+
value: "{{ .Values.tracing.enabled }}"
37+
- name: AUTH_SERVICE_TRACING_TYPE
38+
value: {{ .Values.tracing.type | quote }}
39+
- name: AUTH_SERVICE_TRACING_ENDPOINT
40+
value: {{ .Values.tracing.endpoint | quote }}
41+
- name: AUTH_SERVICE_TRACING_COLLECTOR
42+
value: {{ .Values.tracing.collector | quote }}
43+
44+
- name: AUTH_SERVICE_DEBUG_PPROF
45+
value: {{ .Values.debug.profiling | quote }}
46+
47+
- name: AUTH_SERVICE_GRPC_ADDR
48+
value: 0.0.0.0:9616
49+
- name: AUTH_SERVICE_DEBUG_ADDR
50+
value: 0.0.0.0:9617
51+
52+
- name: AUTH_SERVICE_JWT_SECRET
53+
valueFrom:
54+
secretKeyRef:
55+
name: {{ include "secrets.jwtSecret" . }}
56+
key: jwt-secret
57+
58+
- name: AUTH_SERVICE_SERVICE_ACCOUNT_ID
59+
valueFrom:
60+
configMapKeyRef:
61+
name: {{ include "config.authService" . }}
62+
key: service-account-id
63+
- name: AUTH_SERVICE_SERVICE_ACCOUNT_SECRET
64+
valueFrom:
65+
secretKeyRef:
66+
name: {{ include "secrets.serviceAccountSecret" . }}
67+
key: service-account-secret
68+
69+
{{- include "oc.caEnv" $ | nindent 12}}
70+
71+
{{- include "oc.livenessProbe" . | nindent 10 }}
72+
73+
resources: {{ toYaml .resources | nindent 12 }}
74+
75+
ports:
76+
- name: grpc
77+
containerPort: 9616
78+
- name: metrics-debug
79+
containerPort: 9617
80+
81+
volumeMounts:
82+
- name: tmp-volume
83+
mountPath: /tmp
84+
{{- include "oc.caPath" $ | nindent 12}}
85+
86+
{{- include "oc.imagePullSecrets" $ | nindent 6 }}
87+
volumes:
88+
- name: tmp-volume
89+
emptyDir: {}
90+
{{- include "oc.caVolume" $ | nindent 8}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{- include "oc.basicServiceTemplates" (dict "scope" . "appName" "appNameAuthService" "appNameSuffix" "") -}}
2+
{{- $_ := set . "autoscaling" (default (default (dict) .Values.autoscaling) .Values.services.authservice.autoscaling) -}}
3+
{{ include "oc.hpa" . }}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{- include "oc.basicServiceTemplates" (dict "scope" . "appName" "appNameAuthService" "appNameSuffix" "") -}}
2+
{{ include "oc.pdb" . }}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{- if not .Values.secretRefs.serviceAccountSecretRef }}
2+
{{- $params := (dict)}}
3+
{{- $_ := set $params "service-account-secret" (randAlphaNum 30) }}
4+
{{- include "oc.secret" (dict "scope" . "name" "service-account-secret" "params" $params)}}
5+
{{- end }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- include "oc.basicServiceTemplates" (dict "scope" . "appName" "appNameAuthService" "appNameSuffix" "") -}}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ .appName }}
6+
namespace: {{ template "oc.namespace" . }}
7+
labels:
8+
app: {{ .appName }}
9+
oc-metrics: enabled
10+
{{- include "oc.labels" . | nindent 4 }}
11+
spec:
12+
selector:
13+
app: {{ .appName }}
14+
ports:
15+
- name: grpc
16+
port: 9616
17+
protocol: TCP
18+
appProtocol: {{ .Values.service.appProtocol.grpc | quote}}
19+
- name: metrics-debug
20+
port: 9617
21+
protocol: TCP
22+
appProtocol: {{ .Values.service.appProtocol.http | quote}}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{{- include "oc.basicServiceTemplates" (dict "scope" . "appName" "appNameAuthApp" "appNameSuffix" "") -}}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
{{ include "oc.metadata" . }}
5+
spec:
6+
{{- include "oc.selector" . | nindent 2 }}
7+
{{- if and (not .Values.autoscaling.enabled) (.Values.replicas) }}
8+
replicas: {{ .Values.replicas }}
9+
{{- end }}
10+
{{- include "oc.deploymentStrategy" . | nindent 2 }}
11+
template:
12+
{{- include "oc.templateMetadata" (dict "scope" $ "configCheck" false) | nindent 4 }}
13+
spec:
14+
{{- include "oc.affinity" $ | nindent 6 }}
15+
{{- include "oc.securityContextAndtopologySpreadConstraints" . | nindent 6 }}
16+
{{- include "oc.priorityClassName" $.priorityClassName | nindent 6 }}
17+
{{- include "oc.hostAliases" $ | nindent 6 }}
18+
nodeSelector: {{ toYaml $.nodeSelector | nindent 8 }}
19+
containers:
20+
- name: {{ .appName }}
21+
{{- include "oc.image" $ | nindent 10 }}
22+
command: ["opencloud"]
23+
args: ["auth-app", "server"]
24+
{{- include "oc.containerSecurityContext" . | nindent 10 }}
25+
env:
26+
{{- include "oc.serviceRegistry" . | nindent 12 }}
27+
28+
- name: AUTH_APP_LOG_COLOR
29+
value: {{ .Values.logging.color | quote }}
30+
- name: AUTH_APP_LOG_LEVEL
31+
value: {{ .Values.logging.level | quote }}
32+
- name: AUTH_APP_LOG_PRETTY
33+
value: {{ .Values.logging.pretty | quote }}
34+
35+
- name: AUTH_APP_TRACING_ENABLED
36+
value: "{{ .Values.tracing.enabled }}"
37+
- name: AUTH_APP_TRACING_TYPE
38+
value: {{ .Values.tracing.type | quote }}
39+
- name: AUTH_APP_TRACING_ENDPOINT
40+
value: {{ .Values.tracing.endpoint | quote }}
41+
- name: AUTH_APP_TRACING_COLLECTOR
42+
value: {{ .Values.tracing.collector | quote }}
43+
44+
- name: AUTH_APP_DEBUG_PPROF
45+
value: {{ .Values.debug.profiling | quote }}
46+
47+
- name: AUTH_APP_GRPC_ADDR
48+
value: 127.0.0.1:9246
49+
- name: AUTH_APP_DEBUG_ADDR
50+
value: 127.0.0.1:9245
51+
- name: AUTH_APP_HTTP_ADDR
52+
value: 127.0.0.1:9247
53+
- name: AUTH_APP_HTTP_ROOT
54+
value: /
55+
56+
- name: AUTH_APP_JWT_SECRET
57+
valueFrom:
58+
secretKeyRef:
59+
name: {{ include "secrets.jwtSecret" . }}
60+
key: jwt-secret
61+
62+
63+
64+
{{- include "oc.caEnv" $ | nindent 12}}
65+
66+
{{- include "oc.livenessProbe" . | nindent 10 }}
67+
68+
resources: {{ toYaml .resources | nindent 12 }}
69+
70+
ports:
71+
- name: grpc
72+
containerPort: 9246
73+
- name: http
74+
containerPort: 9247
75+
- name: metrics-debug
76+
containerPort: 9245
77+
78+
volumeMounts:
79+
- name: tmp-volume
80+
mountPath: /tmp
81+
{{- include "oc.caPath" $ | nindent 12}}
82+
83+
{{- include "oc.imagePullSecrets" $ | nindent 6 }}
84+
volumes:
85+
- name: tmp-volume
86+
emptyDir: {}
87+
{{- include "oc.caVolume" $ | nindent 8}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{- include "oc.basicServiceTemplates" (dict "scope" . "appName" "appNameAuthApp" "appNameSuffix" "") -}}
2+
{{- $_ := set . "autoscaling" (default (default (dict) .Values.autoscaling) .Values.services.authmachine.autoscaling) -}}
3+
{{ include "oc.hpa" . }}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{- include "oc.basicServiceTemplates" (dict "scope" . "appName" "appNameAuthApp" "appNameSuffix" "") -}}
2+
{{ include "oc.pdb" . }}

0 commit comments

Comments
 (0)