Skip to content

Commit

Permalink
Add logic for openshift-internal type as imageregistry
Browse files Browse the repository at this point in the history
The hostname of the imageregistry will be registry.<clusterDomain> if
the type is specified as openshift-internal. This hostname will be used
in pipeline and store charts. This is needed for rhdp where we do not
want an external quay account to be set.
  • Loading branch information
darkdoc committed Sep 25, 2024
1 parent 1644542 commit 9c78163
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 22 deletions.
12 changes: 12 additions & 0 deletions charts/hub/quarkuscoffeeshop-pipelines/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{/* vim: set filetype=mustache: */}}

{{/*
Set the hostname for the imageregistry if type is openshift-internal
*/}}
{{- define "quarkuscoffeeshop-pipelines.imageRegistryHostname" -}}
{{- if (eq .Values.global.imageregistry.type "openshift-internal") -}}
registry.{{- .Values.global.hubClusterDomain -}}
{{- else }}
{{- .Values.global.imageregistry.hostname -}}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
metadata:
annotations:
# Tekton magic, see https://tekton.dev/vault/pipelines-v0.15.2/auth/
tekton.dev/docker-0: https://{{ .Values.global.imageregistry.hostname }}
tekton.dev/docker-0: https://{{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}
type: kubernetes.io/basic-auth
dataFrom:
- extract:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
description: Image Tag Value
name: IMAGE_TAG
type: string
- default: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-barista
- default: {{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-barista
name: quay-io-repository
type: string
- default: latest
Expand Down Expand Up @@ -95,7 +95,7 @@ spec:
- name: srcImageURL
value: "docker://image-registry.openshift-image-registry.svc:5000/quarkuscoffeeshop-cicd/quarkuscoffeeshop-barista:$(params.IMAGE_TAG)"
- name: destImageURL
value: "docker://{{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-barista:$(params.IMAGE_TAG)"
value: "docker://{{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-barista:$(params.IMAGE_TAG)"
runAfter:
- tag-test-image
taskRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
description: Image Tag Value
name: IMAGE_TAG
type: string
- default: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-counter
- default: {{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-counter
name: quay-io-repository
type: string
- default: latest
Expand Down Expand Up @@ -95,7 +95,7 @@ spec:
- name: srcImageURL
value: "docker://image-registry.openshift-image-registry.svc:5000/quarkuscoffeeshop-cicd/quarkuscoffeeshop-counter:$(params.IMAGE_TAG)"
- name: destImageURL
value: "docker://{{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-counter:$(params.IMAGE_TAG)"
value: "docker://{{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-counter:$(params.IMAGE_TAG)"
runAfter:
- tag-test-image
taskRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
description: Image Tag Value
name: IMAGE_TAG
type: string
- default: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customerloyalty
- default: {{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customerloyalty
name: quay-io-repository
type: string
- default: latest
Expand Down Expand Up @@ -95,7 +95,7 @@ spec:
- name: srcImageURL
value: "docker://image-registry.openshift-image-registry.svc:5000/quarkuscoffeeshop-cicd/quarkuscoffeeshop-customerloyalty:$(params.IMAGE_TAG)"
- name: destImageURL
value: "docker://{{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customerloyalty:$(params.IMAGE_TAG)"
value: "docker://{{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customerloyalty:$(params.IMAGE_TAG)"
runAfter:
- tag-test-image
taskRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
description: Image Tag Value
name: IMAGE_TAG
type: string
- default: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customermocker
- default: {{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customermocker
name: quay-io-repository
type: string
- default: latest
Expand Down Expand Up @@ -95,7 +95,7 @@ spec:
- name: srcImageURL
value: "docker://image-registry.openshift-image-registry.svc:5000/quarkuscoffeeshop-cicd/quarkuscoffeeshop-customermocker:$(params.IMAGE_TAG)"
- name: destImageURL
value: "docker://{{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customermocker:$(params.IMAGE_TAG)"
value: "docker://{{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customermocker:$(params.IMAGE_TAG)"
runAfter:
- tag-test-image
taskRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
description: Image Tag Value
name: IMAGE_TAG
type: string
- default: {{ .Values.global.imageregistry.hostname }} /{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-inventory
- default: {{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }} /{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-inventory
name: quay-io-repository
type: string
- default: latest
Expand Down Expand Up @@ -95,7 +95,7 @@ spec:
- name: srcImageURL
value: "docker://image-registry.openshift-image-registry.svc:5000/quarkuscoffeeshop-cicd/quarkuscoffeeshop-inventory:$(params.IMAGE_TAG)"
- name: destImageURL
value: "docker://{{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-inventory:$(params.IMAGE_TAG)"
value: "docker://{{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-inventory:$(params.IMAGE_TAG)"
runAfter:
- tag-test-image
taskRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
description: Image Tag Value
name: IMAGE_TAG
type: string
- default: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-kitchen
- default: {{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-kitchen
name: quay-io-repository
type: string
- default: latest
Expand Down Expand Up @@ -95,7 +95,7 @@ spec:
- name: srcImageURL
value: "docker://image-registry.openshift-image-registry.svc:5000/quarkuscoffeeshop-cicd/quarkuscoffeeshop-kitchen:$(params.IMAGE_TAG)"
- name: destImageURL
value: "docker://{{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-kitchen:$(params.IMAGE_TAG)"
value: "docker://{{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-kitchen:$(params.IMAGE_TAG)"
runAfter:
- tag-test-image
taskRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
description: Image Tag Value
name: IMAGE_TAG
type: string
- default: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-web
- default: {{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-web
name: quay-io-repository
type: string
- default: latest
Expand Down Expand Up @@ -95,7 +95,7 @@ spec:
- name: srcImageURL
value: "docker://image-registry.openshift-image-registry.svc:5000/quarkuscoffeeshop-cicd/quarkuscoffeeshop-web:$(params.IMAGE_TAG)"
- name: destImageURL
value: "docker://{{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-web:$(params.IMAGE_TAG)"
value: "docker://{{ include "quarkuscoffeeshop-pipelines.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-web:$(params.IMAGE_TAG)"
runAfter:
- tag-test-image
taskRef:
Expand Down
11 changes: 11 additions & 0 deletions charts/store/quarkuscoffeeshop-charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,14 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Set the hostname for the imageregistry if type is openshift-internal
*/}}
{{- define "quarkuscoffeeshop-charts.imageRegistryHostname" -}}
{{- if (eq .Values.global.imageregistry.type "openshift-internal") -}}
registry.{{- .Values.global.hubClusterDomain -}}
{{- else }}
{{- .Values.global.imageregistry.hostname -}}
{{- end }}
{{- end }}
14 changes: 7 additions & 7 deletions charts/store/quarkuscoffeeshop-charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
spec:
containers:
- name: quarkuscoffeeshop-barista
image: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-barista:{{ .Values.global.quarkuscoffeeshopBarista.imageTag }}
image: {{ include "quarkuscoffeeshop-charts.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-barista:{{ .Values.global.quarkuscoffeeshopBarista.imageTag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 8778
Expand Down Expand Up @@ -63,7 +63,7 @@ spec:
spec:
containers:
- name: quarkuscoffeeshop-inventory
image: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-inventory:{{ .Values.global.quarkuscoffeeshopInventory.imageTag }}
image: {{ include "quarkuscoffeeshop-charts.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-inventory:{{ .Values.global.quarkuscoffeeshopInventory.imageTag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 8778
Expand Down Expand Up @@ -101,7 +101,7 @@ spec:
spec:
containers:
- name: quarkuscoffeeshop-counter
image: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-counter:{{ .Values.global.quarkuscoffeeshopCounter.imageTag }}
image: {{ include "quarkuscoffeeshop-charts.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-counter:{{ .Values.global.quarkuscoffeeshopCounter.imageTag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 8080
Expand Down Expand Up @@ -155,7 +155,7 @@ spec:
spec:
containers:
- name: quarkuscoffeeshop-customermocker
image: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customermocker:{{ .Values.global.quarkuscoffeeshopCustomermocker.imageTag }}
image: {{ include "quarkuscoffeeshop-charts.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customermocker:{{ .Values.global.quarkuscoffeeshopCustomermocker.imageTag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 8080
Expand Down Expand Up @@ -196,7 +196,7 @@ spec:
spec:
containers:
- name: quarkuscoffeeshop-kitchen
image: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-kitchen:{{ .Values.global.quarkuscoffeeshopKitchen.imageTag }}
image: {{ include "quarkuscoffeeshop-charts.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-kitchen:{{ .Values.global.quarkuscoffeeshopKitchen.imageTag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 8080
Expand Down Expand Up @@ -232,7 +232,7 @@ spec:
spec:
containers:
- name: quarkuscoffeeshop-customerloyalty
image: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customerloyalty:{{ .Values.global.quarkuscoffeeshopCustomerloyalty.imageTag }}
image: {{ include "quarkuscoffeeshop-charts.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-customerloyalty:{{ .Values.global.quarkuscoffeeshopCustomerloyalty.imageTag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 8080
Expand Down Expand Up @@ -270,7 +270,7 @@ spec:
spec:
containers:
- name: quarkuscoffeeshop-web
image: {{ .Values.global.imageregistry.hostname }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-web:{{ .Values.global.quarkuscoffeeshopWeb.imageTag }}
image: {{ include "quarkuscoffeeshop-charts.imageRegistryHostname" . }}/{{ .Values.global.imageregistry.account }}/quarkuscoffeeshop-web:{{ .Values.global.quarkuscoffeeshopWeb.imageTag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 8080
Expand Down

0 comments on commit 9c78163

Please sign in to comment.