Skip to content

Commit

Permalink
ci-operator/templates/openshift: Remove Terraform-state-based SSH gat…
Browse files Browse the repository at this point in the history
…hers

Like 970ec02
(ci-operator/step-registry/ipi/deprovision/artifacts/bootstrap: Drop
gather, 2019-12-10, #6336), except for the templates instead of the
step registry.
  • Loading branch information
wking committed Jan 25, 2020
1 parent 66e8fdd commit 7baa9f2
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 299 deletions.
37 changes: 0 additions & 37 deletions ci-operator/templates/openshift/endurance/endurance-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,43 +190,6 @@ objects:
echo "Gathering artifacts ..."
mkdir -p /tmp/artifacts/pods /tmp/artifacts/nodes /tmp/artifacts/metrics /tmp/artifacts/bootstrap /tmp/artifacts/network
if [ -f /tmp/artifacts/installer/terraform.tfstate ]
then
# we don't have jq, so the python equivalent of
# jq '.modules[].resources."aws_instance.bootstrap".primary.attributes."public_ip" | select(.)'
bootstrap_ip=$(python -c \
'import sys, json; d=reduce(lambda x,y: dict(x.items() + y.items()), map(lambda x: x["resources"], json.load(sys.stdin)["modules"])); k="aws_instance.bootstrap"; print d[k]["primary"]["attributes"]["public_ip"] if k in d else ""' \
< /tmp/artifacts/installer/terraform.tfstate
)
if [ -n "${bootstrap_ip}" ]
then
for service in bootkube openshift kubelet crio
do
queue "/tmp/artifacts/bootstrap/${service}.service" curl \
--insecure \
--silent \
--connect-timeout 5 \
--retry 3 \
--cert /tmp/artifacts/installer/tls/journal-gatewayd.crt \
--key /tmp/artifacts/installer/tls/journal-gatewayd.key \
--url "https://${bootstrap_ip}:19531/entries?_SYSTEMD_UNIT=${service}.service"
done
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
fi
eval $(ssh-agent)
ssh-add /etc/openshift-installer/ssh-privatekey
ssh -A -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip} /bin/bash -x /usr/local/bin/installer-gather.sh
scp -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip}:log-bundle.tar.gz /tmp/artifacts/installer/bootstrap-logs.tar.gz
fi
else
echo "No terraform statefile found. Skipping collection of bootstrap logs."
fi
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.metadata.name}{"\n"}{end}' > /tmp/nodes
oc --insecure-skip-tls-verify --request-timeout=5s get pods --all-namespaces --template '{{ range .items }}{{ $name := .metadata.name }}{{ $ns := .metadata.namespace }}{{ range .spec.containers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ range .spec.initContainers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ end }}' > /tmp/containers
oc --insecure-skip-tls-verify --request-timeout=5s get pods -l openshift.io/component=api --all-namespaces --template '{{ range .items }}-n {{ .metadata.namespace }} {{ .metadata.name }}{{ "\n" }}{{ end }}' > /tmp/pods-api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,43 +686,6 @@ objects:
echo "Gathering artifacts ..."
mkdir -p /tmp/artifacts/pods /tmp/artifacts/nodes /tmp/artifacts/metrics /tmp/artifacts/bootstrap /tmp/artifacts/network
if [ -f /tmp/artifacts/installer/terraform.tfstate ]
then
# we don't have jq, so the python equivalent of
# jq '.modules[].resources."aws_instance.bootstrap".primary.attributes."public_ip" | select(.)'
bootstrap_ip=$(python -c \
'import sys, json; d=reduce(lambda x,y: dict(x.items() + y.items()), map(lambda x: x["resources"], json.load(sys.stdin)["modules"])); k="aws_instance.bootstrap"; print d[k]["primary"]["attributes"]["public_ip"] if k in d else ""' \
< /tmp/artifacts/installer/terraform.tfstate
)
if [ -n "${bootstrap_ip}" ]
then
for service in bootkube openshift kubelet crio
do
queue "/tmp/artifacts/bootstrap/${service}.service" curl \
--insecure \
--silent \
--connect-timeout 5 \
--retry 3 \
--cert /tmp/artifacts/installer/tls/journal-gatewayd.crt \
--key /tmp/artifacts/installer/tls/journal-gatewayd.key \
--url "https://${bootstrap_ip}:19531/entries?_SYSTEMD_UNIT=${service}.service"
done
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
fi
eval $(ssh-agent)
ssh-add /etc/openshift-installer/ssh-privatekey
ssh -A -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip} /bin/bash -x /usr/local/bin/installer-gather.sh
scp -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip}:log-bundle.tar.gz /tmp/artifacts/installer/bootstrap-logs.tar.gz
fi
else
echo "No terraform statefile found. Skipping collection of bootstrap logs."
fi
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.metadata.name}{"\n"}{end}' > /tmp/nodes
oc --insecure-skip-tls-verify --request-timeout=5s get pods --all-namespaces --template '{{ range .items }}{{ $name := .metadata.name }}{{ $ns := .metadata.namespace }}{{ range .spec.containers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ range .spec.initContainers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ end }}' > /tmp/containers
oc --insecure-skip-tls-verify --request-timeout=5s get pods -l openshift.io/component=api --all-namespaces --template '{{ range .items }}-n {{ .metadata.namespace }} {{ .metadata.name }}{{ "\n" }}{{ end }}' > /tmp/pods-api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -799,43 +799,6 @@ objects:
echo "Gathering artifacts ..."
mkdir -p /tmp/artifacts/pods /tmp/artifacts/nodes /tmp/artifacts/metrics /tmp/artifacts/bootstrap /tmp/artifacts/network
if [ -f /tmp/artifacts/installer/terraform.tfstate ]
then
# we don't have jq, so the python equivalent of
# jq '.modules[].resources."aws_instance.bootstrap".primary.attributes."public_ip" | select(.)'
bootstrap_ip=$(python -c \
'import sys, json; d=reduce(lambda x,y: dict(x.items() + y.items()), map(lambda x: x["resources"], json.load(sys.stdin)["modules"])); k="aws_instance.bootstrap"; print d[k]["primary"]["attributes"]["public_ip"] if k in d else ""' \
< /tmp/artifacts/installer/terraform.tfstate
)
if [ -n "${bootstrap_ip}" ]
then
for service in bootkube openshift kubelet crio
do
queue "/tmp/artifacts/bootstrap/${service}.service" curl \
--insecure \
--silent \
--connect-timeout 5 \
--retry 3 \
--cert /tmp/artifacts/installer/tls/journal-gatewayd.crt \
--key /tmp/artifacts/installer/tls/journal-gatewayd.key \
--url "https://${bootstrap_ip}:19531/entries?_SYSTEMD_UNIT=${service}.service"
done
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
fi
eval $(ssh-agent)
ssh-add /etc/openshift-installer/ssh-privatekey
ssh -A -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip} /bin/bash -x /usr/local/bin/installer-gather.sh
scp -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip}:log-bundle.tar.gz /tmp/artifacts/installer/bootstrap-logs.tar.gz
fi
else
echo "No terraform statefile found. Skipping collection of bootstrap logs."
fi
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.metadata.name}{"\n"}{end}' > /tmp/nodes
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' > /tmp/node-provider-IDs
oc --insecure-skip-tls-verify --request-timeout=5s get pods --all-namespaces --template '{{ range .items }}{{ $name := .metadata.name }}{{ $ns := .metadata.namespace }}{{ range .spec.containers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ range .spec.initContainers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ end }}' > /tmp/containers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,38 +543,6 @@ objects:
echo "Gathering artifacts ..."
mkdir -p /tmp/artifacts/pods /tmp/artifacts/nodes /tmp/artifacts/metrics /tmp/artifacts/bootstrap /tmp/artifacts/network
if [ -f /tmp/artifacts/terraform/terraform.tfstate ]
then
bootstrap_ip=$(terraform output -state /tmp/artifacts/terraform/terraform.tfstate -json | jq -r '.bootstrap_ip.value')
if [ -n "${bootstrap_ip}" ]
then
for service in bootkube openshift kubelet crio
do
queue "/tmp/artifacts/bootstrap/${service}.service" curl \
--insecure \
--silent \
--connect-timeout 5 \
--retry 3 \
--cert /tmp/artifacts/installer/tls/journal-gatewayd.crt \
--key /tmp/artifacts/installer/tls/journal-gatewayd.key \
--url "https://${bootstrap_ip}:19531/entries?_SYSTEMD_UNIT=${service}.service"
done
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
fi
eval $(ssh-agent)
ssh-add /etc/openshift-installer/ssh-privatekey
ssh -A -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip} /bin/bash -x /usr/local/bin/installer-gather.sh
scp -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip}:log-bundle.tar.gz /tmp/artifacts/installer/bootstrap-logs.tar.gz
fi
else
echo "No terraform statefile found. Skipping collection of bootstrap logs."
fi
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.metadata.name}{"\n"}{end}' > /tmp/nodes
oc --insecure-skip-tls-verify --request-timeout=5s get pods --all-namespaces --template '{{ range .items }}{{ $name := .metadata.name }}{{ $ns := .metadata.namespace }}{{ range .spec.containers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ range .spec.initContainers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ end }}' > /tmp/containers
oc --insecure-skip-tls-verify --request-timeout=5s get pods -l openshift.io/component=api --all-namespaces --template '{{ range .items }}-n {{ .metadata.namespace }} {{ .metadata.name }}{{ "\n" }}{{ end }}' > /tmp/pods-api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,35 +478,6 @@ objects:
echo "Gathering artifacts ..."
mkdir -p /tmp/artifacts/pods /tmp/artifacts/nodes /tmp/artifacts/metrics /tmp/artifacts/bootstrap /tmp/artifacts/network
if [ -f /tmp/artifacts/installer/terraform.tfstate ]
then
if [ -n "${bootstrap_ip}" ]
then
for service in bootkube openshift kubelet crio
do
queue "/tmp/artifacts/bootstrap/${service}.service" curl \
--insecure \
--silent \
--connect-timeout 5 \
--retry 3 \
--cert /tmp/artifacts/installer/tls/journal-gatewayd.crt \
--key /tmp/artifacts/installer/tls/journal-gatewayd.key \
--url "https://${bootstrap_ip}:19531/entries?_SYSTEMD_UNIT=${service}.service"
done
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
fi
eval $(ssh-agent)
ssh-add /etc/openshift-installer/ssh-privatekey
ssh -A -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip} /bin/bash -x /usr/local/bin/installer-gather.sh
scp -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip}:log-bundle.tar.gz /tmp/artifacts/installer/bootstrap-logs.tar.gz
fi
else
echo "No terraform statefile found. Skipping collection of bootstrap logs."
fi
# WORKAROUND https://github.com/openshift/installer/issues/1467
# We need this to be able to collect logs
oc --insecure-skip-tls-verify --request-timeout=5s get csr -o name | xargs oc --insecure-skip-tls-verify --request-timeout=5s adm certificate approve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,42 +612,6 @@ objects:
echo "Gathering artifacts ..."
mkdir -p /tmp/artifacts/pods /tmp/artifacts/nodes /tmp/artifacts/metrics /tmp/artifacts/bootstrap /tmp/artifacts/network
if [ -f /tmp/artifacts/installer/terraform.tfstate ]
then
# we don't have jq, so the python equivalent of
# jq '.modules[].resources."aws_instance.bootstrap".primary.attributes."public_ip" | select(.)'
bootstrap_ip=$(python -c \
'import sys, json; d=reduce(lambda x,y: dict(x.items() + y.items()), map(lambda x: x["resources"], json.load(sys.stdin)["modules"])); k="aws_instance.bootstrap"; print d[k]["primary"]["attributes"]["public_ip"] if k in d else ""' \
< /tmp/artifacts/installer/terraform.tfstate
)
if [ -n "${bootstrap_ip}" ]
then
for service in bootkube openshift kubelet crio
do
queue "/tmp/artifacts/bootstrap/${service}.service" curl \
--insecure \
--silent \
--connect-timeout 5 \
--retry 3 \
--cert /tmp/artifacts/installer/tls/journal-gatewayd.crt \
--key /tmp/artifacts/installer/tls/journal-gatewayd.key \
--url "https://${bootstrap_ip}:19531/entries?_SYSTEMD_UNIT=${service}.service"
done
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
fi
eval $(ssh-agent)
ssh-add /etc/openshift-installer/ssh-privatekey
ssh -A -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip} /bin/bash -x /usr/local/bin/installer-gather.sh
scp -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null core@${bootstrap_ip}:log-bundle.tar.gz /tmp/artifacts/installer/bootstrap-logs.tar.gz
fi
else
echo "No terraform statefile found. Skipping collection of bootstrap logs."
fi
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.metadata.name}{"\n"}{end}' > /tmp/nodes
oc --insecure-skip-tls-verify --request-timeout=5s get pods --all-namespaces --template '{{ range .items }}{{ $name := .metadata.name }}{{ $ns := .metadata.namespace }}{{ range .spec.containers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ range .spec.initContainers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ end }}' > /tmp/containers
oc --insecure-skip-tls-verify --request-timeout=5s get pods -l openshift.io/component=api --all-namespaces --template '{{ range .items }}-n {{ .metadata.namespace }} {{ .metadata.name }}{{ "\n" }}{{ end }}' > /tmp/pods-api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1896,33 +1896,6 @@ objects:
mv /tmp/artifacts/installer/openshift_install_state_updated.json /tmp/artifacts/installer/.openshift_install_state.json
fi
if [ -f /tmp/artifacts/installer/terraform.tfstate ]
then
# we don't have jq, so the python equivalent of
# jq '.modules[].resources."aws_instance.bootstrap".primary.attributes."public_ip" | select(.)'
bootstrap_ip=$(python -c \
'import sys, json; d=reduce(lambda x,y: dict(x.items() + y.items()), map(lambda x: x["resources"], json.load(sys.stdin)["modules"])); k="aws_instance.bootstrap"; print d[k]["primary"]["attributes"]["public_ip"] if k in d else ""' \
< /tmp/artifacts/installer/terraform.tfstate
)
if [ -n "${bootstrap_ip}" ]
then
for service in bootkube openshift kubelet crio
do
queue "/tmp/artifacts/bootstrap/${service}.service" curl \
--insecure \
--silent \
--connect-timeout 5 \
--retry 3 \
--cert /tmp/artifacts/installer/tls/journal-gatewayd.crt \
--key /tmp/artifacts/installer/tls/journal-gatewayd.key \
--url "https://${bootstrap_ip}:19531/entries?_SYSTEMD_UNIT=${service}.service"
done
fi
else
echo "No terraform statefile found. Skipping collection of bootstrap logs."
fi
# collect logs from the proxy
if [ -f "/tmp/artifacts/installer/proxyip" ]
then
Expand Down
Loading

0 comments on commit 7baa9f2

Please sign in to comment.