Custom Kubernetes Controllers at Mercari

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →
Yuki Ito
February 21, 2022

Custom Kubernetes Controllers at Mercari

Yuki Ito

February 21, 2022

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

23 slides
  1. spanner-autoscaler apiVersion: spanner.mercari.com/v1alpha1 kind: SpannerAutoscaler metadata: name: spannerautoscaler-sample namespace: your-namespace

    spec: scaleTargetRef: projectId: your-gcp-project-id instanceId: your-spanner-instance-id minNodes: 1 maxNodes: 4 maxScaleDownNodes: 1 targetCPUUtilization: highPriority: 60 Autoscaler for the Google Cloud Spanner Instances
  2. Bootes Bootes Namespace: a Namespace: b app: foo app: bar

    app: foo app: bar app: foo app: bar Namespace: c xDS Control Plane Kubernetes Controller
  3. Bootes xDS Control Plane Kubernetes Controller apiVersion: bootes.io/v1 kind: Cluster

    metadata: name: example-cluster namespace: foo spec: config: name: example-cluster connect_timeout: 1s type: EDS lb_policy: ROUND_ROBIN http2_protocol_options: {} eds_cluster_config: eds_config: ads: {}
  4. De fi ne CRDs as Protocol Buffers message Repository {

    string owner = 1; string repository = 2; } type Repository struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Owner string `protobuf:...` Repository string `protobuf:...` } Protocol Buffers func (in *Repository) DeepCopyInto(out *Repository) { p := proto.Clone(in).(*Repository) *out = *p } func (in *Repository) DeepCopy() *Repository { if in == nil { return nil } out := new(Repository) in.DeepCopyInto(out) return out } protoc-gen-go protoc-gen-deepcopy
  5. De fi ne CRDs as Protocol Buffers type Repository struct

    { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Owner string `protobuf:...` Repository string `protobuf:...` } Protocol Buffers protoc-gen-go type Repository struct { v1.TypeMeta v1.ObjectMeta // Proto Buffer Struct Spec apisv1alpha1.Repository } kubetype-gen
  6. De fi ne CRDs as Protocol Buffers Protocol Buffers protoc-gen-go

    / protoc-gen-deepcopy Protocol Buffer Go Struct (+ DeepCopy) Kubernetes Go Types Custom Resource De fi nitions (YAML) kubetype-gen controller-gen
  7. De fi ne CRDs as Protocol Buffers Protocol Buffers Advanced

    Custom Resource De fi nitions (YAML) istio /tools / cue-gen

More Decks by Yuki Ito

Other Decks in Programming