Skip to content

Commit aa11eb0

Browse files
rename oauth2 to xoauth2, and use enable option in manager-role, manager-binding
1 parent ecf3935 commit aa11eb0

File tree

7 files changed

+39
-35
lines changed

7 files changed

+39
-35
lines changed

gateway/templates/configmap-base.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ data:
5757
{{- if eq .Values.additionalConfig.dkimSigning.enabled true }}
5858
GATEWAY_DKIM_DOMAINS: {{ .Values.additionalConfig.dkimSigning.selector }}._domainkey.{{ .Values.standardConfig.primaryMailingDomain }}
5959
{{- end }}
60-
{{- if .Values.additionalConfig.oauth2.enabled }}
60+
{{- if .Values.additionalConfig.xoauth2.enabled }}
6161
GATEWAY_SMTP_SASL_ENABLED_XOAUTH2: "1"
62-
GATEWAY_OAUTH2_CLIENT_ID: {{ .Values.additionalConfig.oauth2.clientId }}
62+
GATEWAY_XOAUTH2_CLIENT_ID: {{ .Values.additionalConfig.xoauth2.clientId }}
6363
{{- end }}
6464

6565

gateway/templates/oauth2-secret.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

gateway/templates/oauth-secret-manager-binding.yaml renamed to gateway/templates/xoauth2-secret-manager-binding.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
{{- if .Values.additionalConfig.xoauth2.enabled }}
12
apiVersion: rbac.authorization.k8s.io/v1
23
kind: RoleBinding
34
metadata:
4-
name: {{ .Release.Name }}-oauth-secret-manager-binding
5+
name: {{ .Release.Name }}-xoauth2-secret-manager-binding
56
namespace: {{ .Release.Namespace }}
67
labels:
78
app.kubernetes.io/name: {{ .Release.Name }}
@@ -13,4 +14,5 @@ subjects:
1314
roleRef:
1415
apiGroup: rbac.authorization.k8s.io
1516
kind: Role
16-
name: {{ .Release.Name }}-oauth-secret-manager-role
17+
name: {{ .Release.Name }}-xoauth2-secret-manager-role
18+
{{- end }}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
{{- if .Values.additionalConfig.xoauth2.enabled }}
12
apiVersion: rbac.authorization.k8s.io/v1
23
kind: Role
34
metadata:
4-
name: {{ .Release.Name }}-oauth-secret-manager-role
5+
name: {{ .Release.Name }}-xoauth2-secret-manager-role
56
namespace: {{ .Release.Namespace }}
67
labels:
78
app.kubernetes.io/name: {{ .Release.Name }}
@@ -10,3 +11,4 @@ rules:
1011
- apiGroups: [""]
1112
resources: ["secrets"]
1213
verbs: ["get", "update", "patch"]
14+
{{- end }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if .Values.additionalConfig.xoauth2.enabled }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ .Release.Name }}-xoauth2-secret
6+
labels:
7+
app.kubernetes.io/name: {{ .Release.Name }}
8+
app.kubernetes.io/component: gateway
9+
type: Opaque
10+
data:
11+
xoauth2-refresh-token: {{ .Values.appSecrets.xoauth2.refreshToken | b64enc | quote }}
12+
xoauth2-client-secret: {{ .Values.appSecrets.xoauth2.clientSecret | b64enc | quote }}
13+
xoauth2-access-token: {{ .Values.appSecrets.xoauth2.accessToken | b64enc | quote }}
14+
{{- end }}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{{- if .Values.additionalConfig.oauth2.enabled }}
1+
{{- if .Values.additionalConfig.xoauth2.enabled }}
22
apiVersion: batch/v1
33
kind: CronJob
44
metadata:
5-
name: {{ .Release.Name }}-oauth2-token-refresher
5+
name: {{ .Release.Name }}-xoauth2-token-refresher
66
labels:
77
app.kubernetes.io/name: {{ .Release.Name }}
88
app.kubernetes.io/component: gateway
@@ -14,17 +14,17 @@ spec:
1414
spec:
1515
serviceAccountName: {{ include "gateway.serviceAccountName" . }}
1616
containers:
17-
- name: oauth2-token-refresher
17+
- name: xoauth2-token-refresher
1818
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
1919
command:
2020
- "/bin/sh"
2121
- "-c"
2222
- |
2323
echo "Starting Token Refresher"
24-
java -cp "/usr/local/smtp-proxy/smtp-proxy/target/lib/smtp-proxy-{{ .Values.appVersion }}.jar:/usr/local/smtp-proxy/smtp-proxy/target/lib/*" com.virtru.gateway.smtpproxy.oauth2.TokenRefresher
24+
java -cp "/usr/local/smtp-proxy/smtp-proxy/target/lib/smtp-proxy-{{ .Values.appVersion }}.jar:/usr/local/smtp-proxy/smtp-proxy/target/lib/*" com.virtru.gateway.smtpproxy.xoauth2.TokenRefresher
2525
echo "Token Refresher Finished"
2626
volumeMounts:
27-
- mountPath: "/etc/oauth2"
27+
- mountPath: "/etc/xoauth2"
2828
readOnly: true
2929
name: oauth2-secret-volume
3030
env:
@@ -33,12 +33,12 @@ spec:
3333
fieldRef:
3434
fieldPath: metadata.namespace
3535
- name: KUBE_SECRET_NAME
36-
value: "{{ .Release.Name }}-oauth2-secret"
37-
- name: GATEWAY_OAUTH2_CLIENT_ID
38-
value: "{{ .Values.additionalConfig.oauth2.clientId }}"
36+
value: "{{ .Release.Name }}-xoauth2-secret"
37+
- name: GATEWAY_XOAUTH2_CLIENT_ID
38+
value: "{{ .Values.additionalConfig.xoauth2.clientId }}"
3939
volumes:
40-
- name: oauth2-secret-volume
40+
- name: xoauth2-secret-volume
4141
secret:
42-
secretName: {{ .Release.Name }}-oauth2-secret
42+
secretName: {{ .Release.Name }}-xoauth2-secret
4343
restartPolicy: OnFailure
4444
{{- end }}

gateway/values.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ appSecrets:
135135
<dkim-private-key>
136136
abac:
137137
oidcClientSecret: <oidc-client-secret> # The client secret used when authenticating against platform services.
138-
oauth2:
139-
clientSecret: <oauth2-client-secret>
140-
refreshToken: <oauth2-refresh-token>
141-
accessToken: <oauth2-access-token
138+
xoauth2:
139+
clientSecret: <xoauth2-client-secret>
140+
refreshToken: <xoauth2-refresh-token>
141+
accessToken: <xoauth2-access-token
142142

143143
additionalConfig:
144144
saslAuth:
@@ -180,9 +180,9 @@ additionalConfig:
180180
dkimSigning:
181181
enabled: false
182182
selector: gw
183-
oauth2:
183+
xoauth2:
184184
enabled: false
185-
clientId: <oauth2-client-id>
185+
clientId: <xoauth2-client-id>
186186

187187
istioIngress:
188188
enabled: false

0 commit comments

Comments
 (0)