Skip to content

Commit

Permalink
fix: v2 migration script - info on new default value for fluent-bit.i…
Browse files Browse the repository at this point in the history
…mage.pullPolicy key instead of just adding it
  • Loading branch information
perk-sumo committed Feb 19, 2021
1 parent ae34eeb commit 8257ea9
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 3 deletions.
10 changes: 7 additions & 3 deletions deploy/helm/sumologic/upgrade-2.0.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,12 @@ function migrate_fluent_bit() {
yq w -i "${TEMP_FILE}" 'fluent-bit.env.(name==CHART).name' FLUENTD_LOGS_SVC
fi

if [[ -n "$(yq r "${TEMP_FILE}" -- 'fluent-bit.image.fluent_bit')" ]]; then
yq w -i "${TEMP_FILE}" 'fluent-bit.image.pullPolicy' IfNotPresent
local default_image_pull_policy="IfNotPresent"
local image_pull_policy
readonly image_pull_policy="$(yq r "${TEMP_FILE}" -- 'fluent-bit.image.pullPolicy')"
if [[ -n ${image_pull_policy} ]] && [[ ${image_pull_policy} != "${default_image_pull_policy}" ]]; then
info "Leaving the fluent-bit.image.pullPolicy set to '${image_pull_policy}'"
info "Please note that in v2.0 the fluent-bit.image.pullPolicy is set to '${default_image_pull_policy}' by default"
fi

local default_image_tag="1.6.10"
Expand All @@ -660,7 +664,7 @@ function migrate_fluent_bit() {
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
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
Expand Down
1 change: 1 addition & 0 deletions tests/upgrade_v2_script/static/fluent_bit.input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ fluent-bit:
fluent_bit:
repository: public.ecr.aws/sumologic/fluent-bit
tag: 1.6.0
pullPolicy: Always
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
Expand Up @@ -2,6 +2,8 @@
[INFO] Mapping fluent-bit.image.fluent_bit.tag into fluent-bit.image.tag

[INFO] Migrating prometheus remote write urls
[INFO] Leaving the fluent-bit.image.pullPolicy set to 'Always'
[INFO] Please note that in v2.0 the fluent-bit.image.pullPolicy is set to 'IfNotPresent' by default
[INFO] Leaving the fluent-bit.image.tag set to '1.6.0'
[INFO] Please note that in v2.0 the fluent-bit.image.tag is set to '1.6.10' by default
[INFO] Migrating "fluent-bit.backend.forward.host" from "${CHART}.${NAMESPACE}.svc.cluster.local." to "${FLUENTD_LOGS_SVC}.${NAMESPACE}.svc.cluster.local."
Expand Down
1 change: 1 addition & 0 deletions tests/upgrade_v2_script/static/fluent_bit.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ fluent-bit:
image:
repository: public.ecr.aws/sumologic/fluent-bit
tag: 1.6.0
pullPolicy: Always
service:
labels:
sumologic.com/scrape: "true"
Expand Down
6 changes: 6 additions & 0 deletions tests/upgrade_v2_script/static/fluent_bit_image.input.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fluent-bit:
image:
fluent_bit:
repository: public.ecr.aws/sumologic/fluent-bit
tag: 1.6.0
pullPolicy: Always
11 changes: 11 additions & 0 deletions tests/upgrade_v2_script/static/fluent_bit_image.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[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] Leaving the fluent-bit.image.pullPolicy set to 'Always'
[INFO] Please note that in v2.0 the fluent-bit.image.pullPolicy is set to 'IfNotPresent' by default
[INFO] Leaving the fluent-bit.image.tag set to '1.6.0'
[INFO] Please note that in v2.0 the fluent-bit.image.tag is set to '1.6.10' by default

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: 5 additions & 0 deletions tests/upgrade_v2_script/static/fluent_bit_image.output.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fluent-bit:
image:
repository: public.ecr.aws/sumologic/fluent-bit
tag: 1.6.0
pullPolicy: Always
39 changes: 39 additions & 0 deletions tests/upgrade_v2_script/static/fluent_bit_no_image.input.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
fluent-bit:
podLabels: {}
podAnnotations: {}
env:
- name: CHART
valueFrom:
configMapKeyRef:
name: sumologic-configmap
key: fluentdLogs
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
extraVolumes:
- name: project2-db
emptyDir: {}
- name: project-db
emptyDir: {}
- name: project2-alerts
hostPath:
path: /var/project2/logs/alerts/alerts.json
type: File
- name: company-db
emptyDir: {}
extraVolumeMounts:
- name: project2-db
mountPath: /fluent-bit/project2
- name: project-db
mountPath: /fluent-bit/project
- name: project2-alerts
mountPath: /var/project2/logs/alerts/alerts.json
readOnly: true
- name: company-db
mountPath: /fluent-bit/company
tolerations:
- effect: NoSchedule
operator: Exists
service:
flush: 5
5 changes: 5 additions & 0 deletions tests/upgrade_v2_script/static/fluent_bit_no_image.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

[INFO] Migrating prometheus remote write urls

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.
40 changes: 40 additions & 0 deletions tests/upgrade_v2_script/static/fluent_bit_no_image.output.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
fluent-bit:
podLabels: {}
podAnnotations: {}
env:
- name: FLUENTD_LOGS_SVC
valueFrom:
configMapKeyRef:
name: sumologic-configmap
key: fluentdLogs
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
extraVolumes:
- name: project2-db
emptyDir: {}
- name: project-db
emptyDir: {}
- name: project2-alerts
hostPath:
path: /var/project2/logs/alerts/alerts.json
type: File
- name: company-db
emptyDir: {}
extraVolumeMounts:
- name: project2-db
mountPath: /fluent-bit/project2
- name: project-db
mountPath: /fluent-bit/project
- name: project2-alerts
mountPath: /var/project2/logs/alerts/alerts.json
readOnly: true
- name: company-db
mountPath: /fluent-bit/company
tolerations:
- effect: NoSchedule
operator: Exists
service:
labels:
sumologic.com/scrape: "true"

0 comments on commit 8257ea9

Please sign in to comment.