-
Notifications
You must be signed in to change notification settings - Fork 2.1k
gather/aws/console: Add a step to gather console logs on AWS #9743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-robot
merged 1 commit into
openshift:master
from
wking:aws-console-gather-step
Jun 18, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| approvers: | ||
| - cgwalters | ||
| - enxebre | ||
| - vrutkovs | ||
| - wking |
40 changes: 40 additions & 0 deletions
40
ci-operator/step-registry/gather/aws-console/gather-aws-console-commands.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o nounset | ||
| set -o errexit | ||
| set -o pipefail | ||
|
|
||
| trap 'CHILDREN=$(jobs -p); if test -n "${CHILDREN}"; then kill ${CHILDREN} && wait; fi' TERM | ||
|
|
||
| export AWS_SHARED_CREDENTIALS_FILE="${CLUSTER_PROFILE_DIR}/.awscred" | ||
|
|
||
| if test ! -f "${SHARED_DIR}/metadata.json" | ||
| then | ||
| echo "No metadata.json, so unknown AWS region, so unable to gathering console logs." | ||
| exit 0 | ||
| fi | ||
|
|
||
| if test -f "${KUBECONFIG}" | ||
| then | ||
| oc --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' > "${TMPDIR}/node-provider-IDs.txt" & | ||
| wait "$!" | ||
|
|
||
| oc --request-timeout=5s -n openshift-machine-api get machines -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' >> "${TMPDIR}/node-provider-IDs" & | ||
| wait "$!" | ||
| else | ||
| echo "No kubeconfig; skipping providerID extraction." | ||
| exit 0 | ||
| fi | ||
|
|
||
| if test -f "${SHARED_DIR}/aws-instance-ids.txt" | ||
| then | ||
| cat "${SHARED_DIR}/aws-instance-ids.txt" >> "${TMPDIR}/node-provider-IDs.txt" | ||
| fi | ||
|
|
||
| REGION="$(jq -r .aws.region "${SHARED_DIR}/metadata.json")" | ||
| cat "${TMPDIR}/node-provider-IDs.txt" | sort | uniq | while read -r INSTANCE_ID | ||
| do | ||
| echo "Gathering console logs for ${INSTANCE_ID}" | ||
| aws --region "${REGION}" ec2 get-console-output --instance-id "${INSTANCE_ID}" --output text > "${ARTIFACT_DIR}/${INSTANCE_ID}" & | ||
| wait "$!" | ||
| done |
14 changes: 14 additions & 0 deletions
14
ci-operator/step-registry/gather/aws-console/gather-aws-console-ref.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| ref: | ||
| as: gather-aws-console | ||
| from: upi-installer | ||
| commands: gather-aws-console-commands.sh | ||
| env: | ||
| - name: TMPDIR | ||
| default: /tmp | ||
| documentation: A pathname of a directory made available for programs that need a place to create temporary files. | ||
| resources: | ||
| requests: | ||
| cpu: 300m | ||
| memory: 300Mi | ||
| documentation: |- | ||
| The pre-deprovision artifacts step collects console logs from AWS instances. It gathers console logs for all nodes and machines with a provider ID, as well as any instance IDs listed in ${SHARED_DIR}/aws-instance-ids.txt. aws-instance-ids.txt entries should have a single provider ID per line. Duplicate entries are ok; the step deduplicates before gathering. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
ci-operator/step-registry/ipi/aws/post/ipi-aws-post-chain.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| chain: | ||
| as: ipi-aws-post | ||
| steps: | ||
| - ref: gather-aws-console | ||
| - chain: ipi-deprovision | ||
| documentation: |- | ||
| The IPI cleanup step contains all steps that deprovision an OpenShift | ||
| cluster on AWS, provisioned by the `ipi-aws-pre` chain. | ||
| The IPI cleanup step contains all steps that gather and deprovision an OpenShift cluster on AWS, provisioned by the `ipi-aws-pre` chain. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thought as #9640 (comment)
I think exposing TMPDIR as a user option is mis use of setting variables for the bash script.