Skip to content

Instantly share code, notes, and snippets.

View chancez's full-sized avatar

Chance Zibolski chancez

View GitHub Profile
@chancez
chancez / example.tf
Last active November 20, 2023 21:56
Support creating a DNS validated ACM certificate containing SANs for multiple different hosted zones
module "combined_acm_certificate" {
source = "../../modules/acm_certificate_dns_validated_multi_zone"
domain_name = "infra.example.com"
zone_to_san = {
"infra.example.com" = [
"*.infra.example.com",
"*.dev.infra.example.com",
"*.staging.infra.example.com",
"*.production.infra.example.com",
#!/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}"
locals {
// Extracts the cidr block from a cidr, eg: the "16" from a CIDR such as "10.0.0.0/16"
cidr_block_size = split("/", var.cidr_block)[1]
// Get the total number of subnets (private subnet size + public subnet size)
// Take the logarithm base 2 to get the number of bits to accommodate all the
// subnets.
// We cannot use fractional values for cidrsubnet's newbits value, so use
// ceil() to round up. We can't round down because a smaller number bits
// would be insufficient to represent the required subnets.

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:
170m Warning Unhealthy pod/redhat-operators-855975dbd4-hdhjc Liveness probe failed: timeout: failed to connect service "localhost:50051" within 1s
170m Warning Unhealthy pod/redhat-operators-855975dbd4-hdhjc Readiness probe failed: timeout: failed to connect service "localhost:50051" within 1s
SELECT
timestamp '2019-09-01 00:00:00.000' AS period_start,
timestamp '2019-09-30 00:00:00.000' AS period_end,
namespace,
sum(pod_request_memory_byte_seconds / memory_units.resource_base_units / time_units.resource_base_units) as pod_request_memory,
concat(memory_units.resource_unit, ' ', time_units.resource_unit, 's') AS pod_request_memory_units,
sum(pod_request_memory_byte_seconds / price_sheet_memory_unit.resource_base_units / price_sheet_time_unit.resource_base_units * price_sheet.price) as cost,
(price_sheet.price / (price_sheet_memory_unit.resource_base_units / memory_units.resource_base_units) / (price_sheet_time_unit.resource_base_units / time_units.resource_base_units)) AS price,
upper(price_sheet.currency) as currency
FROM hive.metering.datasource_metering_chancez2_pod_memory_request_raw
import org.commonjava.maven.ext.common.model.Project
import org.commonjava.maven.ext.common.util.PropertyResolver
import org.commonjava.maven.ext.core.groovy.BaseScript
import org.commonjava.maven.ext.core.groovy.InvocationStage
import org.commonjava.maven.ext.core.groovy.PMEBaseScript
import org.commonjava.maven.ext.core.groovy.PMEInvocationPoint
@PMEInvocationPoint(invocationPoint = InvocationStage.FIRST)
@PMEBaseScript BaseScript pme
import org.commonjava.maven.ext.core.groovy.PMEBaseScript
import org.commonjava.maven.ext.core.groovy.PMEInvocationPoint
import org.commonjava.maven.ext.core.groovy.InvocationStage
import org.commonjava.maven.ext.core.groovy.BaseScript
import org.commonjava.maven.atlas.ident.ref.SimpleProjectRef;
import org.commonjava.maven.ext.common.model.Project;
import org.commonjava.maven.ext.common.util.PropertyResolver;
@PMEInvocationPoint(invocationPoint = InvocationStage.FIRST)
@PMEBaseScript BaseScript pme