Skip to content

Instantly share code, notes, and snippets.

@rogerwelin
Last active January 13, 2021 19:56
Show Gist options
  • Save rogerwelin/a6b9a20cfc1a070ec6c91029578fe3f9 to your computer and use it in GitHub Desktop.
Save rogerwelin/a6b9a20cfc1a070ec6c91029578fe3f9 to your computer and use it in GitHub Desktop.

Controllers - execute business logic.
Resources - provide storage and resources.
Webhooks - defaulting, validation, conversion.

Resource stores stuff --> Controller does stuff.

Resources (example Foo resource) are stored in ETCD by the apiserver. Async watch notifications on object create / delete / update from Foo Resource in ETCD to Foo Controller.

  • Request comes in to Request API - apiserver stores it in ETCD
  • after object is stored apiserver sends watch events to clients watching that Resource type
  • Controllers watch Resources types they need to respond to...
  • this is done async

TypeMeta (Kind - Group - Version).

  • Kind (ex. Deployment) - this is name name of the API, conceptually what the object is - like a class name
  • Group (apps) - groups APIs together, like a package in Go or Java
  • Version - defines a version of the API structure and defaults, not about functionality

ObjectMeta (metadata).

  • Name and Namespace - uniquely identify an object for a given resource
  • Labels - key-value pairs that may be queried (selected)

Spec & Status.

  • Spec - Objects desired state (eg how many replicas to run, template for pods etc)
  • Status (shown after apply) - defines the observed state for an object (eg. how many replicas are running)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment