Skip to content

Instantly share code, notes, and snippets.

View kvaps's full-sized avatar
🔳
This mess is mine!

Andrei Kvapil kvaps

🔳
This mess is mine!
View GitHub Profile
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: test
namespace: test
spec:
clusterNetwork:
pods:
cidrBlocks:
@kvaps
kvaps / fix.sh
Last active November 15, 2023 14:14
LINSTOR fix wrong storage pool in version before 1.25 (error: Storage driver 'LVM_THIN' not allowed for volume.)
# make backup
kubectl get crds | grep -o ".*.internal.linstor.linbit.com" | xargs kubectl get crds -ojson > crds.json
kubectl get crds | grep -o ".*.internal.linstor.linbit.com" | xargs -i{} sh -xc "kubectl get {} -ojson > {}.json"
---
# collect resources in weird states:
cat resources.internal.linstor.linbit.com.json | jq '.items[] | select(.spec.resource_flags>1024) | "\(.spec.resource_name) \(.spec.node_name) \(.spec.resource_flags)"' -r > list.txt
# reset them to 0:
@kvaps
kvaps / loop.sh
Created October 16, 2023 22:27
mydumper/myload
#!/bin/bash
set -e -o pipefail
user=root
password=hackme
host=127.0.0.1
port=3306
dbs=$(mysql -u$user -p$password -h$host -P$port -e 'SHOW DATABASES;' | tail -n+2)
@kvaps
kvaps / talos-build.sh
Created August 16, 2023 08:48
How to build talos with custom kernel extensions
# Builds pkg
cd ./pkgs
make USERNAME=kvaps/talos PLATFORM=linux/amd64 PUSH=1
# Builds extensions with specific PKGS
cd ./extensions
make installer USERNAME=kvaps/talos PLATFORM=linux/amd64 PUSH=1 PKGS=v1.4.1-14-ge911ac5-dirty
# Builds talos (clean)
cd ./talos
@kvaps
kvaps / node-bootstrup.sh
Created August 14, 2023 18:36
Add external kubeadm node to Talos cluster
VIP="192.168.100.5"
mkdir -p /etc/kubernetes/pki
talosctl -n "$VIP" cat /etc/kubernetes/kubeconfig-kubelet > /etc/kubernetes/kubelet.conf
talosctl -n "$VIP" cat /etc/kubernetes/bootstrap-kubeconfig > /etc/kubernetes/bootstrap-kubelet.conf
talosctl -n "$VIP" cat /etc/kubernetes/pki/ca.crt > /etc/kubernetes/pki/ca.crt
sed -i "/server:/ s|:.*|: https://${VIP}:6443|g" \
/etc/kubernetes/kubelet.conf \
/etc/kubernetes/bootstrap-kubelet.conf
@kvaps
kvaps / .gitignore
Created July 25, 2023 20:06 — forked from mcastelino/.gitignore
cloud-init ubuntu nocloud example with network config
*.img
*.raw
@kvaps
kvaps / .gitignore
Created March 10, 2023 15:08 — forked from smoser/.gitignore
cloud-init ubuntu nocloud example with network config
*.img
*.raw
// SPDX-License-Identifier: GPL-2.0-or-later
/*
drbd_transport_rdma.c
This file is part of DRBD.
Copyright (C) 2014-2021, LINBIT HA-Solutions GmbH.
*/
#undef pr_fmt
@kvaps
kvaps / convert-deploymentconfig-to-deployment.md
Created January 25, 2022 09:10 — forked from bmaupin/convert-deploymentconfig-to-deployment.md
Convert OpenShift DeploymentConfig to Kubernetes Deployment
  1. Change apiVersion from:

    - apiVersion: v1

    (or apiVersion: apps.openshift.io/v1)

    to:

@kvaps
kvaps / test_disk.sh
Last active January 6, 2024 04:20
Test disk with fio and parse results
#!/bin/sh
run(){
name="$1"
shift
(
set -x
# defailt parameters
fio -name="$name" -filename=$disk -output-format=json -ioengine=libaio -direct=1 -randrepeat=0 "$@" > results/$disk_dashed-$name.json
)