oauth2-client: migrate apps to use oauth2-client helm chart (#90)

* headscale: use oauth2-client helm chart

* pihole: use oauth2-client helm chart

* matrix: use oauth2-client helm chart

* oauth2: pass issuer address to pihole, headscale and matrix apps

* pihole: fix secret name

* matrix: fix version to v1.98.0

* headscale: make oauth2-client depend on auth release

---------

Co-authored-by: Giorgi Lekveishvili <lekva@gl-mbp-m1-max.local>
diff --git a/charts/pihole/templates/oauth2-client.yaml b/charts/pihole/templates/oauth2-client.yaml
deleted file mode 100644
index f178ea0..0000000
--- a/charts/pihole/templates/oauth2-client.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-apiVersion: hydra.ory.sh/v1alpha1
-kind: OAuth2Client
-metadata:
-  name: oauth2-client
-  namespace: {{ .Release.Namespace }}
-spec:
-  grantTypes:
-  - authorization_code
-  responseTypes:
-  - code
-  scope: "openid email profile"
-  secretName: {{ .Values.oauth2.secretName }}
-  redirectUris:
-  - https://{{ .Values.domain }}/oauth2/callback
-  hydraAdmin:
-    url: {{ .Values.oauth2.hydraAdmin }}
-    port: 80
-    endpoint: /admin/clients
-    forwardedProto: https
diff --git a/charts/pihole/templates/oauth2-proxy-config.yaml b/charts/pihole/templates/oauth2-proxy-config.yaml
index 2141bce..5aebbb0 100644
--- a/charts/pihole/templates/oauth2-proxy-config.yaml
+++ b/charts/pihole/templates/oauth2-proxy-config.yaml
@@ -9,7 +9,7 @@
     apiVersion: v1
     kind: ConfigMap
     metadata:
-      name: {{ .Values.oauth2.configName }}
+      name: {{ .Values.configName }}
       namespace: {{ .Release.Namespace }}
     data:
       oauth2-proxy.cfg: |
@@ -53,6 +53,6 @@
         cookie_httponly = true
 
         provider = "oidc"
-        oidc_issuer_url = "{{ .Values.hydraPublic }}"
+        oidc_issuer_url = "{{ .Values.oauth2.issuer }}"
         provider_display_name = "PCloud"
         profile_url = "{{ .Values.profileUrl }}"
diff --git a/charts/pihole/templates/oauth2-proxy.yaml b/charts/pihole/templates/oauth2-proxy.yaml
index 51f88d4..2d62f7b 100644
--- a/charts/pihole/templates/oauth2-proxy.yaml
+++ b/charts/pihole/templates/oauth2-proxy.yaml
@@ -54,7 +54,7 @@
       volumes:
       - name: config
         configMap:
-          name: {{ .Values.oauth2.configName }}
+          name: {{ .Values.configName }}
       containers:
       - name: pihole-oauth2-proxy
         image: quay.io/oauth2-proxy/oauth2-proxy:v7.2.0
diff --git a/charts/pihole/values.yaml b/charts/pihole/values.yaml
index 070be1e..542fcd3 100644
--- a/charts/pihole/values.yaml
+++ b/charts/pihole/values.yaml
@@ -1,10 +1,10 @@
 pihole: {}
 oauth2:
   cookieSecret: "1234123443214321"
-  secretName: oauth2-secret
-  configName: oauth2-proxy
+  secretName: oauth2-client
+  issuer: https://oidc-issuer.example.com
+configName: oauth2-proxy
 domain: pihole.p.example.com
-hydraPublic: https://hydra.example.com
 profileUrl: https://profile.example.com
 ingressClassName: private