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
Last active July 9, 2023 01:36
Comparing semantic version strings in POSIX shell

Overview

The attached script provides a function for comparing semantic versions in a POSIX shell script.

Result Description
-1 A<B
0 A=B
1 A>B

Usage

@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:

@akutz
akutz / semaphore.go
Created April 25, 2016 16:32
Golang Semaphores
package semaphore
import (
"time"
)
// Semaphore enables processes and threads to synchronize their actions.
type Semaphore interface {
// Close closes the semaphore.
@akutz
akutz / README.md
Last active September 29, 2021 06:52
Skeleton Files for Creating a Docker Plug-in with REX-Ray

REX-Ray Docker Plug-in for DRIVER

---
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