Skip to content

Instantly share code, notes, and snippets.

@trevorbox
trevorbox / topology.yaml
Created August 22, 2022 20:42
topology spread constraint
topologySpreadConstraints:
- maxSkew: 1
topologyKey: node
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- db2ucluster-roarprds-primary
@trevorbox
trevorbox / envoyfilter-http-header-count-size.yaml
Last active December 14, 2023 15:00
Istio EnvoyFilter to increase http header count and maximum header size.
# tested in OSSM v2.1
# see https://github.com/istio/istio/wiki/EnvoyFilter-Samples for example this was based off of
---
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: http-header-count-size-control
spec:
configPatches:
- applyTo: CLUSTER
@trevorbox
trevorbox / gatekeeper-pod-imagepullpolicy-always.yaml
Created June 30, 2021 22:21
OPA Gatekeeper example: always pull images to ensure that pods do not use images without credentials.
---
apiVersion: operator.gatekeeper.sh/v1alpha1
kind: Gatekeeper
metadata:
name: gatekeeper
spec:
audit:
logLevel: INFO
replicas: 1
image:
@trevorbox
trevorbox / envoyfilter-custom-header-span-x-forwarded-user.yaml
Created March 9, 2021 22:15
Istio EnvoyFilter custom header tag example for adding additional metadata to the span. See https://github.com/istio/istio/issues/22457.
---
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: custom-header-span-x-forwarded-user
namespace: istio-system
spec:
configPatches:
- applyTo: NETWORK_FILTER
match:
@trevorbox
trevorbox / subscriptions-servicemesh.yaml
Created November 3, 2020 15:04
Install Service Mesh operators
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: elasticsearch-operator
spec:
channel: "4.3"
installPlanApproval: Automatic
name: elasticsearch-operator
source: redhat-operators
@trevorbox
trevorbox / servicemeshcontrolplane-production-install.yaml
Last active March 24, 2021 19:00
SMCP that uses production-elasticsearch template for Jaeger traces.
---
apiVersion: maistra.io/v1
kind: ServiceMeshControlPlane
metadata:
name: production-install
spec:
version: v1.1
istio:
gateways:
istio-egressgateway:
@trevorbox
trevorbox / kiali-maistra-label-mismatch.sh
Last active July 22, 2020 23:43
Kiali member and maistra member label mismatch
#!/bin/bash
echo "Starting job at $(date)..."
OUT=$(oc get projects -o go-template=$'{{range .items}}{{with .metadata}}{{if .labels}}{{ $kiali:=("" | or (index .labels "kiali.io/member-of")) }}{{ $maistra:=("" | or (index .labels "maistra.io/member-of")) }}{{if ne $kiali $maistra}}Mismatch => project:{{.name}} kiali.io/member-of:{{$kiali}} maistra.io/member-of:{{$maistra}}\n{{end}}{{end}}{{end}}{{end}}')
echo "$OUT"
if [ -z "$OUT" ]; then echo "No mismatches found."; fi