Skip to content

Commit

Permalink
fix: v2 migration script - migrate fluent-bit.image.fluent_bit key in…
Browse files Browse the repository at this point in the history
…stead of deleting it
  • Loading branch information
perk-sumo committed Feb 19, 2021
1 parent f6dbd68 commit b8d9c62
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
11 changes: 10 additions & 1 deletion deploy/helm/sumologic/upgrade-2.0.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ readonly MAX_YQ_VERSION=4.0.0
readonly KEY_MAPPINGS="
prometheus-operator.prometheusOperator.tlsProxy.enabled:kube-prometheus-stack.prometheusOperator.tls.enabled
otelcol.deployment.image.name:otelcol.deployment.image.repository
fluent-bit.image.fluent_bit.repository:fluent-bit.image.repository
fluent-bit.image.fluent_bit.tag:fluent-bit.image.tag
"

readonly KEY_VALUE_MAPPINGS="
Expand All @@ -31,7 +33,6 @@ prometheus-operator
fluent-bit.metrics
fluent-bit.trackOffsets
fluent-bit.service.flush
fluent-bit.image.fluent_bit
fluent-bit.backend
fluent-bit.input
fluent-bit.parsers
Expand Down Expand Up @@ -653,6 +654,14 @@ function migrate_fluent_bit() {
yq w -i "${TEMP_FILE}" 'fluent-bit.image.pullPolicy' IfNotPresent
fi

local default_image_tag="1.6.10"
local image_tag
readonly image_tag="$(yq r "${TEMP_FILE}" -- 'fluent-bit.image.tag')"
if [[ -n ${image_tag} ]] && [[ ${image_tag} != "${default_image_tag}" ]]; then
info "Leaving the fluent-bit.image.tag set to '${image_tag}'"
info "Please note that in v2.0 the fluent-bit.image.tag is set to '${default_image_tag}' by default"
fi

if [[ -n "$(yq r "${TEMP_FILE}" -- 'fluent-bit.service.flush')" ]]; then
yq w -i "${TEMP_FILE}" 'fluent-bit.service.labels."sumologic.com/scrape"' --style double true
fi
Expand Down
2 changes: 1 addition & 1 deletion tests/upgrade_v2_script/static/fluent_bit.input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fluent-bit:
image:
fluent_bit:
repository: public.ecr.aws/sumologic/fluent-bit
tag: 1.6.0
tag: 1.6.10
service:
flush: 5
metrics:
Expand Down
2 changes: 2 additions & 0 deletions tests/upgrade_v2_script/static/fluent_bit.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[INFO] Mapping fluent-bit.image.fluent_bit.repository into fluent-bit.image.repository
[INFO] Mapping fluent-bit.image.fluent_bit.tag into fluent-bit.image.tag

[INFO] Migrating prometheus remote write urls
[INFO] Migrating "fluent-bit.backend.forward.host" from "${CHART}.${NAMESPACE}.svc.cluster.local." to "${FLUENTD_LOGS_SVC}.${NAMESPACE}.svc.cluster.local."
Expand Down
3 changes: 2 additions & 1 deletion tests/upgrade_v2_script/static/fluent_bit.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ fluent-bit:
- effect: NoSchedule
operator: Exists
image:
pullPolicy: IfNotPresent
repository: public.ecr.aws/sumologic/fluent-bit
tag: 1.6.10
service:
labels:
sumologic.com/scrape: "true"
Expand Down

0 comments on commit b8d9c62

Please sign in to comment.