Skip to content

Instantly share code, notes, and snippets.

View neolit123's full-sized avatar

Lubomir I. Ivanov neolit123

  • VMware
  • Varna, BG
View GitHub Profile
@neolit123
neolit123 / _go-types-to-swagger.md
Last active November 15, 2020 21:24
go-types-to-swagger

convert Go type files to swagger.js

usage:

go run main.go --input=k8s.io/kubelet/config/v1beta1/types.go \
  --version=v1beta1 --title=kubelet.config.k8s.io > swagger.json

flags:

@neolit123
neolit123 / _mutate-kubeletconfig-windows.diff
Last active November 14, 2020 23:20
test-mutate-kubeletconfig-windows
diff --git a/cmd/kubeadm/app/apis/kubeadm/types.go b/cmd/kubeadm/app/apis/kubeadm/types.go
index 1759b765513..87557c2b754 100644
--- a/cmd/kubeadm/app/apis/kubeadm/types.go
+++ b/cmd/kubeadm/app/apis/kubeadm/types.go
@@ -451,6 +451,9 @@ type ComponentConfig interface {
// SetUserSupplied sets the state of the component config "user supplied" flag to, either true, or false.
SetUserSupplied(userSupplied bool)
+
+ // Mutate allows applying pre-defined modifications to the config before it's marshaled.
@neolit123
neolit123 / testing-ha-kinder.md
Last active July 5, 2020 21:13
testing-ha-kinder

testing concurrent join failures with kinder

this is a short guide for testing concurrent HA cluster join with kinder. currently it requires patching both kubeadm and kinder.

you need:

  • go 1.12+
  • docker 18.0{6|9} (known to work)
  • clones of kuberentes/kubeadm and kubernetes/kubernetes
  • a host machine with a good chunk of RAM and 2 CPU cores
@neolit123
neolit123 / test.c
Last active May 11, 2020 20:38
compare-RtlGenRando-BCryptGenRandom
// performance comparison between RtlGenRandom and BCryptGenRandom
// with BCRYPT_USE_SYSTEM_PREFERRED_RNG.
//
// gcc -O3 -std=c99 -Wall test.c -lbcrypt && a
#include <windows.h>
#include <stdio.h>
#include <bcrypt.h>
BOOLEAN(APIENTRY *RtlGenRandom)
(void *, ULONG);
@neolit123
neolit123 / kwebsite-rebase.sh
Created March 16, 2020 23:09
kwebsite-rebase
# `origin` is this repository, 'github' is the remote fork
# and '1.18-kubeadm-upgrade' is the remote branch
git checkout 1.18-kubeadm-upgrade
# create a patch between current PR branch and dev-1.18
# results in '0001-kubeadm-update-upgrade-documentation-for-1.18.patch'
git format-patch dev-1.18
git checkout master
# delete old branches
# at this point dev-1.18 was rebased remoteley and just pulling it locally
# would cause conflicts.
@neolit123
neolit123 / exponential-backoff.go
Created January 20, 2020 00:19
exponential-backoff
package main
import (
"bufio"
"fmt"
"math"
"math/rand"
"os"
"strconv"
"time"
@neolit123
neolit123 / _summary.md
Last active October 11, 2019 21:52
ci/latest-failures

the bellow bash script (k8s-release-dev-debug.sh) was executed for about 1 hour until it started catching problems in the cross-build.

it fetches versions using:

  • gsutil cat gs://kubernetes-release-dev/ci/latest.txt
  • gsutil cat gs://kubernetes-release-dev/ci/latest-bazel.txt

and based on the versions tries to gsutil ls the contents of:

@neolit123
neolit123 / e2e-deps-1470df7a052eeed0
Created April 1, 2019 23:01
test/e2e deps after 1470df7a052eeed0
bufio
bytes
compress/gzip
context
crypto/rand
crypto/rsa
crypto/sha256
crypto/tls
crypto/x509
crypto/x509/pkix
@neolit123
neolit123 / high-availability.md
Last active March 12, 2019 15:28
setup/independent/high-availability.md
reviewers title content_template weight
sig-cluster-lifecycle
Creating Highly Available Clusters with kubeadm
templates/task
60

{{% capture overview %}}

@neolit123
neolit123 / yaml-kubelet-bug.go
Last active November 10, 2018 15:49
yaml-kubelet-bug.go
package main
import (
"fmt"
"k8s.io/kubernetes/pkg/kubelet/apis/config"
"sigs.k8s.io/yaml"
)
// https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/apis/config/types.go