Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Custom Kubernetes Controllers at Mercari

Yuki Ito
February 21, 2022

Custom Kubernetes Controllers at Mercari

Yuki Ito

February 21, 2022
Tweet

More Decks by Yuki Ito

Other Decks in Programming

Transcript

  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