Skip to content

Commit

Permalink
support image digests for disconnected environments
Browse files Browse the repository at this point in the history
  • Loading branch information
jmazzitelli committed Sep 27, 2021
1 parent f00c245 commit ea01260
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
8 changes: 7 additions & 1 deletion deploy/kiali/kiali_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ spec:
# api_version: "autoscaling/v2beta2"
# spec: {}
#
# If image_version is a digest hash, this value indicates what type of digest it is.
# A typical value would be "sha256". Note: do NOT prefix this value with a "@".
# ---
# image_digest: ""
#
# Determines which Kiali image to download and install.
# If you set this to a specific name (i.e. you do not leave it as the default empty string),
# you must make sure that image is supported by the operator.
Expand All @@ -252,7 +257,8 @@ spec:
# Choose "lastrelease" to use the last Kiali release.
# Choose "latest" to use the latest image (which may or may not be a released version of Kiali).
# Choose "operator_version" to use the image whose version is the same as the operator version.
# Otherwise, you can set this to any valid Kiali version (such as "v1.0").
# Otherwise, you can set this to any valid Kiali version (such as "v1.0") or any valid Kiali
# digest hash (if you set this to a digest hash, you must indicate the digest in image_digest).
# Note that if this is set to "latest" then the image_pull_policy will be "Always".
# If you set this to a specific version (i.e. you do not leave it as the default empty string),
# you must make sure that image is supported by the operator.
Expand Down
1 change: 1 addition & 0 deletions roles/default/kiali-deploy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ kiali_defaults:
hpa:
api_version: "autoscaling/v2beta2"
spec: {}
image_digest: ""
image_name: ""
image_pull_policy: "IfNotPresent"
image_pull_secrets: []
Expand Down
4 changes: 2 additions & 2 deletions roles/default/kiali-deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@

- name: Only allow ad-hoc kiali image when appropriate
fail:
msg: "The operator is forbidden from accepting a Kiali CR that defines an ad hoc Kiali image [{{ kiali_vars.deployment.image_name }}:{{ kiali_vars.deployment.image_version }}]. Remove spec.deployment.image_name and spec.deployment.image_version from the Kiali CR."
msg: "The operator is forbidden from accepting a Kiali CR that defines an ad hoc Kiali image [{{ kiali_vars.deployment.image_name }}{{ '@' + kiali_vars.deployment.image_digest if kiali_vars.deployment.image_digest != '' else '' }}:{{ kiali_vars.deployment.image_version }}]. Remove spec.deployment.image_name, spec.deployment.image_version, and spec.deployment.image_digest from the Kiali CR."
when:
- kiali_vars.deployment.image_name != "" or kiali_vars.deployment.image_version != ""
- kiali_vars.deployment.image_name != "" or kiali_vars.deployment.image_version != "" or kiali_vars.deployment.image_digest != ""
- lookup('env', 'ALLOW_AD_HOC_KIALI_IMAGE') | default('false', True) != "true"

- name: Default the image name to a known supported image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
{% endfor %}
{% endif %}
containers:
- image: {{ kiali_vars.deployment.image_name }}:{{ kiali_vars.deployment.image_version }}
- image: {{ kiali_vars.deployment.image_name }}{{ '@' + kiali_vars.deployment.image_digest if kiali_vars.deployment.image_digest != "" else "" }}:{{ kiali_vars.deployment.image_version }}
imagePullPolicy: {{ kiali_vars.deployment.image_pull_policy }}
name: kiali
command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
{% endfor %}
{% endif %}
containers:
- image: {{ kiali_vars.deployment.image_name }}:{{ kiali_vars.deployment.image_version }}
- image: {{ kiali_vars.deployment.image_name }}{{ '@' + kiali_vars.deployment.image_digest if kiali_vars.deployment.image_digest != "" else "" }}:{{ kiali_vars.deployment.image_version }}
imagePullPolicy: {{ kiali_vars.deployment.image_pull_policy }}
name: kiali
command:
Expand Down

0 comments on commit ea01260

Please sign in to comment.