Skip to content

Commit

Permalink
Fix upgrade v2 script image rename
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored and pmalek-sumo committed Dec 29, 2020
1 parent 23a8f28 commit 423f2ea
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
8 changes: 8 additions & 0 deletions deploy/helm/sumologic/upgrade-2.0.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -621,13 +621,21 @@ function get_regex() {

function check_user_image() {
# Check user's image and echo warning if the image has been changed
local USER_VERSION
readonly USER_VERSION="$(yq r "${OLD_VALUES_YAML}" -- image.tag)"
local USER_IMAGE_REPOSITORY
readonly USER_IMAGE_REPOSITORY="$(yq r "${OLD_VALUES_YAML}" -- image.repository)"
if [[ -n "${USER_VERSION}" ]]; then
if [[ "${USER_VERSION}" =~ ^"${PREVIOUS_VERSION}"\.[[:digit:]]+$ ]]; then
info "Migrating from image.tag '${USER_VERSION}' to sumologic.setup.job.image.tag '2.0.0'"
yq w -i "${TEMP_FILE}" -- sumologic.setup.job.image.tag 2.0.0
info "Migrating from image.repository '${USER_IMAGE_REPOSITORY}' to sumologic.setup.job.image.repository 'public.ecr.aws/sumologic/kubernetes-setup'"
yq w -i "${TEMP_FILE}" -- sumologic.setup.job.image.repository "public.ecr.aws/sumologic/kubernetes-setup"

info "Migrating from image.tag '${USER_VERSION}' to fluentd.image.tag '2.0.0'"
yq w -i "${TEMP_FILE}" -- fluentd.image.tag 2.0.0
info "Migrating from image.repository '${USER_IMAGE_REPOSITORY}' to fluentd.image.repository 'public.ecr.aws/sumologic/kubernetes-fluentd'"
yq w -i "${TEMP_FILE}" -- fluentd.image.repository "public.ecr.aws/sumologic/kubernetes-fluentd"
else
warning "You are using unsupported version: ${USER_VERSION}"
warning "Please upgrade to '${PREVIOUS_VERSION}.x' or ensure that new_values.yaml is valid"
Expand Down
2 changes: 0 additions & 2 deletions tests/upgrade_v2_script/static/image_rename.input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ image:
tag: 1.3.0
pullPolicy: IfNotPresent

nameOverride: ""

sumologic:
### Setup
## If enabled, a pre-install hook will create Collector and Sources in Sumo Logic
Expand Down
2 changes: 2 additions & 0 deletions tests/upgrade_v2_script/static/image_rename.log
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
[INFO] - sumologic.setup.job.image.pullPolicy

[INFO] Migrating from image.tag '1.3.0' to sumologic.setup.job.image.tag '2.0.0'
[INFO] Migrating from image.repository 'sumologic/kubernetes-fluentd' to sumologic.setup.job.image.repository 'public.ecr.aws/sumologic/kubernetes-setup'
[INFO] Migrating from image.tag '1.3.0' to fluentd.image.tag '2.0.0'
[INFO] Migrating from image.repository 'sumologic/kubernetes-fluentd' to fluentd.image.repository 'public.ecr.aws/sumologic/kubernetes-fluentd'

Thank you for upgrading to v2.0.0 of the Sumo Logic Kubernetes Collection Helm chart.
A new yaml file has been generated for you. Please check the current directory for new_values.yaml.
5 changes: 2 additions & 3 deletions tests/upgrade_v2_script/static/image_rename.output.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fluentd:
image:
repository: sumologic/kubernetes-fluentd
repository: public.ecr.aws/sumologic/kubernetes-fluentd
tag: 2.0.0
pullPolicy: IfNotPresent
logLevel: info
Expand All @@ -12,11 +12,10 @@ sumologic:
setup:
job:
image:
repository: sumologic/kubernetes-fluentd
repository: public.ecr.aws/sumologic/kubernetes-setup
tag: 2.0.0
pullPolicy: IfNotPresent
setupEnabled: true
cleanUpEnabled: false
accessId: dummy
accessKey: dummy
nameOverride:

0 comments on commit 423f2ea

Please sign in to comment.