hydra-maester icon indicating copy to clipboard operation
hydra-maester copied to clipboard

Allow to set multiple client ids/secrets in a same K8s secret

Open burahimu opened this issue 10 months ago • 0 comments

Preflight checklist

Ory Network Project

No response

Describe your problem

In a specific context, I want to be able to define client_id_key and client_secret_key per client definition. Currently, it's only possible to define a env var to override the key for all clients.

Describe your ideal solution

Add clientIdKey and clientSecretKey in Oauth2Client spec

---
apiVersion: hydra.ory.sh/v1alpha1
kind: OAuth2Client
metadata:
  name: my-client-1
spec:
  secretName: my-secret
  clientIdKey: client-id-2
  clientSecretKey: client-secret-2
...
---
apiVersion: hydra.ory.sh/v1alpha1
kind: OAuth2Client
metadata:
  name: my-client-2
spec:
  secretName: my-secret
  clientIdKey: client-id-2
  clientSecretKey: client-secret-2
...

Workarounds or alternatives

I made a loop in my chart to load secrets

{{- range $clientName, $clientConfig := .Values.oauth2client.clients }}
- name: {{ $clientConfig.clientIdEnvVarName  }}
  valueFrom:
    secretKeyRef:
      name: {{ $clientName }}-oauth2client-secret
      key: CLIENT_ID
- name: {{ $clientConfig.clientSecretEnvVarName }}
  valueFrom:
    secretKeyRef:
      name: {{ $clientName }}-oauth2client-secret
      key: CLIENT_SECRET
{{- end }}

WDYT to do the following:

envFrom:
    - secretRef:
        name: my-secret

Version

0.0.36

Additional Context

No response

burahimu avatar Feb 07 '25 15:02 burahimu