Image Controller

Overview

Image controller sets up and manages container image repositories in configured quay.io organization. It works either for general purpose image repository or Component-specific image repository.

The image controller can perform multiple actions with use of ImageRepository custom resources.

Dependencies

Image controller does not depend on other Konflux services, but a remote image registry. Konflux services are able to use the resources prepared by image controller, e.g. ServiceAccount with linked Secrets is available to every build PipelineRun of a component for pushing image.

Controllers

The Image Controller contains these controllers:

Interface

ImageRepository CR

The ImageRepository CR is the interface to interact with image controller to create and manage image repositories in a registry.

To create an general purpose image repository, apply this YAML code:

apiVersion: appstudio.redhat.com/v1alpha1
kind: ImageRepository
metadata:
    name: imagerepository-for-component-sample
    namespace: test-ns

As a result, a public image repository quay.io/my-org/test-ns/imagerepository-for-component-sample will be created, based on $DEFAULT_REGISTRY_ORG/$USER_NAMESPACE/$IMAGE_REPOSITORY_NAME.

Two robot accounts and corresponding Kubernetes Secrets for push and pull are created.

To create an image repository for a Component, apply this YAML code:

apiVersion: appstudio.redhat.com/v1alpha1
kind: ImageRepository
metadata:
    name: imagerepository-for-component-sample
    namespace: test-ns
    annotations:
        image-controller.appstudio.redhat.com/update-component-image: 'true'
    labels:
        appstudio.redhat.com/component: my-component
        appstudio.redhat.com/application: my-app

As a result, a public image repository quay.io/my-org/test-ns/my-component will be created, based on $DEFAULT_REGISTRY_ORG/$USER_NAMESPACE/$COMPONENT_NAME.

Two robot accounts and corresponding Kubernetes Secrets for push and pull are created.

It will also link push secret to component specific service account build-pipeline-$COMPONENT_NAME used for build pipelines (secrets section).

And it will also link pull secret to application specific service account $APPLICATION_NAME-pull (to both secrets and imagePullSecrets sections).

Annotation image-controller.appstudio.redhat.com/update-component-image is required when using ImageRepository with Component, as it will set Component’s spec.containerImage allowing Build service controller to continue.

User defined repository name

One may request custom image repository name by setting spec.image.name field upon the ImageRepository object creation, but it will always be prepended by $DEFAULT_REGISTRY_ORG/$USER_NAMESPACE.

e.g. when spec.image.name is set to my-repository final repository url will be $DEFAULT_REGISTRY_ORG/$USER_NAMESPACE/my-repository.

Note, it’s not possible to change image repository name after creation. Any changes to the field will be reverted by the operator.

Setting quay.io notifications

Notifications can be set with:

spec:
  notifications:
  - config:
      url: https://bombino.api.redhat.com/v1/sbom/quay/push
    event: repo_push
    method: webhook
    title: SBOM-event-to-Bombino

Changing repository visibility

By default, a public image repository is created. To change the image repository visibility, set public or private to .spec.image.visibility.

Credentials rotation for repository

To regenerate tokens push and pull, set true to .spec.credentials.regenerate-token, it will also re-create secrets.

After token rotation, the spec.credentials.regenerate-token section will be deleted and status.credentials.generationTimestamp updated.

Verify and fix secrets linked to ServiceAccount

To perform verification and fix, set true to .spec.credentials.verify-linking.

After verification, the spec.credentials.verify-linking section will be deleted.

Skip repository deletion

By default, if the ImageRepository resource is deleted, the repository it created in registry will get deleted as well.

In order to skip the removal of the repository, set true to image-controller.appstudio.redhat.com/skip-repository-deletion annotation.

Status explanation

ImageRepository CR has .status which includes all final information about an image repository:

status:
  credentials:
    generationTimestamp: '2025-03-21T14:28:59Z'
    pull-robot-account: test_pull
    pull-secret: imagerepository-for-test-image-pull
    push-robot-account: test_push
    push-secret: imagerepository-for-test-image-push
  image:
    url: quay.io/redhat-user-workloads/test-tenant/test
    visibility: public
  notifications:
    - title: SBOM-event-to-Bombino
      uuid: aaaaa-......
  state: ready

Legacy interaction via Component annotations

Image controller uses annotations to interact with external services.