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}
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