Skip to content

Instantly share code, notes, and snippets.

@zoetrope
zoetrope / operator-bestpractice.md
Last active October 2, 2023 04:15
Kubernetesオペレータのアンチパターン&ベストプラクティス 補足資料

本資料は、CNDT2021「Kubernetesオペレータのアンチパターン&ベストプラクティス」の補足資料です。

プレゼンの中では説明しきれなかったベストプラクティスの実装を詳細に解説します。

結果が収束するように実装しよう

Reconcileの基本実装方針

プレゼンでも紹介したように、必ず現在の状態をチェックしてから実行すべき処理を決定することになります。

@mizdra
mizdra / git-sy
Last active October 1, 2021 05:02
リモートリポジトリとブランチを良しなに同期してくれる君
#!/usr/bin/env bash
# usage: git sy
set -e
# run に渡されたコマンドを実行しつつ、コマンドの名前をログに出力する
run() {
echo -e "\e[1m+$@\e[0m"
"$@"
}
@rawc0der
rawc0der / crd2jsonschema.sh
Last active August 1, 2025 04:22
Extract openapi JSON schema from Kubernetes CRD manifest
#!/bin/bash
# Small utility function based on yq to extract openAPIV3Schema from CRD
# example: crd2jsonschema.sh ./crd-alertmanager.yaml
set -e
function crd2jsonschema() {
set -e
local xkgroup="x-kubernetes-group-version-kind"
local document="$1"
local openAPIV3Schema=$(mktemp -u)

sysctlで設定可能な項目について調査した内容。

@kurochan
kurochan / domain_filter.py
Last active December 12, 2024 23:10
UnboundでDNSのドメインフィルタリングを実装する方法です
BLOCK_DOMAINS_FILE = "/etc/unbound/block_domains.txt"
block_domains = set()
def load_file(file_name):
try:
with open(file_name, "r") as f:
for line in f:
block_domains.add(line.rstrip())
except IOError:
log_info("pythonmod: failed to load %s" % file_name)
[Unit]
Description=Keep reverse portforward tunnel
After=network.target
[Service]
User=root
Restart=always
RestartSec=5
Type=simple
ExecStart=/usr/bin/ssh -NTv \
@tkrajina
tkrajina / group_waiter.go
Created April 1, 2016 05:19
Golang GroupWaiter (a wrapper aroung WaitGroup)
package main
import (
"errors"
"fmt"
"sync"
"time"
)
type GroupWaiter struct {
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active March 5, 2026 10:16
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx