Hi,
I’m currently using kong-oidc plugin (GitHub - nokia/kong-oidc: OIDC plugin for Kong) with the following KongPlugin resource yaml file to config it
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: my-kong-oidc
namespace: my-namespace
config:
client_id: my-client
client_secret: xxx
introspection_endpoint: https://my-endpoint.com
discovery: https://my-endpoint.com/.well-known/openid-configuration
realm: my-realm
bearer_only: "yes"
plugin: oidc
Because some of these value is sensitive so I wanted to move them to a Secret resource and reference them in the KongPlugin Resource. Following the github documentation on this (https://github.com/Kong/kubernetes-ingress-controller/blob/main/docs/references/custom-resources.md#kongplugin), which I think is just introduced in the latest releases, I created a Secret resource as follows:
apiVersion: v1
kind: Secret
metadata:
name: plugin-conf-secret
namespace: my-namespace
stringData:
oidc-config: |
client_id: my-client
client_secret: xxx
introspection_endpoint: https://my-endpoint.com
discovery: https://my-endpoint.com/.well-known/openid-configuration
realm: my-realm
bearer_only: "yes"
type: Opaque
and refer it to the KongPlugin resource as:
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: my-kong-oidc
namespace: my-namespace
configFrom:
secretKeyRef:
name: plugin-conf-secret
key: oidc-config
plugin: oidc
Everything works well following the docs.
My concerns are that
Can the value in the Secret resource be under data and encoded as:
apiVersion: v1
kind: Secret
metadata:
name: plugin-conf-secret
namespace: my-namespace
data:
client_id: encoded-value
client_secret: encoded-value
introspection_endpoint: encoded-value
discovery: encoded-value
realm: encoded-value
bearer_only: encoded-value
type: Opaque
and be refered to the KongPlugin resource as:
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: my-kong-oidc
namespace: my-namespace
configFrom:
secretKeyRef:
name: plugin-conf-secret
key: client_id
secretKeyRef:
name: plugin-conf-secret
key: client_secret
secretKeyRef:
name: plugin-conf-secret
key: introspection_endpoint
secretKeyRef:
name: plugin-conf-secret
key: discovery
secretKeyRef:
name: plugin-conf-secret
key: realm
secretKeyRef:
name: plugin-conf-secret
key: bearer_only
plugin: oidc
or just 1 as:
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: my-kong-oidc
namespace: my-namespace
configFrom:
secretKeyRef:
name: plugin-conf-secret
key: client_id
plugin: oidc
I tried doing as above but the logs from the ingress controller read
error parsing config for KongPlugin 'my-kong-oidc/my-namespace': key 'bearer_only' in secret 'my-namespace/plugin-conf-secret' contains neither valid JSON nor valid YAML)
or
error parsing config for KongPlugin 'my-kong-oidc/my-namespace': key 'client_id' in secret 'my-namespace/plugin-conf-secret' contains neither valid JSON nor valid YAML)
Is using data in Secret and refer it to KongPlugin resource possible? Or it just accepts stringData for now?
Best regards.