Skip to content

Instantly share code, notes, and snippets.

View akutz's full-sized avatar

Andrew Kutz akutz

View GitHub Profile
@akutz
akutz / README.md
Created December 18, 2022 06:01
VM Operator K8s Write Ops
cd "$(mktemp -d)" && \
git clone 'https://github.com/vmware-tanzu/vm-operator' . && \
s='\.\(\(Create\(Or\(Patch\|' && \
s+='Update\)\)\{0,1\}' && \
s+='\)\|Patch\|Update\)' && \
s+='(\(vm\)\{0,1\}[Cc]tx' && \
grep -rh "${s}" \
  --include '*.go' \
 --exclude '*_test.go' \
@akutz
akutz / README.md
Last active December 18, 2022 06:01
VM Operator K8s Read Ops
cd "$(mktemp -d)" && \
git clone 'https://github.com/vmware-tanzu/vm-operator' . && \
grep -r '\.Get(\(vm\)\{0,1\}[Cc]tx' \
  --include '*.go' \
  --exclude '*_test.go' \
  --exclude-dir test \
  --exclude-dir simplelb . | \
grep -v '^[[:space:]]\{0,\}//' | wc -l
@akutz
akutz / README.md
Last active August 17, 2022 22:56
Generic conditions, patch, simple reconciler packages in Controller-Runtime

Generic conditions, patch, simple reconciler packages

The branch feature/generic-controller leverages generics from Golang 1.18 to support the following enhancements to Controller-Runtime:

  • Port the conditions and patch utilities from Cluster API into Controller-Runtime in such a way they are reusable with any API's types
  • Introduce a new, simple reconciler type to make it even easier for people who want to write a controller using Controller-Runtime

New packages

There are four, new packages:

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: gatewayclasses.networking.x-k8s.io
spec:
@akutz
akutz / buffered_writer.go
Last active June 12, 2020 21:20
Patch-ish for golang#34902
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package http
import (
"bufio"
"io"
"sync"
$ make e2e
docker build --tag="capv-manager:e2e" .
Sending build context to Docker daemon 7.739MB
Step 1/16 : ARG GOLANG_VERSION=golang:1.12.10
Step 2/16 : FROM $GOLANG_VERSION as builder
---> f945ea07f224
Step 3/16 : WORKDIR /workspace
---> Using cache
---> 03ea2598e8a1
Step 4/16 : ARG goproxy=https://proxy.golang.org
@akutz
akutz / README.md
Last active December 20, 2019 16:27

Based on fergal's description:

So we sit behind a VPN. Users create a Network Domain and VLAN (done through F5) and then deploy machines on that VLAN. Machines automatically get a Public IPV6 accessible from outside the VLAN (once connected to VPN) and an IPV4 local to the VLAN. So i want to be able to have the same network setup, where i create a Cluster API Management Node on my own VLAN. But i want that cluster manager to be able to create a Cluster via IPV6 on other VLANs. I dont mind how the cluster itself is set to communicate between its own nodes once set up

The following diagram was created (puml):

fergal-network

@akutz
akutz / terminal-1.sh
Created December 18, 2019 21:27
Debugging CAPV with Andrew's quiver
# The manifests image to use.
export CAPV_MANIFESTS_IMAGE="YOUR_MANIFESTS_IMAGE"
# The name of the cluster to create. This impacts the name of the Kind
# bootstrap cluster as well.
export CLUSTER_NAME="YOUR_CLUSTER_NAME" && \
export KUBECONFIG="$(kind get kubeconfig-path --name "${CLUSTER_NAME}")"
# Generate the manifests
source envvars.txt && \
$ kubectl --kubeconfig /etc/kubernetes/admin.conf -n kube-system logs pod/vsphere-cloud-controller-manager-kzn7v
I1218 02:28:16.874694 1 flags.go:33] FLAG: --address="0.0.0.0"
I1218 02:28:16.875751 1 flags.go:33] FLAG: --allocate-node-cidrs="false"
I1218 02:28:16.875763 1 flags.go:33] FLAG: --allow-untagged-cloud="false"
I1218 02:28:16.875767 1 flags.go:33] FLAG: --alsologtostderr="false"
I1218 02:28:16.875772 1 flags.go:33] FLAG: --authentication-kubeconfig=""
I1218 02:28:16.875777 1 flags.go:33] FLAG: --authentication-skip-lookup="false"
I1218 02:28:16.875780 1 flags.go:33] FLAG: --authentication-token-webhook-cache-ttl="10s"
I1218 02:28:16.875785 1 flags.go:33] FLAG: --authentication-tolerate-lookup-failure="false"
I1218 02:28:16.875789 1 flags.go:33] FLAG: --authorization-always-allow-paths="[/healthz]"
$ make e2e
ginkgo -v ./test/e2e
Running Suite: CAPV e2e Suite
=============================
Random Seed: 1576506353
Will run 1 of 1 specs
STEP: cleaning up previous kind cluster
STEP: initializing the vSphere session
STEP: parsing vSphere server URL