Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to handle dex-core client_secret via k8s secrets + alpine update #184

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16.4-alpine3.13
FROM golang:1.17.3-alpine3.14

RUN apk add --no-cache --update alpine-sdk bash

Expand All @@ -15,7 +15,7 @@ COPY . .

RUN make build

FROM alpine:3.13.5
FROM alpine:3.14

# Dex connectors, such as GitHub and Google logins require root certificates.
# Proper installations should manage those certificates, but it's a bad user
Expand Down
4 changes: 2 additions & 2 deletions charts/dex-k8s-authenticator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
appVersion: "v1.4.0"
appVersion: "v1.4.1"
description: "Authenticator for using Dex with Kubernetes"
name: dex-k8s-authenticator
version: 1.4.0
version: 1.4.1
sources:
- https://github.com/mintel/dex-k8s-authenticator
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion charts/dex-k8s-authenticator/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- $fullName := include "dex-k8s-authenticator.fullname" . -}}
{{- $servicePort := .Values.service.port -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
Expand Down
12 changes: 12 additions & 0 deletions charts/dex-k8s-authenticator/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ template "dex-k8s-authenticator.fullname" . }}
labels:
app: {{ template "dex-k8s-authenticator.fullname" . }}
env: {{ default "dev" .Values.global.deployEnv }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
data:
credentials: {{ default "" .Values.dex-core.client_secret | b64enc }}
7 changes: 7 additions & 0 deletions charts/dex-k8s-authenticator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@ dexK8sAuthenticator:
- name: my-cluster
short_description: "My Cluster"
description: "Example Cluster Long Description..."
#"client_secret" can be shifted to secrets.
#In order to use the secrets the value of client_secret needs to be replaced
#with the following: client_secret: ${client_secret}
client_secret: pUBnBOY80SnXgjibTYM9ZWNzY2xreNGQok
issuer: https://dex.example.com
k8s_master_uri: https://my-cluster.example.com
client_id: my-cluster
redirect_uri: https://login.example.com/callback/my-cluster
k8s_ca_uri: https://url-to-your-ca.crt

#Will create a secret which then can be used for the "dexK8sAuthenticator->client_secret"
#dex-core:
# client_secret: my-secret-value-plain

service:
annotations: {}
type: ClusterIP
Expand Down
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ clusters:
# A path-prefix from which to serve requests and assets
web_path_prefix: /dex-auth
```

-
Don't forget to update the Dex `staticClients.redirectURIs` value to include the prefix as well.

### Helm
Expand Down
9 changes: 8 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@ if [ ! -z "$(ls -A /certs)" ]; then
update-ca-certificates
fi

credentials_file=/var/run/secrets/dex-k8s-authenticator/credentials/credentials
if [ -e $credentials_file ]
then
echo "export client_secret" `cat $credentials_file` > /var/tmp/credential_export
source /var/tmp/credential_export
fi

# Execute dex-k8s-authenticator with any argument passed to docker run
/app/bin/dex-k8s-authenticator $@
/app/bin/dex-k8s-authenticator $@