This file contains 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/sh | |
set -Eeou pipefail | |
# kubectl_get_images.sh | |
# | |
# Use kubectl to get all running images in a Kubernetes cluster. | |
# Ref: https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/ | |
# if context is provided, switch context | |
if [[ ! -z ${1:-} ]]; then |
This file contains 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
# add all yaml configs under ${HOME}/.kube to KUBECONFIG | |
export KUBECONFIG=~/.kube/config$(for YAML in $(find ${HOME}/.kube -name '*.y*ml') ; do echo -n ":${YAML}"; done) |
This file contains 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
# In switching Git repositories, I found you must delete the ArgoCD ApplicationSets and | |
# Applications in order to allow ArgoCD to recreate. However, deleting the resources can | |
# hang due to finalizers. Run the below script to reset the ArgoCD Application finalizers: | |
# get argocd applications by name, one per row | |
APPS=$(kubectl get -n ${NAMESPACE:-argocd} applications.argoproj.io -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{"\n"}{end}') | |
# loop through and reset each application's finalizers | |
while read -r APP; do | |
kubectl patch -n ${NAMESPACE:-argocd} applications.argoproj.io/$APP -p '{"metadata":{"finalizers":[]}}' --type=merge |
This file contains 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
# create alias | |
test() { | |
local URL=${1:?URL is required as first argument} | |
local TIMEOUT=${TIMEOUT:-1} | |
local SLEEP=${SLEEP:-1} | |
while true; do curl -s -m $TIMEOUT $URL > /dev/null && echo -n ✅ || echo -n 💀; sleep $SLEEP; done | |
} | |
# usage |
This file contains 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/sh | |
set -Eeuo pipefail | |
echo | |
: ${NAMESPACE:?NAMESPACE is required} | |
: ${SERVICE:?SERVICE is required} | |
: ${FLOATING_IP:?FLOATING_IP is required} | |
echo "VERIFY FLOATING IP: $FLOATING_IP" | |
while true; do |
This file contains 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
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: metallb-health | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: nginx-conf |
This file contains 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
# Function to read and format ConfigMap data from file | |
configmap_from_file() { | |
local FILE=${1:?FILE is required} | |
local INDENT=${2:-4} | |
local SPACES=$(printf ' %.0s' {1..$INDENT}) | |
echo "|" && cat $FILE | sed "s/^/$SPACES/" | |
} | |
################################################## | |
# usage |
This file contains 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
# get hosts (mgr node) | |
HOSTS=$(docker node ls --format "{{.Hostname}}") | |
# print host/ip | |
for HOST in $HOSTS; do host $HOST; done | awk '{print $1, $4}' | sort |
This file contains 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
( 0.1 + 0.2 === 0.3 ) ? console.log('LGTM') : console.log('WTF'); |
This file contains 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
CREATE OR REPLACE FUNCTION "my_schema"."import_table" (fdw_server text, tablename text, where_filter text) RETURNS bigint | |
VOLATILE | |
AS $body$ | |
DECLARE | |
v_fdw_schema TEXT; | |
v_fdw_tablename TEXT; | |
v_col_def TEXT; | |
v_query TEXT; | |
v_schema_name TEXT; | |
v_table_name TEXT; |
NewerOlder