Custom Resource and Controllers: The new paradigm for programming

Paradigm?

According to Wikipedia, the explanation for paradigm is “In science and philosophy, a paradigm (/ˈpærədaɪm/) is a distinct set of concepts or thought patterns, including theories, research methods, postulates, and standards for what constitutes legitimate contributions to a field.” And this is exactly what Custom Resource + Controllers provide.

Interfaces

Duck typing

Watch this talk on Kubecon: Extending Knative for Fun and Profit - Matt Moore & Ville Aikas, Google

Polymorphism

Watch this talk on Kubecon: Polymorphic Reconcilers in Kubernetes - Advanced DuckTyping - Scott Nichols & Matt Moore, Google

Subresource

see scale subresource in HPA.

Subresources can be either data or service. Think of subresources as virtualized objects, interfaces of CR. If the subresource is data, it is a subset of all CR’s fields to describe a specific aspect; if the subresource is a service, it is the verb to interact with CR object.

  1. status, scale are examples of the former;
  2. log, exec, portforward are examples for the latter.

See https://github.com/kubernetes/kubernetes/issues/72637 for discussions on the support of arbitrary subresources for custom resources.

subresource + controller

Is supporting arbitrary subresource + customized controller too generic to be useful?

Design Patterns

Watch this talk on Kubecon: Growth and Design Patterns in the Extensions Ecosystem - Eric Tune, Google