Skip to content

Instantly share code, notes, and snippets.

View b0bu's full-sized avatar
🐢
yo!

[0] b0bu

🐢
yo!
View GitHub Profile
@b0bu
b0bu / complex-kubectl-searches.md
Last active July 20, 2021 10:14
Generate commands from kubectl output and run them

the docker and kubectl binaries have a filter switch built in. This is fairly basic on docker but good for piping output around for some more complex operations. Like if you have a lot of containers and forgot to add --rm to one of them.

docker ps -aq --filter name=yolo | xargs docker container rm 

Things get a little better with kubectl but not by much. template is nice if you need to get a secret and you're not using encryption.

kubectl get secrets <secret-name> -o template --template='{{ .data.password }}' | base64 -d | pbcopy

If you want something more complex, like identifying a subset of a resource that need to have some action performed on them and then performing that action you usually need a script. This can be done with a one-liner though. The draw back to template is that

@b0bu
b0bu / sops-age.md
Last active April 16, 2023 03:36
setup sops with age backend

age is prefered over pgp. The keydir is different depending on os. for macos:

KEYDIR=${HOME}/Library/Application\ Support/sops/age/
mkdir -p ${KEYDIR}
# note this can be set with SOPS_AGE_KEY_FILE= to a different location if required
# note this has to be keys.txt not key.txt
age-keygen -o ${KEYDIR}/keys.txt

cat keys.txt
# created: 2021-04-13T10:41:17+01:00
@b0bu
b0bu / awx-operator-readme.md
Last active April 28, 2021 11:22
build and test awx-operator (macos)

Working as of 18.0.0 and 19.0.0.

get code

gh repo clone ansible/awx-operator

set env, ensure pyenv and pyenv-virtualenvs are installed

pyenv virtualenv awx-operator
pyenv activate awx-operator
@b0bu
b0bu / ceph_internals.md
Last active March 13, 2024 14:38
Ceph too many pgs per osd: all you need to know

I'd originally posted this on stackoverflow a while back but I'm putting it in a gist here

Fixing HEALTH_WARN too many PGs per OSD (352 > max 300) once and for all

When balancing placement groups you must take into account:

Data we need

  • pgs per osd
  • pgs per pool
@b0bu
b0bu / gist:a6aec14166d62b4f8f013415a2c1f757
Created August 31, 2016 14:08
Running uwsgi/wsgi with nginx for dummies
Running wsgi with nginx for dummies
This was written while trying to get ceph-dash monitoring flask api to work with nginx, I'm sure some of the concepts here could be applied to
just about any app you're trying to serve through nginx.
So ever wanted to know how to fix all the problems?
FIX FOR 500 RESPONSE CODE
Nginx is NOT starting any wsgi processes for you, I had to start this server manually. In order to get this to work from uwsgi the full path MUST be given to .wsgi file.