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 | |
CURRENT_PROJECT=$(gcloud config get-value project) | |
PROJECT_NUMBER=$(gcloud projects describe ${CURRENT_PROJECT} --format='value(projectNumber)') | |
SERVICE_ACCOUNT="${PROJECT_NUMBER}@cloudservices.gserviceaccount.com" | |
kubectl create clusterrolebinding dm-admin-binding --clusterrole=cluster-admin --user=${SERVICE_ACCOUNT} |
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
# Assumes unique cluster names | |
function get-context() { | |
local CLUSTER_NAME=${1} | |
[ -z ${CLUSTER_NAME} ] && echo "Give cluster name" && return 1 | |
local CURRENT_PROJECT=$(gcloud config get-value project) | |
local CLUSTER_ZONE=$(gcloud container clusters list --filter=name:${CLUSTER_NAME} --format='value(zone)') | |
[ -z ${CLUSTER_ZONE} ] && return 1 | |
gcloud container clusters get-credentials ${CLUSTER_NAME} --zone=${CLUSTER_ZONE} |
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
function admin-me() { | |
kubectl create clusterrolebinding $(whoami)-admin-binding \ | |
--clusterrole=cluster-admin \ | |
--user=$(gcloud config get-value core/account) | |
} |
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 -e | |
GIT_TAG=$(git rev-parse --short HEAD) | |
USERNAME=$(docker info | sed '/Username:/!d;s/.* //') | |
TOOL_NAME=$(basename $(pwd)) | |
IMAGE_NAME="${USERNAME}/${TOOL_NAME}:${GIT_TAG}" | |
docker build -t ${IMAGE_NAME} . |
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 | |
if [[ $OSTYPE == "darwin"* ]]; then | |
KMCI_LINK="https://storage.googleapis.com/kubemci-release/release/latest/bin/darwin/amd64/kubemci" | |
else | |
KMCI_LINK="https://storage.googleapis.com/kubemci-release/release/latest/bin/linux/amd64/kubemci" | |
fi | |
LOCAL_BIN=$(pwd)/bin |
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
# Use gcloud access token to fetch Stackdriver custom metrics descriptions | |
curl --silent --header "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ | |
https://monitoring.googleapis.com/v3/projects/$(gcloud config get-value core/project)/metricDescriptors?filter=metric.type%3Dstarts_with%28%22custom.googleapis.com%2F%22%29 | |
# Get all the custom metrics names with jq | |
curl --silent --header "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ | |
https://monitoring.googleapis.com/v3/projects/$(gcloud config get-value core/project)/metricDescriptors?filter=metric.type%3Dstarts_with%28%22custom.googleapis.com%2F%22%29 | jq '.metricDescriptors[] | .name' |
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
alias googleapis-curl='curl --silent --header "Authorization: Bearer $(gcloud auth application-default print-access-token)"' |
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
cd /usr/local/etc/bash_completion.d | |
ln -s /Applications/Docker.app/Contents/Resources/etc/docker.bash-completion | |
ln -s /Applications/Docker.app/Contents/Resources/etc/docker-machine.bash-completion | |
ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion |
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
#!/bin/bash | |
# Based on: | |
# https://withblue.ink/2019/07/13/yes-you-can-run-docker-on-raspbian.html | |
set -e | |
sudo su | |
# Install some required packages first | |
apt-get update | |
apt-get install -y \ |
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
[Unit] | |
Description=CoreDNS | |
Requires=docker.service | |
After=docker.service | |
ConditionPathExists=/etc/coredns/Corefile | |
[Service] | |
ExecStartPre=/bin/bash -c "/usr/bin/docker container inspect coredns 2> /dev/null || /usr/bin/docker run -d --name coredns -p 53:53/udp --restart unless-stopped -v /etc/coredns:/conf coredns/coredns:1.6.0 -conf /conf/Corefile" | |
ExecStart=/usr/bin/docker start -a coredns | |
ExecStop=/usr/bin/docker stop coredns |
OlderNewer