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
| func convertToUTF8(str string, origEncoding string) string { | |
| strBytes := []byte(str) | |
| byteReader := bytes.NewReader(strBytes) | |
| reader, _ := charset.NewReaderLabel(origEncoding, byteReader) | |
| strBytes, _ = ioutil.ReadAll(reader) | |
| return string(strBytes) | |
| } |
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
| #!/bin/bash | |
| set -euo pipefail | |
| docker exec -e ETCDCTL_API=3 $(docker ps -q --filter name=k8s_etcd) \ | |
| etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt \ | |
| --cert=/etc/kubernetes/pki/etcd/peer.crt \ | |
| --key=/etc/kubernetes/pki/etcd/peer.key \ | |
| snapshot save /var/lib/etcd/snapshotdb | |
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
| func checkZeroValue(checkVal interface{}, defaultVal interface{}) interface{} { | |
| if checkVal == nil || reflect.DeepEqual(checkVal, reflect.Zero(reflect.TypeOf(checkVal)).Interface()) { | |
| return defaultVal | |
| } | |
| return checkVal | |
| } |
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
| --- | |
| kind: ClusterRole | |
| apiVersion: rbac.authorization.k8s.io/v1 | |
| metadata: | |
| namespace: kube-public | |
| name: pod-reader | |
| rules: | |
| - apiGroups: ["extensions", "apps", ""] | |
| resources: ["pods", "pods/log"] | |
| verbs: ["get", "list", "watch"] |
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
| #!/bin/bash | |
| GLOBALRESOURCES="${GLOBALRESOURCES:-"storageclass clusterrole clusterrolebinding customresourcedefinition"}" | |
| RESOURCETYPES="${RESOURCETYPES:-"deployment daemonset configmap secrets service ingress networkpolicy statefulset cronjob pvc"}" | |
| CONTEXT="${KUBE_CONTEXT:-$(kubectl config current-context)}" | |
| [ -d "${CONTEXT}" ] || mkdir -p "${CONTEXT}" | |
| kube_export() { | |
| local NS=$1 |