Skip to content

Commit

Permalink
Merge pull request #229 from Kuadrant/authorino-version-from-env-var
Browse files Browse the repository at this point in the history
RELATED_IMAGE_AUTHORINO env var
  • Loading branch information
eguzki authored Nov 14, 2024
2 parents 66594a6 + f0150c1 commit ee36d38
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
3 changes: 3 additions & 0 deletions charts/authorino-operator/templates/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions config/deploy/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions controllers/authorino_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit ee36d38

Please sign in to comment.