Skip to content

Instantly share code, notes, and snippets.

Avatar

Carolyn Van Slyck carolynvs

View GitHub Profile
@carolynvs
carolynvs / magefile.go
Last active Jan 24, 2021
example magefile
View magefile.go
// +build mage
package main
import (
"github.com/carolynvs/magex/pkg"
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
)
@carolynvs
carolynvs / create-user-namespace.sh
Last active Jan 11, 2021
Create a user and a dedicated namespace for it. Grant admin on the namespace and also to CRDs and RBAC.
View create-user-namespace.sh
#!/bin/bash
set -eo pipefail
# https://computingforgeeks.com/restrict-kubernetes-service-account-users-to-a-namespace-with-rbac/
if [[ "$1" == "" ]]; then
echo "usage: create-user-namespace.sh USERNAME"
exit 1
fi
@carolynvs
carolynvs / .gitconfig
Last active Jul 10, 2021
git wip - Show what branches you have been working on lately
View .gitconfig
[alias]
wip = for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads
@carolynvs
carolynvs / gofind.sh
Last active Jul 10, 2020
Find a go project in your GOPATH, written by @steder
View gofind.sh
#!/usr/bin/env bash
# Just source this file or copy/paste this function in your ~/.bashrc or ~/.bash_profile
function gof {
if (( $# == 0 )); then
echo "usage: $gof <dir>"
echo "jumps to $GOPATH/src directory matching <dir>"
return
fi
GOPATH=${GOPATH:-~/go}
@carolynvs
carolynvs / sketchtool-diff-steps.md
Last active Mar 5, 2019
Configure Diffs for Sketch Files
View sketchtool-diff-steps.md
  1. Add the following line to your ~/.bash-profile
    export PATH=$PATH:"$(mdfind kMDItemCFBundleIdentifier == 'com.bohemiancoding.sketch3' | head -n 1)/Contents/Resources/sketchtool/bin/"
    
  2. Add the following lines to your ~/.gitconfig
    [diff "sketchtool"]
      textconv = "sketchtool dump"
      cachetextconv = true
      binary = true
    
@carolynvs
carolynvs / publish-charts.mk
Last active Mar 2, 2019
Publish Helm Charts to Azure storage
View publish-charts.mk
build-image:
docker build -t build-image ./scripts/build-image/
charts-push: build-image
docker run --rm -it \
-v `pwd`:/go/src/github.com/carolynvs/mypkg \
-e AZURE_STORAGE_CONNECTION_STRING \
build-image ./scripts/push-charts.sh
@carolynvs
carolynvs / push-charts.Dockerfile
Created Mar 2, 2019
Publish Helm Charts to Azure
View push-charts.Dockerfile
FROM golang:1.12-stretch
WORKDIR /tmp
# Install Helm
ENV HELM_VERSION=2.13.0
RUN curl -sLO https://kubernetes-helm.storage.googleapis.com/helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
tar -zxvf helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/local/bin/
@carolynvs
carolynvs / push-charts.sh
Last active Mar 2, 2019
Publish Helm Charts to Azure Storage
View push-charts.sh
#!/usr/bin/env bash
set -xeuo pipefail
helm init --client-only
#####
# set up the repo dir, and package up all charts
#####
CHARTS_REPO="https://athens.blob.core.windows.net"
@carolynvs
carolynvs / svcat-plugin-experience-report.md
Last active Apr 27, 2018
Experience Report: Building a kubectl plugin for Service Catalog
View svcat-plugin-experience-report.md

Experience Report: Building a kubectl plugin for Service Catalog

Why a kubectl plugin?

The goal of the service catalog cli (svcat) is to reduce the learning curve for developers and follow precedent set by kubectl when reasonable so that "finger memory" built-up from using kubectl translates to being able to use svcat without reading the help text much.

It isn't intended to be a replacement for kubectl, and instead users will jump back and forth between kubectl and svcat. As a plugin, it reinforces the mental model that svcat conforms to the way kubectl works, and makes the switch between the two less noticeable.

@carolynvs
carolynvs / Dual Mode Service Catalog CLI.md
Last active Jan 9, 2018
Dual Mode Service Catalog CLI
View Dual Mode Service Catalog CLI.md

Dual Mode Service Catalog CLI

We can use the same binary as a standalone Service Catalog CLI, and as a kubectl plugin, with only minor modifications.

Standalone Binary

This is what you see today with svcat.

Installation

curl -sLO https://servicecatalogcli.blob.core.windows.net/cli/latest/$(uname -s)/$(uname -m)/svcat