Commit 76f33c8e authored by Simon Cornet's avatar Simon Cornet
Browse files

fix: dont conflict with default username var

parent 27b1f9e1
Loading
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -8,10 +8,10 @@ To create a kubeconfig file for a user created by this manifest, execute the fol

```bash
# Username
USERNAME=foo-bar
KUBE_USERNAME=foo-bar

# Get the token
TOKEN=$(kubectl create token ${USERNAME} -n kube-system --duration=87600h)
TOKEN=$(kubectl create token ${KUBE_USERNAME} -n kube-system --duration=87600h)

# Get cluster info
CLUSTER_NAME=$(kubectl config view --minify -o jsonpath='{.clusters[0].name}')
@@ -19,7 +19,7 @@ CLUSTER_SERVER=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster
CLUSTER_CA=$(kubectl config view --minify --raw -o jsonpath='{.clusters[0].cluster.certificate-authority-data}')

# Create kubeconfig
cat > ${USERNAME}-kubeconfig.yaml <<EOF
cat > ${KUBE_USERNAME}-kubeconfig.yaml <<EOF
apiVersion: v1
kind: Config
clusters:
@@ -30,11 +30,11 @@ clusters:
contexts:
- context:
    cluster: ${CLUSTER_NAME}
    user: ${USERNAME}
  name: ${USERNAME}@${CLUSTER_NAME}
current-context: ${USERNAME}@${CLUSTER_NAME}
    user: ${KUBE_USERNAME}
  name: ${KUBE_USERNAME}@${CLUSTER_NAME}
current-context: ${KUBE_USERNAME}@${CLUSTER_NAME}
users:
- name: ${USERNAME}
- name: ${KUBE_USERNAME}
  user:
    token: ${TOKEN}
EOF