This commit is contained in:
2024-02-20 17:15:27 +08:00
committed by huty
parent 6706e1a633
commit 34158042ad
1529 changed files with 177765 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
ARG ALPINE_VERSION="3.15"
FROM alpine:$ALPINE_VERSION
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing kubectl
COPY start.sh /
COPY config.json /config-in/config.json
RUN chmod +x /start.sh
CMD /start.sh

View File

@@ -0,0 +1,3 @@
{
"BannerMessage": "{LABEL}"
}

View File

@@ -0,0 +1,14 @@
#!/bin/sh
# set up access to Kube API
kubectl config set-cluster default --server=https://kubernetes.default.svc.cluster.local --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
kubectl config set-context default --cluster=default
kubectl config set-credentials user --token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
kubectl config set-context default --user=user
kubectl config use-context default
label=$(kubectl get ns kiamol-ch17 -o jsonpath='{.metadata.labels.kiamol}')
sed -i "s/{LABEL}/$label/g" /config-in/config.json
cp /config-in/config.json /config-out/config.json
echo "** Namespace label: $label. Written to config file **"