Created
April 6, 2015 19:06
-
-
Save deads2k/c294a882c9358ea7679f to your computer and use it in GitHub Desktop.
This file contains 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
// kubectl config view template hits based on `grep -r -- "-o template" * | grep view` | |
cluster/aws/util.sh: local file=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o template --template="${template}") | |
cluster/kubectl.sh:echo "current-context: \"$(${kubectl} "${config[@]:+${config[@]}}" config view -o template --template='{{index . "current-context"}}')\"" >&2 | |
cluster/common.sh: current=$("${kubectl}" config view -o template --template='{{ index . "current-context" }}') | |
cluster/common.sh: KUBE_USER=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o template --template="${username}") | |
cluster/common.sh: KUBE_PASSWORD=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o template --template="${password}") | |
docs/man/man1/kubectl-config-view.1:$ kubectl config view \-o template \-\-template='\{\{ index . "users" "e2e" "password" \}\}' | |
docs/kubectl-config-view.md:$ kubectl config view -o template --template='{{ index . "users" "e2e" "password" }}' | |
examples/openshift-origin/resource-generator.sh:CURRENT_CONTEXT=$( "${kubectl}" "${config[@]:+${config[@]}}" config view -o template "${TEMPLATE}" ) | |
examples/openshift-origin/resource-generator.sh:CURRENT_CLUSTER=$( "${kubectl}" "${config[@]:+${config[@]}}" config view -o template "${TEMPLATE}" ) | |
examples/openshift-origin/resource-generator.sh:CURRENT_USER=$( "${kubectl}" "${config[@]:+${config[@]}}" config view -o template "${TEMPLATE}" ) | |
examples/openshift-origin/resource-generator.sh:CERTIFICATE_AUTHORITY=$( "${kubectl}" "${config[@]:+${config[@]}}" config view -o template "${TEMPLATE}" ) | |
examples/openshift-origin/resource-generator.sh:KUBE_MASTER=$( "${kubectl}" "${config[@]:+${config[@]}}" config view -o template "${TEMPLATE}" ) | |
examples/openshift-origin/resource-generator.sh:AUTH_PATH=$( "${kubectl}" "${config[@]:+${config[@]}}" config view -o template "${TEMPLATE}" ) | |
pkg/kubectl/cmd/config/view.go:$ kubectl config view -o template --template='{{ index . "users" "e2e" "password" }}'` | |
// unique template strings - original output | |
{{index . "current-context"}} = master-0 | |
{{ index . \"contexts\" ${CURRENT_CONTEXT} \"cluster\" }} = master | |
{{ index . \"contexts\" ${CURRENT_CONTEXT} \"user\" }} = system:admin | |
{{ index . \"clusters\" ${CURRENT_CLUSTER} \"certificate-authority\" }} = ca-file | |
{{ index . \"clusters\" ${CURRENT_CLUSTER} \"server\" }} = https://10.13.137.63:8443 | |
{{ index . \"users\" ${CURRENT_USER} \"auth-path\" }} = auth-path-file | |
{{ index . "users" "e2e" "password" }} = e2e-pass | |
{{$dot := .}}{{with $ctx := index $dot "current-context"}}{{$user := index $dot "contexts" $ctx "user"}}{{index $dot "users" $user "auth-path"}}{{end}} = auth-path-file | |
{{$root := .}}{{with index $root "current-context"}}{{with index $root "contexts" .}}{{with index . "user"}}{{with index $root "users" .}}{{index . "username"}}{{end}}{{end}}{{end}}{{end}} | |
{{$root := .}}{{with index $root "current-context"}}{{with index $root "contexts" .}}{{with index . "user"}}{{with index $root "users" .}}{{index . "password"}}{{end}}{{end}}{{end}}{{end}} | |
// new template template strings - output | |
{{index . "current-context"}} = master-0 | |
{{range .contexts}}{{ if eq .name ${CURRENT_CONTEXT} }}{{ .context.cluster }}{{end}}{{end}} = master | |
{{range .contexts}}{{ if eq .name ${CURRENT_CONTEXT} }}{{ .context.user }}{{end}}{{end}} = system:admin | |
{{range .clusters}}{{ if eq .name ${CURRENT_CLUSTER} }}{{ index . \"cluster\" \"certificate-authority\" }}{{end}}{{end}} = ca-file | |
{{range .clusters}}{{ if eq .name ${CURRENT_CLUSTER} }}{{ .cluster.server }}{{end}}{{end}} = https://10.13.137.63:8443 | |
{{range .users}}{{ if eq .name ${CURRENT_USER} }}{{ index . \"user\" \"auth-path\" }}{{end}}{{end}} = auth-path-file | |
{{range .users}}{{ if eq .name "e2e" }}{{ index .user.password }}{{end}}{{end}} = e2e-pass | |
{{$dot := .}}{{with $ctx := index $dot "current-context"}}{{range $element := (index $dot "contexts")}}{{ if eq .name $ctx }}{{ with $user := .context.user }}{{range $element := (index $dot "users")}}{{ if eq .name $user }}{{ index . "user" "auth-path" }}{{end}}{{end}}{{end}}{{end}}{{end}}{{end}} = auth-path-file | |
{{$dot := .}}{{with $ctx := index $dot "current-context"}}{{range $element := (index $dot "contexts")}}{{ if eq .name $ctx }}{{ with $user := .context.user }}{{range $element := (index $dot "users")}}{{ if eq .name $user }}{{ index . "user" "username" }}{{end}}{{end}}{{end}}{{end}}{{end}}{{end}} | |
{{$dot := .}}{{with $ctx := index $dot "current-context"}}{{range $element := (index $dot "contexts")}}{{ if eq .name $ctx }}{{ with $user := .context.user }}{{range $element := (index $dot "users")}}{{ if eq .name $user }}{{ index . "user" "password" }}{{end}}{{end}}{{end}}{{end}}{{end}}{{end}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment