Compare commits
2 Commits
b9647b569d
...
4528e35872
Author | SHA1 | Date | |
---|---|---|---|
4528e35872
|
|||
381adefe87
|
39
home/.bin/.utils
Normal file
39
home/.bin/.utils
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
END_CHARS="\e[0m\n"
|
||||||
|
tput colors &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
bold() {
|
||||||
|
printf "\e[1m$@${END_CHARS}"
|
||||||
|
}
|
||||||
|
|
||||||
|
italic() {
|
||||||
|
printf "\e[3m$@${END_CHARS}"
|
||||||
|
}
|
||||||
|
|
||||||
|
underline() {
|
||||||
|
printf "\e[4m$@${END_CHARS}"
|
||||||
|
}
|
||||||
|
|
||||||
|
orange() {
|
||||||
|
printf "\e[38;5;208m$@${END_CHARS}"
|
||||||
|
}
|
||||||
|
|
||||||
|
blue() {
|
||||||
|
printf "\e[38;5;75m$@${END_CHARS}"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bold() {
|
||||||
|
echo $@
|
||||||
|
}
|
||||||
|
|
||||||
|
italic() {
|
||||||
|
echo $@
|
||||||
|
}
|
||||||
|
|
||||||
|
underline() {
|
||||||
|
echo $@
|
||||||
|
}
|
||||||
|
|
||||||
|
orange() {
|
||||||
|
echo $@
|
||||||
|
}
|
||||||
|
fi
|
@@ -1,17 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
ACCOUNT_ID=${AWS_ACCOUNTID}
|
ACCOUNT_ID=${AWS_ACCOUNTID}
|
||||||
ROLE=GiantSwarmAdmin
|
ROLE=GiantSwarmAdmin
|
||||||
MFA=
|
MFA=
|
||||||
MFA_ARN=arn:aws:iam::${AWS_ACCOUNTID}:mfa/marcus@giantswarm.io
|
MFA_ARN=arn:aws:iam::${AWS_ACCOUNTID}:mfa/marcus@giantswarm.io
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "gs-aws - set up AWS credentials"
|
orange "gs-aws - set up AWS credentials"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "gs-aws"
|
echo "gs-aws"
|
||||||
echo " "
|
echo " "
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-a, --account the AWS account number (default: \$AWS_ACCOUNTID)"
|
echo "-a, --account the AWS account number (default: \$AWS_ACCOUNTID)"
|
||||||
echo "-r, --role the role to assume (default: GiantSwarmAdmin)"
|
echo "-r, --role the role to assume (default: GiantSwarmAdmin)"
|
||||||
|
@@ -1,17 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
NAMESPACE="org-giantswarm"
|
NAMESPACE="org-giantswarm"
|
||||||
RELEASE="20.0.0-alpha1"
|
RELEASE="20.0.0-alpha1"
|
||||||
PROVIDER="aws"
|
PROVIDER="aws"
|
||||||
AZS="eu-west-1a"
|
AZS="eu-west-1a"
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "gs-create-cluster - create a Giant Swarm managed workload cluster"
|
orange "gs-create-cluster - create a Giant Swarm managed workload cluster"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "gs-create-cluster [cluster-name]"
|
echo "gs-create-cluster [cluster-name]"
|
||||||
echo " "
|
echo " "
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace the cluster is in (default: org-giantswarm)"
|
echo "-n, --namespace the namespace the cluster is in (default: org-giantswarm)"
|
||||||
echo "-r, --release the namespace the cluster is in (default: 20.0.0-alpha1)"
|
echo "-r, --release the namespace the cluster is in (default: 20.0.0-alpha1)"
|
||||||
|
@@ -1,16 +1,19 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
NAMESPACE="org-giantswarm"
|
NAMESPACE="org-giantswarm"
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "gs-get-cluster - get a Giant Swarm managed workload cluster"
|
orange "gs-get-cluster - get a Giant Swarm managed workload cluster"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "gs-get-cluster [cluster-name]"
|
echo "gs-get-cluster [cluster-name]"
|
||||||
echo " "
|
echo " "
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace the cluster is in (default: org-giantswarm)"
|
echo "-n, --namespace the namespace the cluster is in (default: org-giantswarm)"
|
||||||
}
|
}
|
||||||
|
@@ -1,17 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
DEBUG=""
|
DEBUG=""
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "gs-login - login to Giant Swarm managed clusters"
|
orange "gs-login - login to Giant Swarm managed clusters"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "gs-login [INSTALLATION] [WORKLOAD CLUSTER] [ORGANISATION]"
|
echo "gs-login [INSTALLATION] [WORKLOAD CLUSTER] [ORGANISATION]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Examples:"
|
underline "Examples:"
|
||||||
echo "> gs-login gauss"
|
echo "> gs-login gauss"
|
||||||
echo "> gs-login gauss mywc1"
|
echo "> gs-login gauss mywc1"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,21 +1,27 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
DEBUG=""
|
DEBUG=""
|
||||||
|
|
||||||
SUPPORTED_APPS="alertmanager argocd grafana happa kibana kyverno prometheus"
|
SUPPORTED_APPS="alertmanager cloudprovider grafana happa kibana kyverno prometheus"
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "gs-open - open apps on Giant Swarm clusters"
|
orange "gs-open - open apps on Giant Swarm clusters"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "gs-open [APP] [INSTALLATION] [WORKLOAD CLUSTER] "
|
echo "gs-open [APP] [INSTALLATION] [WORKLOAD CLUSTER] "
|
||||||
echo " "
|
echo " "
|
||||||
echo "Examples:"
|
underline "Supported apps:"
|
||||||
|
italic "${SUPPORTED_APPS}"
|
||||||
|
echo " "
|
||||||
|
underline "Examples:"
|
||||||
echo "> gs-open prometheus gauss"
|
echo "> gs-open prometheus gauss"
|
||||||
echo "> gs-open alertmanager gauss mywc1"
|
echo "> gs-open alertmanager gauss mywc1"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "--debug show debug log output"
|
echo " --debug show debug log output"
|
||||||
}
|
}
|
||||||
|
|
||||||
POS_ARGS=()
|
POS_ARGS=()
|
||||||
@@ -48,17 +54,25 @@ if [ ${#POS_ARGS[@]} -eq 1 ]; then
|
|||||||
POS_ARGS+=(`opsctl list installations --short | tr ' ' '\n' | fzf`)
|
POS_ARGS+=(`opsctl list installations --short | tr ' ' '\n' | fzf`)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
APP=${POS_ARGS[0]}
|
||||||
|
if [[ "${APP}" == "cloud" ]]; then
|
||||||
|
APP=cloudprovider
|
||||||
|
fi
|
||||||
|
if [[ "${APP}" == "prom" ]]; then
|
||||||
|
APP=prometheus
|
||||||
|
fi
|
||||||
|
|
||||||
case ${#POS_ARGS[@]} in
|
case ${#POS_ARGS[@]} in
|
||||||
0)
|
0)
|
||||||
print_usage
|
print_usage
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
echo "✨ Opening ${POS_ARGS[0]} on ${POS_ARGS[1]}"
|
echo "✨ Opening ${APP} on ${POS_ARGS[1]}"
|
||||||
opsctl open ${DEBUG} --app ${POS_ARGS[0]} --installation ${POS_ARGS[1]}
|
opsctl open ${DEBUG} --app ${APP} --installation ${POS_ARGS[1]}
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
echo "✨ Opening ${POS_ARGS[0]} on ${POS_ARGS[1]}/${POS_ARGS[2]}"
|
echo "✨ Opening ${APP} on ${POS_ARGS[1]} / ${POS_ARGS[2]}"
|
||||||
opsctl open ${DEBUG} --app ${POS_ARGS[0]} --installation ${POS_ARGS[1]} --workload-cluster ${POS_ARGS[2]}
|
opsctl open ${DEBUG} --app ${APP} --installation ${POS_ARGS[1]} --workload-cluster ${POS_ARGS[2]}
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@@ -1,14 +1,17 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "gs-release - create a new release of a Giant Swarm repo"
|
orange "gs-release - create a new release of a Giant Swarm repo"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "gs-release [SEMVER LEVEL]"
|
echo "gs-release [SEMVER LEVEL]"
|
||||||
echo " "
|
echo " "
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,18 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
source .utils
|
||||||
|
|
||||||
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
NAMESPACE=${NAMESPACE:-default}
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
LABEL=""
|
LABEL=""
|
||||||
ALL_NAMESPACES=false
|
ALL_NAMESPACES=false
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "kube-all - A better 'kubectl get all' - actually get all Kubernetes resources, including custom resources"
|
blue "kube-all - A better 'kubectl get all' - actually get all Kubernetes resources, including custom resources"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "kube-all [options]"
|
echo "kube-all [options]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace the to search in"
|
echo "-n, --namespace the namespace the to search in"
|
||||||
echo "-l, --selector the label selector to match on"
|
echo "-l, --selector the label selector to match on"
|
||||||
|
@@ -1,17 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
source .utils
|
||||||
|
|
||||||
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
LABEL=""
|
LABEL=""
|
||||||
ALL_NAMESPACES=false
|
ALL_NAMESPACES=false
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "kube-clean-replicasets - Remove all olf ReplicaSets with 0 desired pods"
|
blue "kube-clean-replicasets - Remove all olf ReplicaSets with 0 desired pods"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "kube-clean-replicasets [options]"
|
echo "kube-clean-replicasets [options]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace the to search in"
|
echo "-n, --namespace the namespace the to search in"
|
||||||
echo "-l, --selector the label selector to match on"
|
echo "-l, --selector the label selector to match on"
|
||||||
|
61
home/.bin/kube-disable-webhook
Executable file
61
home/.bin/kube-disable-webhook
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
WEBHOOK_TYPE="mutating"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-disable-webhook - Disabled a webhook by modifying the namespace selector"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-disable-webhook [options] NAME"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-t, --type the type of webhook [mutating (default), validating]"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-t|--type)
|
||||||
|
shift
|
||||||
|
WEBHOOK_TYPE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
NAME=${1}
|
||||||
|
|
||||||
|
FAKE_SELECTOR='"namespaceSelector":{"matchExpressions":[{"key":"disabled","operator":"In","values":["webhook"]}]}'
|
||||||
|
|
||||||
|
if [[ "${WEBHOOK_TYPE}" == "mutating" ]]; then
|
||||||
|
printf "🚫 Disabling mutating webhook ${NAME}..."
|
||||||
|
kubectl annotate mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state='kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json'
|
||||||
|
HOOKS=$(kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
|
||||||
|
for HOOK in ${HOOKS}
|
||||||
|
do
|
||||||
|
kubectl patch mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -p '{"webhooks": [{"name": "'${HOOK}'", '${FAKE_SELECTOR}'}]}' 1>/dev/null
|
||||||
|
done
|
||||||
|
printf " ✅ Done"
|
||||||
|
elif [[ "${WEBHOOK_TYPE}" == "validating" ]]; then
|
||||||
|
printf "🚫 Disabling validating webhook ${NAME}..."
|
||||||
|
kubectl annotate validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state='kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json'
|
||||||
|
HOOKS=$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
|
||||||
|
for HOOK in ${HOOKS}
|
||||||
|
do
|
||||||
|
kubectl patch validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -p '{"webhooks": [{"name": "'${HOOK}'", '${FAKE_SELECTOR}'}]}' 1>/dev/null
|
||||||
|
done
|
||||||
|
printf " ✅ Done"
|
||||||
|
else
|
||||||
|
echo "Unknown webhook type"
|
||||||
|
exit 1
|
||||||
|
fi
|
@@ -1,17 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
source .utils
|
||||||
|
|
||||||
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
POD=""
|
POD=""
|
||||||
CMD="sh"
|
CMD="sh"
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "kube-exec - execute commands within a pod"
|
blue "kube-exec - execute commands within a pod"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "kube-exec [options]"
|
echo "kube-exec [options]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace the pod is in"
|
echo "-n, --namespace the namespace the pod is in"
|
||||||
echo "-p, --pod the name of the pod"
|
echo "-p, --pod the name of the pod"
|
||||||
|
@@ -1,16 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
source .utils
|
||||||
|
|
||||||
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
NAMESPACE=${NAMESPACE:-default}
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "kube-force-delete - Force delete resources, even those with finalizers"
|
blue "kube-force-delete - Force delete resources, even those with finalizers"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "kube-force-delete [RESOURCE_TYPE] [RESOURCE_NAME]"
|
echo "kube-force-delete [RESOURCE_TYPE] [RESOURCE_NAME]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace the resource is in (default: current namespace)"
|
echo "-n, --namespace the namespace the resource is in (default: current namespace)"
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
HOST_PORT=10001
|
HOST_PORT=10001
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "kube-forward-all - create port-forwards for all pods in the given namespace"
|
blue "kube-forward-all - create port-forwards for all pods in the given namespace"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "kube-forward-all [options]"
|
echo "kube-forward-all [options]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace to launch the pod in"
|
echo "-n, --namespace the namespace to launch the pod in"
|
||||||
echo "-p, --port the port to start at (and increment from for each service) (default: 10001)"
|
echo "-p, --port the port to start at (and increment from for each service) (default: 10001)"
|
||||||
|
@@ -1,17 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
source .utils
|
||||||
|
|
||||||
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
POD=""
|
POD=""
|
||||||
ARGS=""
|
ARGS=""
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "kube-logs - tail logs from a pod"
|
blue "kube-logs - tail logs from a pod"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "kube-logs [options]"
|
echo "kube-logs [options]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace the pod is in"
|
echo "-n, --namespace the namespace the pod is in"
|
||||||
echo "-p, --pod the name of the pod to get logs for"
|
echo "-p, --pod the name of the pod to get logs for"
|
||||||
|
51
home/.bin/kube-reenable-webhook
Executable file
51
home/.bin/kube-reenable-webhook
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
WEBHOOK_TYPE="mutating"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-reenable-webhook - Re-enable a previously disabled webhook"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-reenable-webhook [options] NAME"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-t, --type the type of webhook [mutating (default), validating]"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-t|--type)
|
||||||
|
shift
|
||||||
|
WEBHOOK_TYPE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
NAME=${1}
|
||||||
|
|
||||||
|
FAKE_SELECTOR='"namespaceSelector":{"matchExpressions":[{"key":"disabled","operator":"In","values":["webhook"]}]}'
|
||||||
|
|
||||||
|
if [[ "${WEBHOOK_TYPE}" == "mutating" ]]; then
|
||||||
|
printf "🔌 Re-enabling mutating webhook ${NAME}..."
|
||||||
|
kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o custom-columns="prev:.metadata.annotations.previous-state" --no-headers | kubectl apply -f -
|
||||||
|
printf " ✅ Done"
|
||||||
|
elif [[ "${WEBHOOK_TYPE}" == "validating" ]]; then
|
||||||
|
printf "🔌 Re-enabling validating webhook ${NAME}..."
|
||||||
|
kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o custom-columns="prev:.metadata.annotations.previous-state" --no-headers | kubectl apply -f -
|
||||||
|
printf " ✅ Done"
|
||||||
|
else
|
||||||
|
echo "Unknown webhook type"
|
||||||
|
exit 1
|
||||||
|
fi
|
@@ -1,16 +1,19 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
source .utils
|
||||||
|
|
||||||
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
NAMESPACE="-A"
|
NAMESPACE="-A"
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "kube-restarting - Show all pods with restarts"
|
blue "kube-restarting - Show all pods with restarts"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "kube-restarting [options]"
|
echo "kube-restarting [options]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace the to search in (searches all if not set)"
|
echo "-n, --namespace the namespace the to search in (searches all if not set)"
|
||||||
}
|
}
|
||||||
|
@@ -1,18 +1,21 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
source .utils
|
||||||
|
|
||||||
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
POD="shell"
|
POD="shell"
|
||||||
IMAGE="bash"
|
IMAGE="bash"
|
||||||
CMD="sh"
|
CMD="sh"
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "kube-shell - create a new pod and exec into it's shell"
|
blue "kube-shell - create a new pod and exec into it's shell"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "kube-shell [options]"
|
echo "kube-shell [options]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace the pod should launch in"
|
echo "-n, --namespace the namespace the pod should launch in"
|
||||||
echo "-p, --pod the name of the pod to get logs for (default: shell)"
|
echo "-p, --pod the name of the pod to get logs for (default: shell)"
|
||||||
|
@@ -1,18 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
source .utils
|
||||||
|
|
||||||
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
NAMESPACE=${NAMESPACE:-default}
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
POD="kube-ssh"
|
POD="kube-ssh"
|
||||||
NODE=""
|
NODE=""
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "kube-ssh - gain access to a Kubernetes host node (ssh-like for when a host doesn't have ssh)"
|
blue "kube-ssh - gain access to a Kubernetes host node (ssh-like for when a host doesn't have ssh)"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "kube-ssh [options]"
|
echo "kube-ssh [options]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace to launch the pod in"
|
echo "-n, --namespace the namespace to launch the pod in"
|
||||||
echo "-p, --pod the name of the pod to launch (default: kube-ssh)"
|
echo "-p, --pod the name of the pod to launch (default: kube-ssh)"
|
||||||
|
@@ -1,15 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
NAMESPACE=""
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
set -e
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "kube-template - Quickly template up kubernetes resources"
|
blue "kube-template - Quickly template up kubernetes resources"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "kube-template [options] RESOURCE_KIND NAME [extra arguments]"
|
echo "kube-template [options] RESOURCE_KIND NAME [extra arguments]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace the to search in"
|
echo "-n, --namespace the namespace the to search in"
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
source .utils
|
||||||
|
|
||||||
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
NAMESPACE=${NAMESPACE:-default}
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "kube-trigger-cronjob - Triggers a CronJob by creating a new job based on it"
|
blue "kube-trigger-cronjob - Triggers a CronJob by creating a new job based on it"
|
||||||
echo " "
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
echo "kube-trigger-cronjob [options] CRONJOB_NAME"
|
echo "kube-trigger-cronjob [options] CRONJOB_NAME"
|
||||||
echo " "
|
echo " "
|
||||||
echo "Options:"
|
underline "Options:"
|
||||||
echo "-h, --help show this help text"
|
echo "-h, --help show this help text"
|
||||||
echo "-n, --namespace the namespace the to search in"
|
echo "-n, --namespace the namespace the to search in"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user