File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 2424* ~
2525
2626** /* .kubeconfig
27+ ** /* .crt
28+ ** /* .key
2729.DS_Store
2830
Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ GROUP=capsule.clastix.io
3737TMPDIR=$( mktemp -d)
3838echo " creating certs in TMPDIR ${TMPDIR} "
3939
40- openssl genrsa -out ${TMPDIR} /tls .key 2048
41- openssl req -new -key ${TMPDIR} /tls .key -subj " /CN=${USER} /O=${GROUP} " -out ${TMPDIR} /${USER} -${TENANT} .csr
40+ openssl genrsa -out ${USER} - ${TENANT} .key 2048
41+ openssl req -new -key ${USER} - ${TENANT} .key -subj " /CN=${USER} /O=${GROUP} " -out ${TMPDIR} /${USER} -${TENANT} .csr
4242
4343# Clean any previously created CSR for the same user.
4444kubectl delete csr ${USER} -${TENANT} 2> /dev/null || true
@@ -64,7 +64,7 @@ kubectl apply -f ${TMPDIR}/${USER}-${TENANT}-csr.yaml
6464
6565# Approve and fetch the signed certificate
6666kubectl certificate approve ${USER} -${TENANT}
67- kubectl get csr ${USER} -${TENANT} -o jsonpath=' {.status.certificate}' | base64 --decode > ${TMPDIR} /tls .crt
67+ kubectl get csr ${USER} -${TENANT} -o jsonpath=' {.status.certificate}' | base64 --decode > ${USER} - ${TENANT} .crt
6868
6969# Create the kubeconfig file
7070CONTEXT=$( kubectl config current-context)
@@ -90,8 +90,8 @@ preferences: {}
9090users:
9191- name: ${USER}
9292 user:
93- client-certificate-data : $( cat ${TMPDIR} /tls .crt | base64 | tr -d ' \n ' )
94- client-key-data : $( cat ${TMPDIR} /tls .key | base64 | tr -d ' \n ' )
93+ client-certificate: ${USER} - ${TENANT} .crt
94+ client-key: ${USER} - ${TENANT} .key
9595EOF
9696
9797echo " kubeconfig file is:" ${USER} -${TENANT} .kubeconfig
You can’t perform that action at this time.
0 commit comments