My Elasticsearch cheatsheet with example usage via rest api (still a work-in-progress)
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
package logging | |
import ( | |
"io/ioutil" | |
"os" | |
"github.com/lovoo/goka/logger" | |
log "github.com/sirupsen/logrus" | |
"github.com/urbn/gourbnkit/v2/urbnlog" |
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
# 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}" |
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 | |
# 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" |
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 | |
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#*/}" |
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
# 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]) | |
} |
There are now two ways to approach this:
- Using gpg and generating keys
- 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.
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
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`" |
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
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 |
- 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.
NewerOlder