Cleaned up GS leftovers

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
2025-09-07 06:36:53 +01:00
parent 1d34f433ef
commit c6a9a90dde
3 changed files with 7 additions and 77 deletions

View File

@@ -36,33 +36,27 @@ done
NAME=${2} 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 case "$1" in
deployment|dp) 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) 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) 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) 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) 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) 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) 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 esac

View File

@@ -7,5 +7,3 @@ aliases:
ro: roles ro: roles
rb: rolebindings rb: rolebindings
np: networkpolicies np: networkpolicies
cl: cluster.x-k8s.io/v1beta1/clusters
app: application.giantswarm.io/v1alpha1/apps

View File

@@ -1,66 +1,4 @@
plugins: 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 # 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. # 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 # Source: https://github.com/knight42/kubectl-blame