Skip to content

Instantly share code, notes, and snippets.

View mbigras's full-sized avatar

Max Bigras mbigras

View GitHub Profile
@mbigras
mbigras / e5.sh
Last active March 21, 2025 07:29
Experiments with different "e" scripts
# e - list files sorted by time, also filter and edit if only 1 match
# usage: e pattern1 pattern2 ...
pattern=$(echo "$@" | awk '
BEGIN { printf "//" }
{ for (i = 1; i <= NF; i++)
printf(" && /%s/", $i) }')
matches=$(ls -t | tac | awk "$pattern")
echo "$matches"
if test $(echo "$matches" | wc -l) -eq 1
then
@mbigras
mbigras / README.md
Last active June 22, 2023 20:12
Describe how Kustomize plugins work with examples
kind: ConfigMap
apiVersion: v1
metadata:
name: myconfig
data:
HELLO: world
SPAM: eggs
---
apiVersion: v1
kind: Pod
Build mbigras/blueapp:v1 Docker image.
cat <<'Dockerfile' | docker build -t mbigras/blueapp:v1 -
# syntax=docker/dockerfile:1.3-labs see https://www.docker.com/blog/introduction-to-heredocs-in-dockerfiles/
FROM python
RUN pip install flask gunicorn
RUN cat <<App >app.py
import os
from flask import Flask, jsonify
$ cd $(mktemp -d)
$ git clone [email protected]:kubernetes-sigs/kustomize.git
Cloning into 'kustomize'...
remote: Enumerating objects: 80611, done.
remote: Counting objects: 100% (100/100), done.
remote: Compressing objects: 100% (65/65), done.
remote: Total 80611 (delta 52), reused 75 (delta 35), pack-reused 80511
Receiving objects: 100% (80611/80611), 91.58 MiB | 1.98 MiB/s, done.
Resolving deltas: 100% (47788/47788), done.
$ cd kustomize
$ /usr/local/bin/kustomize version
{Version:kustomize/v4.5.7 GitCommit:56d82a8378dfc8dc3b3b1085e5a6e67b82966bd7 BuildDate:2022-08-02T16:28:01Z GoOs:darwin GoArch:amd64}
$ /usr/local/bin/kustomize build https://gist.github.com/bc7947cb727d7f9217e7862d961a1ffd.git
apiVersion: v1
data:
hello: world
kind: ConfigMap
metadata:
name: hello-dc6fm46dhm
$ /usr/local/bin/kustomize build [email protected]:bc7947cb727d7f9217e7862d961a1ffd.git
kind: Kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
generators:
- |
kind: ConfigMapGenerator
apiVersion: builtin
metadata:
name: hello
literals:
- hello=world
kind: Kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
generators:
- |
kind: ConfigMapGenerator
apiVersion: builtin
metadata:
name: hello
literals:
- hello=world
kind: Kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
generators:
- |
kind: ConfigMapGenerator
apiVersion: builtin
metadata:
name: hello14958
literals:
- hello=world
kind: Kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
configMapGenerator:
- name: myconfig
behavior: create
literals:
- hello=world
patches:
- |
kind: ConfigMap