Skip to content

Instantly share code, notes, and snippets.

View DrPsychick's full-sized avatar
🤔

DrPsychick DrPsychick

🤔
View GitHub Profile
@DrPsychick
DrPsychick / user-data
Last active November 13, 2022 00:10
Ubuntu autoinstall user-data for Ubuntu server build with Packer
#cloud-config
# https://ubuntu.com/server/docs/install/autoinstall-reference
autoinstall:
version: 1
refresh-installer:
update: yes
early-commands:
- systemctl stop ssh
locale: en_US.UTF-8
keyboard:
@DrPsychick
DrPsychick / ubuntu2204-base.pkrvars.hcl
Created November 12, 2022 16:34
Packer variables for Ubuntu server build
iso_url = "https://releases.ubuntu.com/22.04/ubuntu-22.04.1-live-server-amd64.iso"
iso_checksum = "sha256:10f19c5b2b8d6db711582e0e27f5116296c34fe4b313ba45f9b201a5007056cb"
@DrPsychick
DrPsychick / ubuntu-base.pkr.hcl
Last active November 13, 2022 00:08
Packer build for Ubuntu Server ISO
variables {
iso_url = ""
iso_checksum = "sha256:"
build_dir = "/data/images/build"
build_name = "ubuntu2204"
output_dir = "/data/images/output"
image_name = "ubuntu2204-base"
http_dir = "packer/linux/base/cloudinit/ubuntu2204-autoinstall"
}
@DrPsychick
DrPsychick / gitlab-local.md
Last active February 2, 2024 08:18
Run gitlab-ci jobs locally

Run/Test GitLab CI Pipeline jobs locally

  • cd into your project directory

Hints

@DrPsychick
DrPsychick / k8s-instance-funcs.sh
Last active April 19, 2021 17:36
Generic shell functions for common k8s commands
## some generic functions based on `app.kubernetes.io/instance` label
# list pods including instance label
function k8s.pod() {
kubectl get pod -L app.kubernetes.io/instance
}
# list deployments including instance label
function k8s.deployment() {
kubectl get deployment -L app.kubernetes.io/instance
@DrPsychick
DrPsychick / backup-restore-certificates.sh
Created December 30, 2020 23:38
backup and restore certificates of your kubernetes cluster to avoid running into letsencrypt issuing limits
#!/bin/bash
if [ -z "$1" -o -z "$2" ]; then
echo "Usage: $0 backup|restore <cluster-name> [certificates.yml]"
exit 1
fi
kube_context="kind-$2"
secrets="$3"
if [ "$1" == "backup" ]; then
#!/bin/bash
set -e
# update IP addresses in configs in k8s and on kind master node
# * this is ugly, but the only way to avoid recreating the cluster after restart
export PATH=$PATH:/usr/local/bin
if [ -z "$1" ]; then
echo "Usage: $0 <kind-cluster-name>"
exit 1
@DrPsychick
DrPsychick / update_cert.sh
Last active December 29, 2020 13:52
Update `kind` node IPs in configuration
#!/bin/bash
set -e
# updates the API certificate with new DNSs and IPs
# 1. fetch CA + existing cert
# 2. extract AltNames and update AltNames
# 3. create new cert
# 4. upload and use it in API pod
if [ -z "$1" ]; then
@DrPsychick
DrPsychick / git-funcs.sh
Last active April 19, 2021 20:02
Simple bash functions to automate GitHub branches and pull requests
#!/bin/bash
# Workflow: create branch -> create pull request
# git-create-branch-push "issue X"
# -> make changes, commit and push
# github-branch-pr "fix: issue solved" "closes #x"
# -> creates new PR with title and body
#
# Workflow: create branch for issue -> create pull request
# github-issue-branch-push 10
@DrPsychick
DrPsychick / telegraf.conf
Created August 28, 2020 17:06
Telegraf Windows Performance Counters configuration
# Windows Performance Counters plugin.
# These are the recommended method of monitoring system metrics on windows,
# as the regular system plugins (inputs.cpu, inputs.mem, etc.) rely on WMI,
# which utilize more system resources.
#
# See more configuration examples at:
# https://github.com/influxdata/telegraf/tree/master/plugins/inputs/win_perf_counters
# If metrics are missing run `lodctr /r` as Administrator
[[inputs.win_perf_counters]]