diff --git a/bundle/manifests/authorino-operator.clusterserviceversion.yaml b/bundle/manifests/authorino-operator.clusterserviceversion.yaml index d9b7084f..dd80ebbf 100644 --- a/bundle/manifests/authorino-operator.clusterserviceversion.yaml +++ b/bundle/manifests/authorino-operator.clusterserviceversion.yaml @@ -83,7 +83,7 @@ metadata: capabilities: Basic Install categories: Integration & Delivery containerImage: quay.io/kuadrant/authorino-operator:latest - createdAt: "2024-10-30T16:22:39Z" + createdAt: "2024-11-14T11:17:40Z" operators.operatorframework.io/builder: operator-sdk-v1.32.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/Kuadrant/authorino-operator @@ -320,6 +320,9 @@ spec: - --leader-elect command: - /manager + env: + - name: RELATED_IMAGE_AUTHORINO + value: quay.io/kuadrant/authorino:latest image: quay.io/kuadrant/authorino-operator:latest livenessProbe: httpGet: @@ -422,4 +425,7 @@ spec: minKubeVersion: 1.25.0 provider: name: Red Hat + relatedImages: + - image: quay.io/kuadrant/authorino:latest + name: authorino version: 0.0.0 diff --git a/charts/authorino-operator/templates/manifests.yaml b/charts/authorino-operator/templates/manifests.yaml index 854aa48a..dbfc7ab8 100644 --- a/charts/authorino-operator/templates/manifests.yaml +++ b/charts/authorino-operator/templates/manifests.yaml @@ -5897,6 +5897,9 @@ spec: - --leader-elect command: - /manager + env: + - name: RELATED_IMAGE_AUTHORINO + value: quay.io/kuadrant/authorino:latest image: quay.io/kuadrant/authorino-operator:latest livenessProbe: httpGet: diff --git a/config/deploy/manifests.yaml b/config/deploy/manifests.yaml index 9601202c..23614ed6 100644 --- a/config/deploy/manifests.yaml +++ b/config/deploy/manifests.yaml @@ -5904,6 +5904,9 @@ spec: - --leader-elect command: - /manager + env: + - name: RELATED_IMAGE_AUTHORINO + value: quay.io/kuadrant/authorino:latest image: quay.io/kuadrant/authorino-operator:latest livenessProbe: httpGet: diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 1dc87779..af273067 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -20,6 +20,9 @@ spec: containers: - command: - /manager + env: + - name: RELATED_IMAGE_AUTHORINO + value: quay.io/kuadrant/authorino:latest args: - --leader-elect image: controller:latest diff --git a/controllers/authorino_controller.go b/controllers/authorino_controller.go index dabe2d68..0797af68 100644 --- a/controllers/authorino_controller.go +++ b/controllers/authorino_controller.go @@ -31,6 +31,7 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/env" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -191,8 +192,15 @@ func (r *AuthorinoReconciler) buildAuthorinoDeployment(authorino *api.Authorino) var containers []k8score.Container var saName = authorino.Name + "-authorino" - if authorino.Spec.Image == "" { - authorino.Spec.Image = DefaultAuthorinoImage + image := authorino.Spec.Image + + if image == "" { + image = env.GetString("RELATED_IMAGE_AUTHORINO", DefaultAuthorinoImage) + } + + if image == "" { + // `DefaultAuthorinoImage can be empty string. But image cannot be or deployment will fail + panic("DefaultAuthorinoImage is empty") } var volumes []k8score.Volume @@ -259,8 +267,6 @@ func (r *AuthorinoReconciler) buildAuthorinoDeployment(authorino *api.Authorino) volumes = append(volumes, authorinoResources.GetTlsVolume(authorinoOidcTlsCertVolumeName, secretName)) } - image := authorino.Spec.Image - args := r.buildAuthorinoArgs(authorino) var envs []k8score.EnvVar