Skip to content

Commit f0bc10e

Browse files
committed
Generate kube-apiserver OIDC CA file from OIDC_CA_CERT
Signed-off-by: Ryan Djurovich <git@ryan0x44.com>
1 parent 12f50fb commit f0bc10e

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

templates/knd/opt/podplane/bin/bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ NSTANCE_SERVER_REGISTRATION_ADDR=$(quote_env_value "${NSTANCE_SERVER_REGISTRATIO
9393
NSTANCE_SERVER_AGENT_ADDR=$(quote_env_value "${NSTANCE_SERVER_AGENT_ADDR:-}")
9494
KUBE_API_ETCD_SERVERS=$(quote_env_value "${KUBE_API_ETCD_SERVERS:-}")
9595
OIDC_ISSUER=$(quote_env_value "${OIDC_ISSUER:-}")
96-
OIDC_CA_FILE=$(quote_env_value "${OIDC_CA_FILE:-}")
96+
OIDC_CA_CERT=$(quote_env_value "${OIDC_CA_CERT:-}")
9797
KUBE_LOG_LEVEL=$(quote_env_value "${KUBE_LOG_LEVEL:-2}")
9898
NETSY_BUCKET=$(quote_env_value "${NETSY_BUCKET:-}")
9999
NETSY_ENDPOINT=$(quote_env_value "${NETSY_ENDPOINT:-}")

templates/knd/opt/podplane/lib/configure/kube.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ KUBE_API_PORT="${KUBE_API_PORT:-6443}"
2727
case "$KUBE_API_PORT" in
2828
''|*[!0-9]*) fatal "KUBE_API_PORT must be numeric" ;;
2929
esac
30+
OIDC_CA_FILE=""
31+
if [ -n "${OIDC_CA_CERT:-}" ]; then
32+
OIDC_CA_FILE="/opt/crt/oidc-ca.pem"
33+
mkdir -p "${PODPLANE_ROOT:-}/opt/crt"
34+
printf '%s' "$OIDC_CA_CERT" | base64 -d > "${PODPLANE_ROOT:-}$OIDC_CA_FILE"
35+
set_file_permissions 0640 root podplane "$OIDC_CA_FILE"
36+
fi
3037

3138
# Create kubelet env file
3239
mkdir -p "${PODPLANE_ROOT:-}/opt/env"

0 commit comments

Comments
 (0)