Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Kutz akutz

View GitHub Profile
@akutz
akutz / README.md
Last active Aug 17, 2022
Generic conditions, patch, simple reconciler packages in Controller-Runtime
View README.md

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:

View gwc.yaml
---
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 Jun 12, 2020
Patch-ish for golang#34902
View buffered_writer.go
// 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"
View capv-ha-e2e.sh
$ 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
View README.md

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 Dec 18, 2019
Debugging CAPV with Andrew's quiver
View terminal-1.sh
# 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 && \
View cloud-provider.log
$ 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]"
View capv-e2e-md.log
$ 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
View capv-v1alpha3-e2e-success.sh
$ make e2e
kind delete cluster --name mgmt || true
Deleting cluster "mgmt" ...
docker pull gcr.io/k8s-staging-cluster-api/cluster-api-controller:master
master: Pulling from k8s-staging-cluster-api/cluster-api-controller
Digest: sha256:5cc801d5ccd29ec8868f4f04ba425d5465a96ac342ac32536fe1df501efb5bde
Status: Image is up to date for gcr.io/k8s-staging-cluster-api/cluster-api-controller:master
gcr.io/k8s-staging-cluster-api/cluster-api-controller:master
ginkgo test -v ./test/e2e
Running Suite: CAPV e2e Suite
View controllers_test.go
package controllers_test
import (
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"