Skip to content

Commit a046fe2

Browse files
lijianguoduanhongyi
authored andcommitted
chore(oauth): using passport authentication
1 parent 0ebf74e commit a046fe2

6 files changed

Lines changed: 29 additions & 19 deletions

File tree

charts/controller/templates/_helpers.tpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ env:
142142
{{- end }}
143143
{{- if eq .Values.global.passport_location "on-cluster"}}
144144
- name: "DRYCC_PASSPORT_DOMAIN"
145-
value: drycc-passport.{{ .Values.global.platform_domain }}
145+
value: http://drycc-passport.{{ .Values.global.platform_domain }}
146146
- name: "SOCIAL_AUTH_DRYCC_AUTHORIZATION_URL"
147+
value: "$(DRYCC_PASSPORT_DOMAIN)/oauth/authorize/"
148+
- name: "SOCIAL_AUTH_DRYCC_ACCESS_TOKEN_URL"
147149
value: "$(DRYCC_PASSPORT_DOMAIN)/oauth/token/"
148150
- name: "SOCIAL_AUTH_DRYCC_ACCESS_API_URL"
149151
value: "$(DRYCC_PASSPORT_DOMAIN)/users/"
@@ -153,6 +155,8 @@ env:
153155
value: "$(DRYCC_PASSPORT_DOMAIN)/oauth/.well-known/jwks.json"
154156
- name: "SOCIAL_AUTH_DRYCC_OIDC_ENDPOINT"
155157
value: "$(DRYCC_PASSPORT_DOMAIN)/oauth"
158+
- name: "LOGIN_REDIRECT_URL"
159+
value: "$(DRYCC_PASSPORT_DOMAIN)/login/done/"
156160
- name: SOCIAL_AUTH_DRYCC_CONTROLLER_KEY
157161
valueFrom:
158162
secretKeyRef:

charts/controller/templates/controller-cronjob-hourly.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: batch/v1
22
kind: CronJob
33
metadata:
4-
name: drycc-controller-cronjob-daily
4+
name: drycc-controller-cronjob-hourly
55
labels:
66
heritage: drycc
77
annotations:
@@ -27,5 +27,3 @@ spec:
2727
args:
2828
- python -u /app/manage.py measure_app
2929
{{- include "controller.envs" . | indent 12 }}
30-
{{- include "controller.volumeMounts" . | indent 12 }}
31-
{{- include "controller.volumes" . | indent 10 }}

charts/controller/templates/controller-ingress.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@ spec:
1717
- host: drycc.{{ .Values.global.platform_domain }}
1818
http:
1919
paths:
20-
{{- if eq .Values.global.ingress_class "gce" "alb" }}
21-
- path: /*
22-
{{- else }}{{/* Has annotations but ingress class is not "gce" nor "alb" */}}
23-
- path: /
24-
{{- end }}
20+
- pathType: Prefix
21+
{{- if eq .Values.global.ingress_class "gce" "alb" }}
22+
path: /*
23+
{{- else }}{{/* Has annotations but ingress class is not "gce" nor "alb" */}}
24+
path: /
25+
{{- end }}
2526
backend:
26-
serviceName: drycc-controller
27-
servicePort: 80
27+
service:
28+
name: drycc-controller
29+
port:
30+
number: 80
2831
{{- if .Values.global.cert_manager_enabled }}
2932
tls:
3033
- secretName: drycc-controller-certificate-auto

rootfs/api/settings/production.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
'corsheaders.middleware.CorsMiddleware',
8282
'django.middleware.security.SecurityMiddleware',
8383
'django.middleware.clickjacking.XFrameOptionsMiddleware',
84-
'django.middleware.csrf.CsrfViewMiddleware',
84+
# 'django.middleware.csrf.CsrfViewMiddleware',
8585
'django.contrib.sessions.middleware.SessionMiddleware',
8686
'django.middleware.common.CommonMiddleware',
8787
'django.contrib.auth.middleware.AuthenticationMiddleware',
@@ -430,11 +430,11 @@
430430
SOCIAL_AUTH_DRYCC_AUTHORIZATION_URL = os.environ.get('SOCIAL_AUTH_DRYCC_AUTHORIZATION_URL')
431431
SOCIAL_AUTH_DRYCC_ACCESS_TOKEN_URL = os.environ.get('SOCIAL_AUTH_DRYCC_ACCESS_TOKEN_URL')
432432
SOCIAL_AUTH_DRYCC_ACCESS_API_URL = os.environ.get('SOCIAL_AUTH_DRYCC_ACCESS_API_URL')
433-
SOCIAL_AUTH_DRYCC_USERINFO_URL = os.environ.get('SOCIAL_AUTH_DRYCC_ACCESS_TOKEN_URL')
434-
SOCIAL_AUTH_DRYCC_JWKS_URI = os.environ.get('SOCIAL_AUTH_DRYCC_ACCESS_API_URL')
433+
SOCIAL_AUTH_DRYCC_USERINFO_URL = os.environ.get('SOCIAL_AUTH_DRYCC_USERINFO_URL')
434+
SOCIAL_AUTH_DRYCC_JWKS_URI = os.environ.get('SOCIAL_AUTH_DRYCC_JWKS_URI')
435435
SOCIAL_AUTH_DRYCC_OIDC_ENDPOINT = os.environ.get('SOCIAL_AUTH_DRYCC_OIDC_ENDPOINT')
436-
SOCIAL_AUTH_DRYCC_KEY = os.environ.get('SOCIAL_AUTH_DRYCC_KEY')
437-
SOCIAL_AUTH_DRYCC_SECRET = os.environ.get('SOCIAL_AUTH_DRYCC_SECRET')
436+
SOCIAL_AUTH_DRYCC_KEY = os.environ.get('SOCIAL_AUTH_DRYCC_CONTROLLER_KEY')
437+
SOCIAL_AUTH_DRYCC_SECRET = os.environ.get('SOCIAL_AUTH_DRYCC_CONTROLLER_SECRET')
438438
SOCIAL_AUTH_POSTGRES_JSONFIELD = True
439439
SOCIAL_AUTH_PIPELINE = (
440440
'social_core.pipeline.social_auth.social_details',

rootfs/scheduler/mock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def get_type(key):
124124
def replace_api_version(old, new='api_v1'):
125125
return old.replace('apis_autoscaling_v1', new)\
126126
.replace('apis_apps_v1', new)\
127-
.replace('apis_networking.k8s.io_v1beta1', new)\
127+
.replace('apis_networking.k8s.io_v1', new)\
128128
.replace('apis_servicecatalog.k8s.io_v1beta1', new)
129129

130130

rootfs/scheduler/resources/ingress.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@ def manifest(self, api_version, ingress, ingress_class, namespace, **kwargs):
2828
"paths": [
2929
{
3030
"path": path,
31+
"pathType": "Prefix",
3132
"backend": {
32-
"serviceName": ingress,
33-
"servicePort": 80
33+
"service": {
34+
"name": ingress,
35+
"port": {
36+
"number": 80
37+
}
38+
}
3439
}
3540
}
3641
]

0 commit comments

Comments
 (0)