Skip to content

Instantly share code, notes, and snippets.

View swade1987's full-sized avatar

Steven Wade swade1987

View GitHub Profile
package logging
import (
"io/ioutil"
"os"
"github.com/lovoo/goka/logger"
log "github.com/sirupsen/logrus"
"github.com/urbn/gourbnkit/v2/urbnlog"
@swade1987
swade1987 / cheatsheet-elasticsearch.md
Created September 21, 2021 15:14 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@swade1987
swade1987 / ssh_key.tf
Created March 12, 2021 16:49 — forked from irvingpop/ssh_key.tf
Terraform external data source example - dynamic SSH key generation
# ssh key generator data source expects the below 3 inputs, and produces 3 outputs for use:
# "${data.external.ssh_key_generator.result.public_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key_file}" (path)
data "external" "ssh_key_generator" {
program = ["bash", "${path.root}/../ssh_key_generator.sh"]
query = {
customer_name = "${var.customer_name}"
customer_group = "${var.customer_group}"
@swade1987
swade1987 / gist:b6c1ccd01b9830aef4ecc06c73373ee1
Created April 15, 2020 15:30
Upgrade from Helm 2 to Helm 3
#!/usr/bin/env bash
# Print v2 and v3 release counts
helm2_release_count=$(helm2 ls | cut -d " " -f 1 | tail -n +2 | wc -l)
helm3_release_count=$(helm3 ls --all-namespaces | cut -d " " -f 1 | tail -n +2 | wc -l)
printf "======================================================================\n"
printf "Helm v2 release count: %d\n" "${helm2_release_count}"
printf "Helm v3 release count: %d\n" "${helm3_release_count}"
printf "======================================================================\n\n"
@swade1987
swade1987 / policy check example
Created March 25, 2020 11:21
policy check example
#! /usr/bin/env bash
set -euo pipefail
mkdir -p /tmp/kustomize
for env in kustomize/*; do
if [ $env == 'kustomize/base' -o $env == 'kustomize/chart-version-prefixes.txt' ]; then continue ; fi
printf "\nChecking %s\n" "${env#*/}"
@swade1987
swade1987 / rego policy example
Created March 25, 2020 09:25
rego policy example
# daemonsets, deployments, replicasets resources under extensions/v1beta1 - use apps/v1 instead
_deny = msg {
resources := ["DaemonSet", "Deployment", "ReplicaSet"]
input.apiVersion == "extensions/v1beta1"
input.kind == resources[_]
msg := sprintf("%s/%s: API extensions/v1beta1 for %s has been deprecated, use apps/v1 instead.", [input.kind, input.metadata.name, input.kind])
}
@swade1987
swade1987 / 1-setup.md
Created March 19, 2020 11:29 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing with either GPG or Krypt.co.

kubeval:
docker:
- image: quay.io/mettle/kubernetes-toolkit:1.17.2-8
steps:
- checkout
- run:
name: kubeval
command: bash -c "`cat bin/kubeval-each-chart`"
@swade1987
swade1987 / lint.sh
Last active February 2, 2020 15:13
kubeval v1
for chart in mettle/*; do
printf "\nChecking %s\n" "${chart#*/}"
helm template ${chart} > /tmp/${chart}.yaml
kubeval --strict --force-color --ignore-missing-schemas /tmp/${chart}.yaml
done
@swade1987
swade1987 / signed-pgp-github.md
Created December 13, 2019 14:11 — forked from TheCureliestWalk/signed-gpg-github.md
How to create GPG Signed key with Keybase on Github

Sign PGP Key on Github with Keybase

mrkdwn-pass

Set everything up

  • Linux Computer (Windows or MacOS is compatible but you need to install GIT manually)
  • You need to install Keybase, login or sign up one if you don't have.
  • Your basic skill with Git and Github:

You need to know that Linux are have a default software: gpg for sign the GPG key. but we are going to use Keybase instead.