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
There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.
All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.
What do these lines do? Make predictions and then scroll down.
func print(pi *int) { fmt.Println(*pi) }| before_script: | |
| - export GOPATH=$(pwd) | |
| stages: | |
| - build | |
| - test | |
| - deploy | |
| validate-schema: | |
| image: truongsinh/pg-client:9.4 |
| # Join multiple lines without new line | |
| value: > | |
| part 1 | |
| part 2 | |
| # Join with newline | |
| value2: | | |
| line 1 | |
| line 2 |
| /* | |
| ******************************************************************************** | |
| Golang - Asterisk and Ampersand Cheatsheet | |
| ******************************************************************************** | |
| Also available at: https://play.golang.org/p/lNpnS9j1ma | |
| Allowed: | |
| -------- | |
| p := Person{"Steve", 28} stores the value |
| #!/bin/bash | |
| # Inspired by http://dl.getipaddr.net/ and http://curl.haxx.se/mail/archive-2014-10/0006.html | |
| file=path/to/file | |
| bucket=your-bucket | |
| contentType="application/octet-stream" | |
| dateValue=`date -R` | |
| resource="/${bucket}/${file}" | |
| s3Key=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/ec2-app-role | grep 'AccessKeyId' | sed 's/.* "\([^"]*\).*/\1/'` | |
| s3Secret=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/ec2-app-role | grep 'SecretAccessKey' | sed 's/.* "\([^"]*\).*/\1/'` | |
| token=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/ec2-app-role | grep 'Token' | sed 's/.* "\([^"]*\).*/\1/'` |
| # For example here I create thumbnails of images in the current directory, inserting a "_tn" string into the input filename, to create the appropraite output image filename. | |
| convert *.jpg -thumbnail 120x90 -set filename:fname '%t_tn' | |
| +adjoin '%[filename:fname].gif' | |
| Because of this the "-set" option can actually define ANY setting with ANY value. | |
| convert rose: -set filename:my_area '%wx%h' 'rose-%[filename:my_area].png' | |
| To get the exact original filename of the image use '%d/%f' or '%d/%t.%e'. |