Skip to content

Instantly share code, notes, and snippets.

View chancez's full-sized avatar

Chance Zibolski chancez

View GitHub Profile
@chancez
chancez / vbox
Created November 11, 2016 19:29
#!/bin/bash
# Manage VM nodes which have a specific set of hardware attributes.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${DIR}/common.sh"
: ${VBOX_NET:=vboxnet0}
function main {
local arg="$1"
- name: wait-for-etcd.service
command: start
content: |
[Service]
ExecStart=/usr/bin/bash -c "until curl http://localhost:2379/v2/machines; do sleep 1; done"
RemainAfterExit=true
Type=oneshot
import json
from os import getenv, path
from string import Template
from subprocess import run
from sys import exit
ZONE_ID = getenv("ZONE_ID")
ZONE_FILE = getenv("ZONE_FILE")
TERRAFORM_DIR = getenv("TERRAFORM_DIR")
eval "$(echo "$line" | jq -r 'to_entries | map("\(.key)=\(.value|tostring | @sh)") | join(" ")')"
module "combined_acm_certificate" {
source = "../../modules/acm_certificate_dns_validated_multi_zone"
providers = {
aws.certificate_requester = aws.infra-production-account
aws.route53_cert_validator = aws.main-account
}
domain_name = "infra.example.com"
zone_to_san = {
"infra.example.com" = [
provider "aws" {
alias = "certificate_requester"
}
provider "aws" {
alias = "route53_cert_validator"
}
resource "aws_acm_certificate" "cert" {
provider = aws.certificate_requester
#!/bin/bash
set -e
DIR="$( cd "$(dirname "$0")" ; pwd -P )"
HELM_BIN=${HELM_BIN:-"helm"}
FAQ_BIN=${FAQ_BIN:-"faq"}
FETCH_GIT_REPO="${FETCH_GIT_REPO:-false}"

The Issue

Currently, many options within kustomization.yaml are global, such as commonLabels, namespace, etc. This can lead to issues when you want to create an overlay which includes multiple resources, some sharing values such as the namespace, but then some monitoring resources also needing to be created in a different namespace. I'll provide an example to illustrate my problem.

Example

I'm currently trying to define a "monitoring" overlay which is composed of multiple applications: prometheus-operator, grafana, etc. I also have an overlay for each K8s environment I manage: example, dev, staging and production each have their own overlay. Each environment overlay would include the monitoring overlay.

# environments/dev/kustomization.yaml
#!/bin/bash
set -u
set -x
FLUX_GIT_DEPLOY_KEY_SECRET=flux-git-deploy
FLUX_DEPLOY_KEY_PATH="${FLUX_DEPLOY_KEY_PATH:?}"
FLUX_GIT_REPO='git@github.com:chancez/flux-get-started.git'
HELM_BIN="${HELM_BIN:-helm2}"
#!/usr/bin/env python
from github import Github
gh = None
def gather_clone_urls(user, no_forks=True):
all_repos = gh.repos.list(user=user).all()
for repo in all_repos: