Let's look at some basic kubectl output options.
Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).
We can start with:
kubectl get no
| import jenkins.* | |
| import hudson.* | |
| import com.cloudbees.plugins.credentials.* | |
| import com.cloudbees.plugins.credentials.common.* | |
| import com.cloudbees.plugins.credentials.domains.* | |
| import com.cloudbees.jenkins.plugins.sshcredentials.impl.* | |
| import hudson.plugins.sshslaves.*; | |
| import hudson.model.* | |
| import jenkins.model.* | |
| import hudson.security.* |
| openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem | |
| chmod 700 id_rsa.pem |
| #!groovy | |
| # Best of Jenkinsfile | |
| # `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins | |
| node { | |
| } |
| for bucket in $(aws s3api list-buckets --query 'Buckets[*].{Name:Name}' --output text) | |
| do | |
| echo "$bucket:" | |
| region=$(aws s3api get-bucket-location --bucket $bucket --query 'LocationConstraint' --output text | awk '{sub(/None/,"eu-west-1")}; 1') | |
| parts=$(aws s3api list-multipart-uploads --bucket $bucket --region $region --query 'Uploads[*].{Key:Key,UploadId:UploadId}' --output text) | |
| if [ "$parts" != "None" ]; then | |
| IFS=$'\n' |
| #!/bin/bash | |
| # requirements: curl, yq, awk, grep | |
| GREEN='\033[0;32m' | |
| NC='\033[0m' # No Color | |
| if [ -z "$1" ]; then | |
| PLATV=`curl -s https://raw.githubusercontent.com/jenkins-x/jenkins-x-versions/master/charts/jenkins-x/jenkins-x-platform.yml | yq r - version` | |
| else |