Skip to content

Instantly share code, notes, and snippets.

View mbigras's full-sized avatar

Max Bigras mbigras

View GitHub Profile
@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 git@github.com: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 git@gist.github.com: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
@mbigras
mbigras / Cat in Go.md
Last active August 29, 2023 05:51
This gist contains the cat Unix command—written in Go.

Cat in Go

This gist contains the cat Unix command—written in Go.

The following Go program concatenates files passed as command-line arguments. If you don't pass any command-line arguments, then cat reads from stdin (it's the cat Unix utility).

Getting started

The following procedure shows how to build and run cat.