Skip to content

Commit bf77061

Browse files
committed
Fix shellcheck failures in cluster/pre-existing/util.sh
This is merely bringing PR kubernetes#82059 back to life in a contemporary context, so all cred should go to k-toyoda-pi (and BenTheElder). Change-Id: I7cf33e50adabbd23d18348448c21c6255502c1ba Signed-off-by: Joakim Roubert <[email protected]>
1 parent 3e2ae63 commit bf77061

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

cluster/pre-existing/util.sh

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,16 @@ function detect-project() {
4141
}
4242

4343
function create-certs {
44-
rm /tmp/kubeconfig
45-
46-
execute-cmd-on-pre-existing-master-with-retries "sudo cat /etc/kubernetes/admin.conf" > /tmp/kubeconfig
47-
CA_CERT_BASE64=$(cat /tmp/kubeconfig | grep certificate-authority | awk '{print $2}' | head -n 1)
48-
KUBELET_CERT_BASE64=$(cat /tmp/kubeconfig | grep client-certificate-data | awk '{print $2}' | head -n 1)
49-
KUBELET_KEY_BASE64=$(cat /tmp/kubeconfig | grep client-key-data | awk '{print $2}' | head -n 1)
50-
51-
# Local kubeconfig.kubemark vars
52-
KUBECFG_CERT_BASE64="${KUBELET_CERT_BASE64}"
53-
KUBECFG_KEY_BASE64="${KUBELET_KEY_BASE64}"
54-
55-
# The pre-existing Kubernetes master already has these setup
56-
# Set these vars but don't use them
57-
CA_KEY_BASE64=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
58-
MASTER_CERT_BASE64=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
59-
MASTER_KEY_BASE64=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
60-
KUBEAPISERVER_CERT_BASE64=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
61-
KUBEAPISERVER_KEY_BASE64=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
44+
execute-cmd-on-pre-existing-master-with-retries 'sudo cat /etc/kubernetes/admin.conf' > /tmp/kubeconfig
45+
46+
# CA_CERT_BASE64, KUBELET_CERT_BASE64 and KUBELET_KEY_BASE64 might be used
47+
# in test/kubemark/iks/util.sh
48+
# If it becomes clear that the variables are not used anywhere, then we can
49+
# remove them:
50+
CA_CERT_BASE64=$(grep certificate-authority /tmp/kubeconfig | awk '{print $2}' | head -n 1)
51+
KUBELET_CERT_BASE64=$(grep client-certificate-data /tmp/kubeconfig | awk '{print $2}' | head -n 1)
52+
KUBELET_KEY_BASE64=$(grep client-key-data /tmp/kubeconfig | awk '{print $2}' | head -n 1)
53+
export CA_CERT_BASE64
54+
export KUBELET_CERT_BASE64
55+
export KUBELET_KEY_BASE64
6256
}

hack/.shellcheck_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44
./cluster/gce/upgrade.sh
55
./cluster/gce/util.sh
66
./cluster/log-dump/log-dump.sh
7-
./cluster/pre-existing/util.sh

0 commit comments

Comments
 (0)