Skip to content

Instantly share code, notes, and snippets.

@zparnold
zparnold / k8srequiredprobes.yaml
Last active August 23, 2022 12:11
A Gatekeeper Constraint Template (for AKS's implementation of Gatekeeper) capable of requiring liveness, readiness, and startup probes with exclusions for pod labels and container names
apiVersion: templates.gatekeeper.sh/v1beta1
kind: ConstraintTemplate
metadata:
name: k8sazurecontainerprobesrequired
spec:
crd:
spec:
names:
kind: K8sAzureContainerProbesRequired
validation:
@zparnold
zparnold / line_counter.go
Created September 25, 2020 17:26
You can use this to count all the lines in a directory
package main
import (
"bytes"
"fmt"
"io"
"log"
"math/big"
"os"
"path/filepath"
@zparnold
zparnold / main.tf
Last active January 6, 2024 09:18
The combined Terraform file for creating a very simple EKS cluster
variable "cluster-name" {
default = "terraform-eks-demo"
type = string
}
# This data source is included for ease of sample architecture deployment
# and can be swapped out as necessary.
data "aws_availability_zones" "available" {}
resource "aws_vpc" "demo" {
helm plugin install https://github.com/hypnoglow/helm-s3.git
helm repo add zparnold s3://zparnold-helm/charts
helm install zparnold/hacksploit
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: manager-service
spec:
hosts:
- "ops.acceptance.ygreneworks.com"
gateways:
- manager-gateway
http:
apiVersion: "networking.istio.io/v1alpha3"
kind: "DestinationRule"
metadata:
name: "manager-istio-client-mtls"
spec:
host: ygrene-manager-service.acceptance.svc.cluster.local
trafficPolicy:
tls:
mode: ISTIO_MUTUAL
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: stripe-external
spec:
hosts:
- "api.stripe.com"
ports:
- number: 443
name: https
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: stripe-external
spec:
hosts:
- "api.stripe.com"
tls:
- match:
- port: 443
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: rds
spec:
addresses:
- "172.20.0.0/16"
ports:
- name: tcp
number: 3306
@zparnold
zparnold / deploy.sh
Created June 28, 2018 17:08
Kubernetes Rails Deploy Script
#!/bin/bash
set -e
function getPods() {
local val='';
while [ true ]; do
val=`kubectl get pods -n ${NAMESPACE} --selector="name=${1}" -o $2`
if [[ $val != '' ]] || [[ $? -eq 0 ]]; then break; fi
done
echo "${val}"