Skip to content

Instantly share code, notes, and snippets.

View zoetrope's full-sized avatar
😴

Akihiro Ikezoe zoetrope

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

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

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

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

Reconcileの基本実装方針

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

@zoetrope
zoetrope / main.go
Last active June 18, 2020 09:57
cobra sample
package main
import (
"fmt"
"os"
"strings"
"time"
homedir "github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
package main
import (
"bufio"
"context"
"crypto/sha256"
"encoding/hex"
"flag"
"fmt"
"log"
@zoetrope
zoetrope / main.go
Created April 6, 2020 05:10
diff for Kubernetes Resources
package main
import (
"bufio"
"fmt"
"io"
"log"
"os"
"github.com/Cside/jsondiff"
@zoetrope
zoetrope / Dockerfile
Last active August 30, 2019 07:05
Resources are not created when a validating webhook timed out
# Stage1: build from source
FROM quay.io/cybozu/golang:1.12-bionic AS build
COPY main.go /work/main.go
WORKDIR /work
RUN CGO_ENABLED=0 go build -o server ./main.go
# Stage2: setup runtime container
FROM scratch
@zoetrope
zoetrope / calico.yml
Last active April 5, 2019 05:19
setup calico for NetworkPolicy with coil
---
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
name: calico-node
namespace: kube-system
labels:
k8s-app: calico-node
spec:
selector:
import rx.Observable;
import rx.Observer;
import rx.Producer;
import rx.Subscriber;
import rx.schedulers.Schedulers;
import java.util.ArrayList;
import java.util.List;
public class BackPressureSample {
@zoetrope
zoetrope / EmbulkEmbedTest.scala
Created April 30, 2016 05:29
Elasticsearch-2.3を参照しているコードから、EmbulkEmbedを使ってembulk-output-elasticsearchを呼び出すとエラーになる
import java.io.File
import org.embulk.EmbulkEmbed
object EmbulkEmbedTest extends App {
val bootstrap = new EmbulkEmbed.Bootstrap()
val embulkEmbed = bootstrap.initialize()
val loader = embulkEmbed.newConfigLoader()
val yaml = new File(getClass.getClassLoader.getResource("test.yml").getPath)
val config = loader.fromYamlFile(yaml)
@zoetrope
zoetrope / rx.js.async.d.ts
Last active December 28, 2015 07:49
RxJSのrx.async.jsのTypeScript用型定義ファイルがなかったので書いてみた。 動作確認はまだしてない。
///<reference path="rx.js.d.ts" />
declare module Rx {
interface Observable {
/* Observable.startとtoAsyncは、rx.js.d.tsに定義されている。rx.js 2.2でrx.jsからrx.async.jsに移動したのがまだ反映されてない模様。
start<T>(func: () => T, scheduler?: IScheduler, context?: any): IObservable<T>;
toAsync<T>(func: (...args: any[]) => T, scheduler?: IScheduler, context?: any): (...args: any[]) => IObservable<T>;
*/
fromCallback<T>(func: (...args: any[]) => void, scheduler?: IScheduler, context?: any, selector?: (...args: T[])=>T): () => IObservable<T>;
fromNodeCallback<T>(func: (...args: any[]) => void, scheduler?: IScheduler, context?: any, selector?: (...args: any[])=>T): (...args: any[]) => IObservable<T>;