docs/images.md
Kubernetes creates containers from images stored in container image registries. It does not currently track and store any information about images; it merely pulls and stores them locally on a minion as part of the pod creation process.
Adding information related to images - image repositories, the images themselves, tags, and metadata - as resources in an image component will provide foundational support for several use cases, listed below.
Example: You create a new image based on SomeUser/AwesomeImage:latest. When the “latest” upstream tag is updated to point at a new image ID, you may want to be notified of the upstream change, and/or have your downstream image automatically rebuilt in response to the upstream update.
Example: I find a great MySQL image that some else has created, but I want to tweak some of the values for the image’s environment variables. I don’t want to build my own copy of the container image with my settings applied because I want to subscribe to the “upstream” image and redeploy my containers when new images arrive.
Questions:
Example: You deploy a pod that uses an upstream Redis image. The image repository is updated, but the deployment component determines that the new pod template isn’t compatible with the current one, because the newer Redis image changed which port is exposed.
Example: A PaaS operator pre-configures a set of image repositories from various container image registries that can be shared by all of the PaaS’s users. Users go to one place to select images instead of searching on the Internet for a registry + image repository.
For registries that support executing hooks when an image/tag is pushed, a user configures the registry to invoke an image component webhook whenever a new image/tag is added to their container image repository.
When a user pushes an image/tag to a container image registry, the registry posts a json payload to the image component and provides the registry URL, image repository name, image ID, image metadata, and the new tag. Upon receiving the payload, the ImageRepository’s metadata overrides are applied to the image’s metadata (not yet implemented) and a new Image is created. The ImageRepository’s map of tags is updated as well.
Notes:
For registries that don’t support image/tag push hooks, a DockerRegistryImageRepositoryWatcher can be configured to poll for changes to an image repository in a container image registry. It would query the registry at a configurable interval, updating the list of tags and image metadata for any images not currently present in the image component.