1+ {{- $clientSecret := include "rand32" . }}
2+ {{- $cookieSecret := include "rand16" . }}
13apiVersion : keycloak.org/v1alpha1
24kind : Keycloak
35metadata :
5456 composite : false
5557 client :
5658 clientId : workstation
57- secret : {{ .Values.keycloak. clientSecret }}
59+ secret : {{ $ clientSecret }}
5860 standardFlowEnabled : true
5961 redirectUris :
6062 - " *"
@@ -352,4 +354,131 @@ spec:
352354 - Egress
353355 egress :
354356 - {}
357+ {{ end }}
358+ ---
359+ apiVersion : apps/v1
360+ kind : Deployment
361+ metadata :
362+ name : oauth2-proxy
363+ labels :
364+ app : oauth2-proxy
365+ spec :
366+ replicas : 1
367+ selector :
368+ matchLabels :
369+ app : oauth2-proxy
370+ template :
371+ metadata :
372+ labels :
373+ app : oauth2-proxy
374+ spec :
375+ {{ toYaml .Values.podDefaults | nindent 6 }}
376+ containers :
377+ - name : oauth2-proxy
378+ image : {{ .Values.oauth2Proxy.image }}
379+ args :
380+ - " --session-cookie-minimal"
381+ - " --session-store-type=redis"
382+ - " --redis-connection-url=redis://{{ .Release.Name }}-redis-master:6379"
383+ ports :
384+ - containerPort : 4180
385+ protocol : TCP
386+ resources : {{ toYaml .Values.oauth2Proxy.resources | nindent 10 }}
387+ env :
388+ # OIDC Config
389+ - name : " OAUTH2_PROXY_SCOPE"
390+ value : " openid profile"
391+ - name : " OAUTH2_PROXY_PROVIDER"
392+ value : " oidc"
393+ - name : " OAUTH2_PROXY_OIDC_ISSUER_URL"
394+ value : " https://keycloak.{{ .Values.domain }}/auth/realms/workstation"
395+ - name : " OAUTH2_PROXY_CLIENT_ID"
396+ value : workstation
397+ - name : " OAUTH2_PROXY_CLIENT_SECRET"
398+ value : {{ $clientSecret }}
399+ # Cookie Config
400+ - name : " OAUTH2_PROXY_COOKIE_SECRET"
401+ value : " {{ $cookieSecret }}"
402+ - name : " OAUTH2_PROXY_COOKIE_DOMAINS"
403+ value : " .{{ .Values.domain }}"
404+ # Proxy config
405+ - name : " OAUTH2_PROXY_EMAIL_DOMAINS"
406+ value : " *"
407+ - name : " OAUTH2_PROXY_WHITELIST_DOMAINS"
408+ value : " .{{ .Values.domain }}"
409+ - name : " OAUTH2_PROXY_HTTP_ADDRESS"
410+ value : " 0.0.0.0:4180"
411+ - name : " OAUTH2_PROXY_SET_XAUTHREQUEST"
412+ value : " true"
413+ - name : " OAUTH2_PROXY_UPSTREAMS"
414+ value : " file:///dev/null"
415+ ---
416+ apiVersion : autoscaling/v2beta2
417+ kind : HorizontalPodAutoscaler
418+ metadata :
419+ name : oauth2-proxy
420+ spec :
421+ scaleTargetRef :
422+ apiVersion : apps/v1
423+ kind : Deployment
424+ name : oauth2-proxy
425+ minReplicas : 1
426+ maxReplicas : 3
427+ metrics :
428+ - type : Object
429+ object :
430+ metric :
431+ name : requests-per-second
432+ describedObject :
433+ apiVersion : networking.k8s.io/v1
434+ kind : Ingress
435+ name : oauth2-proxy
436+ target :
437+ type : Value
438+ value : 5k
439+ ---
440+ apiVersion : v1
441+ kind : Service
442+ metadata :
443+ name : oauth2-proxy
444+ labels :
445+ app : oauth2-proxy
446+ spec :
447+ ports :
448+ - name : http
449+ port : 4180
450+ protocol : TCP
451+ targetPort : 4180
452+ selector :
453+ app : oauth2-proxy
454+ {{ if eq .Values.policies.enabled true }}
455+ ---
456+ apiVersion : networking.k8s.io/v1
457+ kind : NetworkPolicy
458+ metadata :
459+ name : oauth2-proxy
460+ spec :
461+ podSelector :
462+ matchLabels :
463+ app : oauth2-proxy
464+ policyTypes :
465+ - Ingress
466+ - Egress
467+ ingress :
468+ - from :
469+ - podSelector :
470+ matchLabels :
471+ app : ingress-nginx
472+ - namespaceSelector : {}
473+ egress :
474+ - to :
475+ - podSelector :
476+ matchLabels :
477+ app : ingress-nginx
478+ - namespaceSelector : {}
479+ - to :
480+ - podSelector :
481+ matchLabels :
482+ app : keycloak
483+ component : keycloak
355484{{ end }}
0 commit comments