Skip to content

Instantly share code, notes, and snippets.

View voor's full-sized avatar
🐢
it's pronounced turtle cuddle

Robert Van Voorhees voor

🐢
it's pronounced turtle cuddle
View GitHub Profile
@voor
voor / generate-copy.sh
Created October 1, 2021 16:18
Iterate through BundleLocks and relocate them with imgpkg
#!/usr/bin/env bash
set -eux -o pipefail
IMGPKG_REGISTRY_HOSTNAME_0="${IMGPKG_REGISTRY_HOSTNAME_0:-source.example.com}"
IMGPKG_REGISTRY_HOSTNAME_1="${IMGPKG_REGISTRY_HOSTNAME_1:-destination.example.com}"
echo "#!/usr/bin/env bash"
echo "# This generates a script that can be run during CI to copy all the packages over to a new location."
echo "set -eux -o pipefail"
@voor
voor / kapp-config.yaml
Last active September 24, 2021 16:35
Kapp Config for Cluster API
apiVersion: kapp.k14s.io/v1alpha1
kind: Config
minimumRequiredVersion: 0.34.0
# This section makes sure that kapp passes on the necessary kapp labels to derived Cluster API resources.
# Missing this section would mean that follow-on objects created by Cluster API would be missed in kapp inspect calls.
templateRules:
- resourceMatchers:
- apiVersionKindMatcher: {apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3, kind: AWSMachineTemplate}
@voor
voor / current-version.yml
Created September 14, 2021 13:00
Simple gist that shows the flexibility of ytt and how it can achieve an intended outcome without impacting other commands.
#@data/values
#! Note that the file coming out of imgpkg would NOT contain the data/values, you would need to access it with the following CLI command:
#! ytt -f package-template.yaml --data-values-file current-version.yml
#! The data/values is just included here so it'll work properly on ytt playground.
---
apiVersion: imgpkg.carvel.dev/v1alpha1
bundle:
image: harbor.example.com/imgpkg/charts/secretgen-controller@sha256:e302989e79a3c4f17eb5d101ba1c773ea717cde49b5606ffc6424429d70fb8d0
tag: v0.5.0
@voor
voor / imgpkg-chart.sh
Created August 12, 2021 10:35
Create an imgpkg bundle from a helm chart with any additional overlays you might need.
#!/usr/bin/env sh
set -eux -o pipefail
CHART_NAME=gitlab-runner
SERVICE_FOLDER=${CHART_NAME}
CHART_REPO_NAME=gitlab
CHART_REPO_URL=https://charts.gitlab.io
HARBOR_REPO=your.repo.example.com
#@ load("@ytt:data", "data")
RUNNER_TAG_LIST: #@ ",".join([x.strip() for x in data.values.tags])
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:data", "data")
#@ def key_overlay():
metadata:
name: simple-app
#@ end
#@overlay/match by=overlay.subset(key_overlay()),when="1+"
---
#@ load("@ytt:base64", "base64")
#@ load("@ytt:yaml", "yaml")
#@ def server_config():
_: |
c.ServerApp.token = '<generated>'
alkdalsdkasdlaskdasldaskdsl
blah blah blah
#@ end
@voor
voor / file1.yaml
Last active February 25, 2021 20:55
#@ load("@ytt:base64", "base64")
#@ load("@ytt:data", "data")
#@ load("@ytt:yaml", "yaml")
#! rego
#@ load("policy.rego.lib.txt", "rego_auth_policy")
---
apiVersion: v1
data:
@voor
voor / file1.yml
Created February 21, 2021 01:01
Both input files becoming a single yaml document
---
id: 1
meta:
ebook: .epub
@voor
voor / android_package_names.sh
Last active June 1, 2022 03:46
Remove Samsung Bloatware or other Malware baked into Android phones
#!/bin/bash
set -euo pipefail
# Remove whitespace
function remWS {
if [ -z "${1}" ]; then
cat | tr -d '[:space:]'
else
echo "${1}" | tr -d '[:space:]'