Skip to content

Instantly share code, notes, and snippets.

View ybelleguic's full-sized avatar

ybelleguic ybelleguic

View GitHub Profile
@ybelleguic
ybelleguic / klsns.sh
Created May 31, 2021 11:47
kubernetes list all objects in ns
function klsns() {
NS=$1
if [ "${#@}" -eq "0" ]; then
NS="default"
fi
for i in $(kubectl api-resources --verbs=list --namespaced -o name 2>/dev/null)
do
kubectl get --show-kind --ignore-not-found -n $NS $i 2>/dev/null
sleep 0.1
done
#from https://stackoverflow.com/questions/8975959/aws-s3-how-do-i-see-how-much-disk-space-is-using/29930473
BUCKET=mybucket ; aws s3 ls s3://$BUCKET --recursive --human-readable --summarize
#From https://stackoverflow.com/questions/52369247/namespace-stuck-as-terminating-how-do-i-remove-it#:~:text=This%20is%20caused%20by%20resources,controller%20is%20unable%20to%20remove.&text=You%20can%20edit%20namespace%20on,enter%20or%20save%2Fapply%20changes.
function cleanup-ns() {
NS=$1
kubectl get namespace $NS -o json \
| tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" \
| kubectl replace --raw /api/v1/namespaces/$NS/finalize -f -
}
@ybelleguic
ybelleguic / minikube-proxy-registry.service
Created April 13, 2021 06:55
Access to minikube internal registry from the host (podman push localhost:5000/myimage:latest)
[Unit]
Description=Minikube Proxy Registry Service
After=network-online.target
After=minikube.service
Requires=minikube.service
[Service]
Type=simple
User=Yohan.Belleguic
@ybelleguic
ybelleguic / minikube.service
Last active May 1, 2021 08:15
minikube systemd unit
[Unit]
Description=Minikube Service
After=libvirtd.service
After=libvirtd.socket
After=network-online.target
After=libvirt-guests.service
[Service]
Type=oneshot
#!/bin/bash
#inspired from https://github.com/thenigan/git-diffall
#!/bin/sh
ROOTDIR=/tmp/svndifftool
LEFT=$ROOTDIR/left
RIGHT=$ROOTDIR/right