Skip to content

Instantly share code, notes, and snippets.

@alexeldeib
alexeldeib / main.go
Created December 8, 2019 18:42
ast parsing
package main
import (
"bytes"
"fmt"
"go/ast"
"go/format"
"go/parser"
"go/token"
"log"
@alexeldeib
alexeldeib / Dockerfile
Created December 17, 2019 08:01
imds sced
# ------------------------------------------------------------------------------
# Cargo Build Stage
# ------------------------------------------------------------------------------
FROM rust:latest as cargo-build
ARG APP=blah
ENV APP=$APP
ENV USER=root
@alexeldeib
alexeldeib / main.go
Created January 11, 2020 01:38
resource builder -> type runtime.Object
package main
import (
"fmt"
"os"
"github.com/go-logr/logr"
"github.com/go-logr/zapr"
"github.com/sanity-io/litter"
"github.com/spf13/pflag"
@alexeldeib
alexeldeib / stress.yaml
Last active January 14, 2020 09:08
high i/o stressng workload
apiVersion: stressed.jpang.dev/v1alpha1
kind: Test
metadata:
name: test-sample
namespace: default
spec:
replicas: 1
image: jpangms/stress-ng:latest
nodeSelector:
kubernetes.io/os: linux
@alexeldeib
alexeldeib / deploy.yaml
Created January 14, 2020 18:10
privileged pod with access to host modules
apiVersion: apps/v1
kind: Deployment
metadata:
name: &name debug
labels:
app: *name
spec:
replicas: 1
selector:
matchLabels:
@alexeldeib
alexeldeib / apply.yaml
Last active January 15, 2020 12:34
deployment to test remote apply programmatically
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: apply
name: apply
namespace: default
spec:
replicas: 1
@alexeldeib
alexeldeib / apply.go
Last active January 16, 2020 03:49
apply runtime objects from urls approximation
// // Build and apply kustomized objects
// if obj.Spec.Kustomizations != nil {
// // Initialize for kustomization
// // ace: can't use memfs until git cloner is fixed upstream
// // ace: real fs + git exec used here https://github.com/kubernetes-sigs/kustomize/blob/186df6f7c8aa28774be8f54fa000bf99e95642d6/api/filesys/confirmeddir.go#L20-L31
// fs := filesys.MakeFsOnDisk()
// koptions := krusty.MakeDefaultOptions()
// kustomizer := krusty.MakeKustomizer(fs, koptions)
// // Potentially we may have many kustomizations to apply.
@alexeldeib
alexeldeib / main.go
Last active January 16, 2020 22:41
Discover all GVKs for controller
/*
Copyright 2020 Alexander Eldeib.
*/
package main
import (
"flag"
"os"
@alexeldeib
alexeldeib / job
Last active February 9, 2020 09:23
Fio test jobs for Azure disks
[global]
name=fio-rand-RW
ioengine=libaio
rw=randrw
rwmixread=100
bs=4K
direct=1
time_based=1
runtime=60
iodepth=64
@alexeldeib
alexeldeib / deploy.yaml
Last active November 8, 2024 19:13
Privileged pod with hostNetwork and hostPid
apiVersion: apps/v1
kind: Deployment
metadata:
name: &name debug2
labels:
app: *name
spec:
replicas: 1
selector:
matchLabels: