diff --git a/home/.bin/kube-template b/home/.bin/kube-template index 0038644..59d61b1 100755 --- a/home/.bin/kube-template +++ b/home/.bin/kube-template @@ -36,33 +36,27 @@ done NAME=${2} -addLabelsAndAnnotations() { - yq e '.metadata.labels."app.kubernetes.io/name" = "'${NAME}'" | - .metadata.labels."giantswarm.io/user" = "'$(whoami)'" | - .metadata.annotations."giantswarm.io/description" = ""' - -} - case "$1" in deployment|dp) - kubectl create ${NAMESPACE} deployment ${NAME} --image=nginx:1.21 --dry-run=client -o yaml ${@:3} | addLabelsAndAnnotations + kubectl create ${NAMESPACE} deployment ${NAME} --image=nginx:1.21 --dry-run=client -o yaml ${@:3} ;; ingress|in) - kubectl create ${NAMESPACE} ingress ${NAME} --dry-run=client -o yaml --rule=example.com/=my-service:web ${@:3} | addLabelsAndAnnotations + kubectl create ${NAMESPACE} ingress ${NAME} --dry-run=client -o yaml --rule=example.com/=my-service:web ${@:3} ;; service|svc) - kubectl create ${NAMESPACE} service clusterip ${NAME} --dry-run=client -o yaml ${@:3} | addLabelsAndAnnotations + kubectl create ${NAMESPACE} service clusterip ${NAME} --dry-run=client -o yaml ${@:3} ;; configmap|cm) - kubectl create ${NAMESPACE} configmap ${NAME} --dry-run=client -o yaml ${@:3} | addLabelsAndAnnotations + kubectl create ${NAMESPACE} configmap ${NAME} --dry-run=client -o yaml ${@:3} ;; secret|sec) - kubectl create ${NAMESPACE} secret generic ${NAME} --dry-run=client -o yaml ${@:3} | addLabelsAndAnnotations + kubectl create ${NAMESPACE} secret generic ${NAME} --dry-run=client -o yaml ${@:3} ;; cronjob|cj) - kubectl create ${NAMESPACE} cronjob ${NAME} --image=alpine:latest --schedule="1 * * * *" --dry-run=client -o yaml ${@:3} | addLabelsAndAnnotations + kubectl create ${NAMESPACE} cronjob ${NAME} --image=alpine:latest --schedule="1 * * * *" --dry-run=client -o yaml ${@:3} ;; job|jo) - kubectl create ${NAMESPACE} job ${NAME} --image=alpine:latest --dry-run=client -o yaml ${@:3} | addLabelsAndAnnotations + kubectl create ${NAMESPACE} job ${NAME} --image=alpine:latest --dry-run=client -o yaml ${@:3} ;; esac diff --git a/home/.k9s/aliases.yaml b/home/.k9s/aliases.yaml index 2c40c91..ee4d9ec 100644 --- a/home/.k9s/aliases.yaml +++ b/home/.k9s/aliases.yaml @@ -7,5 +7,3 @@ aliases: ro: roles rb: rolebindings np: networkpolicies - cl: cluster.x-k8s.io/v1beta1/clusters - app: application.giantswarm.io/v1alpha1/apps diff --git a/home/.k9s/plugins.yaml b/home/.k9s/plugins.yaml index d3a1ff5..310e030 100644 --- a/home/.k9s/plugins.yaml +++ b/home/.k9s/plugins.yaml @@ -1,66 +1,4 @@ plugins: - sshnode: - shortCut: s - description: SSH via Teleport - dangerous: false - scopes: - - nodes - background: false - command: bash - args: - - -c - - tsh ssh root@cluster=$(echo "$CONTEXT" | rev | cut -d'-' -f1 | rev),node=$(echo "$NAME" | cut -d '.' -f 1) - - aws: - shortCut: w - description: Open AWS Console - dangerous: false - scopes: - - clusters - - awsclusters - background: false - command: bash - args: - - -c - - open "https://signin.aws.amazon.com/switchrole?account=$(kubectl --context ${CONTEXT} get awsclusterroleidentity $(kubectl --context ${CONTEXT} get awsclusters -n ${NAMESPACE} ${NAME} -o json | jq -r '.spec.identityRef.name') -o json | jq -r '.spec.roleARN | split(":")[4]')&roleName=GiantSwarmAdmin&displayName=${CONTEXT}+-+${NAME}" - - clusterapps: - shortCut: a - description: List Apps - dangerous: false - scopes: - - clusters - background: false - command: sh - args: - - -c - - "viddy -n 5s 'kubectl get apps -n $NAMESPACE | grep $NAME'" - - tree: - shortCut: t - description: Show Tree - dangerous: false - scopes: - - clusters - background: false - command: sh - args: - - -c - - "viddy -n 15s 'kubectl tree -n $NAMESPACE clusters.v1beta1.cluster.x-k8s.io $NAME'" - - values: - shortCut: v - description: Show Values - dangerous: false - scopes: - - clusters - - apps - background: false - command: sh - args: - - -c - - "kubectl get -o yaml cm ${NAME}-chart-values -n giantswarm | less" - # kubectl-blame by knight42 # Annotate each line in the given resource's YAML with information from the managedFields to show who last modified the field. # Source: https://github.com/knight42/kubectl-blame