From 2a479a1f863c3849d31304c9a9c1412ff2456a4d Mon Sep 17 00:00:00 2001 From: William Petit Date: Wed, 1 Feb 2023 14:02:39 +0100 Subject: [PATCH] feat: add hydra-oidc component --- components/hydra-oidc/files/hydra/oidc.yaml | 12 ++++++++ components/hydra-oidc/kustomization.yaml | 23 +++++++++++++++ .../patches/hydra-dispatcher-env.yaml | 9 ++++++ .../resources/hydra-oidc-deployment.yaml | 29 +++++++++++++++++++ .../resources/hydra-oidc-service.yaml | 14 +++++++++ kustomization.yaml | 3 +- 6 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 components/hydra-oidc/files/hydra/oidc.yaml create mode 100644 components/hydra-oidc/kustomization.yaml create mode 100644 components/hydra-oidc/patches/hydra-dispatcher-env.yaml create mode 100644 components/hydra-oidc/resources/hydra-oidc-deployment.yaml create mode 100644 components/hydra-oidc/resources/hydra-oidc-service.yaml diff --git a/components/hydra-oidc/files/hydra/oidc.yaml b/components/hydra-oidc/files/hydra/oidc.yaml new file mode 100644 index 0000000..07b9bc4 --- /dev/null +++ b/components/hydra-oidc/files/hydra/oidc.yaml @@ -0,0 +1,12 @@ +hydra: + apps: + - id: oidc + title: + fr: Connexion OIDC + en: Login OIDC + description: + fr: Authentification avec OpenID Connect + en: Authentication with OpenID Connect + login_url: "%env(string:HYDRA_DISPATCHER_OIDC_LOGIN_URL)%" + consent_url: "%env(string:HYDRA_DISPATCHER_OIDC_CONSENT_URL)%" + logout_url: "%env(string:HYDRA_DISPATCHER_OIDC_LOGOUT_URL)%" \ No newline at end of file diff --git a/components/hydra-oidc/kustomization.yaml b/components/hydra-oidc/kustomization.yaml new file mode 100644 index 0000000..48c8f74 --- /dev/null +++ b/components/hydra-oidc/kustomization.yaml @@ -0,0 +1,23 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +resources: + - ./resources/hydra-oidc-deployment.yaml + - ./resources/hydra-oidc-service.yaml + +configMapGenerator: + - name: hydra-oidc-env + literals: + - APP_ENV=prod + - APP_DEBUG=false + - name: hydra-dispatcher-apps + behavior: merge + files: + - ./files/hydra/oidc.yaml + +patchesJson6902: + - target: + version: v1 + kind: ConfigMap + name: hydra-dispatcher-env + path: patches/hydra-dispatcher-env.yaml \ No newline at end of file diff --git a/components/hydra-oidc/patches/hydra-dispatcher-env.yaml b/components/hydra-oidc/patches/hydra-dispatcher-env.yaml new file mode 100644 index 0000000..0b56c86 --- /dev/null +++ b/components/hydra-oidc/patches/hydra-dispatcher-env.yaml @@ -0,0 +1,9 @@ +- op: replace + path: "/data/HYDRA_DISPATCHER_OIDC_LOGIN_URL" + value: http://hydra-oidc/login +- op: replace + path: "/data/HYDRA_DISPATCHER_OIDC_CONSENT_URL" + value: http://hydra-oidc/consent +- op: replace + path: "/data/HYDRA_DISPATCHER_OIDC_LOGOUT_URL" + value: http://hydra-oidc/logout \ No newline at end of file diff --git a/components/hydra-oidc/resources/hydra-oidc-deployment.yaml b/components/hydra-oidc/resources/hydra-oidc-deployment.yaml new file mode 100644 index 0000000..eb4222d --- /dev/null +++ b/components/hydra-oidc/resources/hydra-oidc-deployment.yaml @@ -0,0 +1,29 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: hydra-oidc + name: hydra-oidc +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: hydra-oidc + strategy: + type: Recreate + template: + metadata: + labels: + io.kompose.service: hydra-oidc + spec: + containers: + - name: hydra-oidc + image: reg.cadoles.com/cadoles/hydra-oidc-v1:v0.0.0-159-gd91e77b + envFrom: + - configMapRef: + name: hydra-oidc-env + ports: + - containerPort: 80 + resources: {} + restartPolicy: Always + diff --git a/components/hydra-oidc/resources/hydra-oidc-service.yaml b/components/hydra-oidc/resources/hydra-oidc-service.yaml new file mode 100644 index 0000000..0398b45 --- /dev/null +++ b/components/hydra-oidc/resources/hydra-oidc-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: hydra-oidc + name: hydra-oidc +spec: + ports: + - name: hydra-oidc + port: 80 + selector: + io.kompose.service: hydra-oidc +status: + loadBalancer: {} diff --git a/kustomization.yaml b/kustomization.yaml index bcd30e4..25761d1 100644 --- a/kustomization.yaml +++ b/kustomization.yaml @@ -6,4 +6,5 @@ resources: - ./resources/hydra-dispatcher components: - - ./components/hydra-cnpg-database \ No newline at end of file + - ./components/hydra-cnpg-database + - ./components/hydra-oidc \ No newline at end of file