This file contains hidden or 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
#> grep KUBECONFIG ~/.myzshrc | |
alias tsh='KUBECONFIG=~/.kube/tsh-config /opt/homebrew/bin/tsh' | |
alias ktsh='export KUBECONFIG=~/.kube/tsh-config' | |
#> grep -A2 -B1 k8s ~/.oh-my-zsh/themes/pure-thb.zsh-theme | |
# show [k8s:<name>] | |
part1="" | |
if [[ "${KUBECONFIG:-}" != "" ]]; then | |
kctx="$(grep current-context ${KUBECONFIG} | cut -d ' ' -f2)" |
This file contains hidden or 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
#!/bin/bash -eu | |
to_auth() { | |
jq -r '.Username,.Secret' | paste -sd ":" - | tr -d '\n' | base64 | |
} | |
main() { | |
registry="$1" | |
jq -cnM --arg auth $(docker-credential-desktop <<< "$registry" | to_auth) '{ | |
"auths": { "'"$registry"'": { "auth": $auth } } |
This file contains hidden or 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 | |
# | |
# Script to release Helm charts. | |
# | |
# Requires: helm, gsutil, yq. | |
# | |
# Usage: release.sh CHART_DIR | |
# |
This file contains hidden or 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
> k get es,scp | |
NAME HEALTH NODES VERSION PHASE AGE | |
elasticsearch/xyz green 1 8.7.0 Ready 6m | |
NAME READY PHASE AGE | |
stackconfigpolicy/snapshot-repo 1/1 Ready 5m | |
> eckurl default xyz /_snapshot | |
{"repo-snapshots":{"type":"s3","settings":{"readonly":"true","base_path":"snapshots/default-xyz"}}} |
This file contains hidden or 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
#!/bin/bash -eu | |
get-password() { | |
kubectl -n $ns get secret $esName-es-elastic-user -o go-template='{{.data.elastic | base64decode}}' | |
} | |
port-forward-es() { | |
if [[ "${V:-}" == "1" ]]; then | |
echo kubectl -n $ns port-forward "service/$esName-es-http" 9200 | |
fi |
This file contains hidden or 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
#!/bin/bash -eu | |
simul() { | |
curl 'https://www3.impots.gouv.fr/simulateur/cgi-bin/calc-2020.cgi' \ | |
-H 'User-Agent: agent/0.1' \ | |
-d "$(paste -s -d '&' <<< "$@")" \ | |
> simul.html | |
} | |
simul \ |
This file contains hidden or 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
#!/bin/bash -eu | |
# Remove orphaned forwarding-rules and target pools on Google Cloud | |
list_target_pools() { | |
gcloud compute target-pools list --limit 1000 --format json | \ | |
jq '.[] | | |
{ | |
name: .name, | |
region: .region | split("/")[8], |
This file contains hidden or 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
#!/bin/bash -eu | |
# Increase Virtual Memory for Elasticsearch on GKE | |
# https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html | |
# Dependencies: kubectl, gcloud, jq | |
nodes() { | |
kubectl get nodes -o custom-columns=n:.metadata.name --no-headers | |
} |
This file contains hidden or 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
#!/bin/bash | |
set -euo pipefail | |
# | |
# Bump version | |
# | |
old=v1alpha1 | |
new=v1beta1 | |
replace() { |
This file contains hidden or 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
#!/bin/bash -eu | |
# install kubectl: https://kubernetes.io/docs/tasks/tools | |
# install gcloud: https://cloud.google.com/sdk/docs/install | |
# authenticate: gcloud auth login | |
# gcloud container clusters create c0 --region europe-west1 | |
kubectl create -f https://download.elastic.co/downloads/eck/2.10.0/crds.yaml | |
kubectl apply -f https://download.elastic.co/downloads/eck/2.10.0/operator.yaml |
NewerOlder