This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: mutations.gatekeeper.sh/v1 | |
kind: Assign | |
metadata: | |
name: kube-system-node-selector | |
spec: | |
applyTo: | |
- groups: [""] | |
kinds: ["Pod"] | |
versions: ["v1"] | |
match: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In a Starlark context that doesn't support json or recursion, | |
# you might become desperate enough to do something crazy like this... | |
def quoteIfString(obj): | |
if type(obj) == "string": | |
return '"' + obj + '"' | |
else: | |
return obj | |
def jsonEncode(obj): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o errexit -o nounset -o pipefail | |
PKG_PATH="${1:-.}" | |
if ! hash jq 2>/dev/null; then | |
echo >&2 "Error: jq not found. Please install jq: https://stedolan.github.io/jq/download/" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Convert a bash script into an asciinema recording | |
set -o errexit -o nounset -o pipefail | |
INPUT_FILE=${1:-} | |
if [[ -z "${INPUT_FILE}" ]]; then | |
echo "Syntax: $0 <path/to/bash-scipt.sh> <path/to/out.cast>" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Convert a bash script into an asciicast recording | |
set -o errexit -o nounset -o pipefail | |
USER=karl | |
WORKDIR="~/workspace" | |
PROMPT="\u001b]0;Cloud Shell\u0007${USER}@cloudshell:\u001b[1;34m${WORKDIR}\u001b[00m$ \u001bkcloudshell\u001b\\\\" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
kind: Cluster | |
networking: | |
# expose to private network | |
apiServerAddress: "0.0.0.0" | |
# fixed port so Vault auth backend can find the API | |
apiServerPort: 32769 | |
kubeadmConfigPatchesJSON6902: | |
- group: kubeadm.k8s.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Exit on error, unset variable, or error in pipe chain | |
set -o errexit -o nounset -o pipefail | |
# For setenforce & xfs_info | |
PATH=$PATH:/usr/sbin:/sbin | |
echo "Validating distro..." | |
distro="$(source /etc/os-release && echo "${ID}")" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# return 0 if version A >= version B using semanatic versioning | |
function semver_gte() { | |
VERISON_A="${1}" | |
VERISON_B="${2}" | |
SEMVER_PATTERN="[^0-9]*\([0-9][0-9]*\)[.]\([0-9][0-9]*\)[.]\([0-9][0-9]*\).*" | |
SEG1_A="$(echo "${VERISON_A}" | sed -e "s#${SEMVER_PATTERN}#\1#")" | |
SEG1_B="$(echo "${VERISON_B}" | sed -e "s#${SEMVER_PATTERN}#\1#")" | |
[[ ${SEG1_A} < ${SEG1_B} ]] && return 1 | |
[[ ${SEG1_A} > ${SEG1_B} ]] && return 0 | |
SEG2_A="$(echo "${VERISON_A}" | sed -e "s#${SEMVER_PATTERN}#\2#")" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
# org/repo (e.g. karlkfi/probe) | |
REPO=$1 | |
# range (e.g. 1.8.4..1.8.5) | |
RANGE=$2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Resizing a vagrant centos disk... the hard way | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
set -o xtrace | |
vagrant up |
NewerOlder