From 554682590ca7da53c19452a64738f0a04fe69c93 Mon Sep 17 00:00:00 2001 From: Jian Wang Date: Thu, 13 Feb 2025 13:03:36 +0100 Subject: [PATCH 1/5] Bump monitoring and logging Monitoring from 103.1.1+up45.31.1 to 105.1.2+up61.3.2 Logging from 103.1.0+up4.4.0 to 105.2.0+up4.10.0 Signed-off-by: Jian Wang --- .../103.1.0+up4.4.0/eventtailer.yaml | 15 ------- .../configmap.yaml | 0 .../daemonset.yaml | 0 .../105.2.0+up4.10.0/eventtailer.yaml | 44 +++++++++++++++++++ .../patch-values-shell-version.diff | 11 ----- .../patch-values-shell-version.diff | 11 ----- .../nginx-config.yaml | 0 scripts/hack/patch-rancher-logging | 18 +------- scripts/images/rancher-images.txt | 23 +++++----- scripts/version-logging | 2 +- scripts/version-monitoring | 2 +- 11 files changed, 59 insertions(+), 67 deletions(-) delete mode 100644 pkg/config/templates/patch/rancher-logging/103.1.0+up4.4.0/eventtailer.yaml rename pkg/config/templates/patch/rancher-logging/{103.1.0+up4.4.0 => 105.2.0+up4.10.0}/configmap.yaml (100%) rename pkg/config/templates/patch/rancher-logging/{103.1.0+up4.4.0 => 105.2.0+up4.10.0}/daemonset.yaml (100%) create mode 100644 pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/eventtailer.yaml delete mode 100644 pkg/config/templates/patch/rancher-monitoring-crd/103.1.1+up45.31.1/patch-values-shell-version.diff delete mode 100644 pkg/config/templates/patch/rancher-monitoring/103.1.1+up45.31.1/patch-values-shell-version.diff rename pkg/config/templates/patch/rancher-monitoring/{103.1.1+up45.31.1 => 105.1.2+up61.3.2}/nginx-config.yaml (100%) diff --git a/pkg/config/templates/patch/rancher-logging/103.1.0+up4.4.0/eventtailer.yaml b/pkg/config/templates/patch/rancher-logging/103.1.0+up4.4.0/eventtailer.yaml deleted file mode 100644 index f1f7fe40b..000000000 --- a/pkg/config/templates/patch/rancher-logging/103.1.0+up4.4.0/eventtailer.yaml +++ /dev/null @@ -1,15 +0,0 @@ -{{- with $.Values.eventTailer }} -# patch to ./templates/eventtailer.yaml -# harvester-patch to import the event tailer feature -apiVersion: logging-extensions.banzaicloud.io/v1alpha1 -kind: EventTailer -metadata: - name: {{ .name | default "harvester-default-event-tailer" }} - namespace: {{ .namespace | default "cattle-logging-system" }} -spec: - controlNamespace: {{ .controlNamespace | default "cattle-logging-system" }} -{{- with .workloadOverrides }} - workloadOverrides: -{{ toYaml . | indent 4 }} -{{- end }} -{{- end }} diff --git a/pkg/config/templates/patch/rancher-logging/103.1.0+up4.4.0/configmap.yaml b/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/configmap.yaml similarity index 100% rename from pkg/config/templates/patch/rancher-logging/103.1.0+up4.4.0/configmap.yaml rename to pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/configmap.yaml diff --git a/pkg/config/templates/patch/rancher-logging/103.1.0+up4.4.0/daemonset.yaml b/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/daemonset.yaml similarity index 100% rename from pkg/config/templates/patch/rancher-logging/103.1.0+up4.4.0/daemonset.yaml rename to pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/daemonset.yaml diff --git a/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/eventtailer.yaml b/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/eventtailer.yaml new file mode 100644 index 000000000..f67a035e2 --- /dev/null +++ b/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/eventtailer.yaml @@ -0,0 +1,44 @@ +{{- with $.Values.logging.eventTailer }} +# patch to ./templates/logging/eventtailer.yaml +# harvester-patch to customize the event tailer feature +{{- if and $.Values.logging.enabled .enabled }} +apiVersion: logging-extensions.banzaicloud.io/v1alpha1 +kind: EventTailer +metadata: + name: {{ .name | default "harvester-default-event-tailer" }} + namespace: {{ .namespace | default "cattle-logging-system" }} +spec: + controlNamespace: {{ $.Values.logging.controlNamespace | default $.Release.Namespace }} + {{- with .image }} + image: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .pvc }} + {{- if .enabled }} + positionVolume: + pvc: + spec: + accessModes: {{ .accessModes }} + resources: + requests: + storage: {{ .storage }} + volumeMode: {{ .volumeMode }} + {{- with .storageClassName }} + storageClassName: {{ . }} + {{- end }} + {{- end }}{{/* end if enabled */}} + {{- end }}{{/* end with pvc */}} + {{- with .workloadMetaOverrides }} + workloadMetaOverrides: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .workloadOverrides }} + workloadOverrides: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .containerOverrides }} + containerOverrides: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }}{{/* end if enabled */}} +{{- end }}{{/* end with event-tailer */}} diff --git a/pkg/config/templates/patch/rancher-monitoring-crd/103.1.1+up45.31.1/patch-values-shell-version.diff b/pkg/config/templates/patch/rancher-monitoring-crd/103.1.1+up45.31.1/patch-values-shell-version.diff deleted file mode 100644 index 4b3f7b4f1..000000000 --- a/pkg/config/templates/patch/rancher-monitoring-crd/103.1.1+up45.31.1/patch-values-shell-version.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- values.yaml -+++ values-new.yaml -@@ -10,7 +10,7 @@ - - image: - repository: rancher/shell -- tag: v0.1.25 -+ tag: v0.1.26 - - nodeSelector: {} - diff --git a/pkg/config/templates/patch/rancher-monitoring/103.1.1+up45.31.1/patch-values-shell-version.diff b/pkg/config/templates/patch/rancher-monitoring/103.1.1+up45.31.1/patch-values-shell-version.diff deleted file mode 100644 index 500eeb079..000000000 --- a/pkg/config/templates/patch/rancher-monitoring/103.1.1+up45.31.1/patch-values-shell-version.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- values.yaml -+++ values-new.yaml -@@ -560,7 +560,7 @@ - ## Image to use to run the scripts - image: - repository: rancher/shell -- tag: v0.1.25 -+ tag: v0.1.26 - - ## Rancher Monitoring - ## diff --git a/pkg/config/templates/patch/rancher-monitoring/103.1.1+up45.31.1/nginx-config.yaml b/pkg/config/templates/patch/rancher-monitoring/105.1.2+up61.3.2/nginx-config.yaml similarity index 100% rename from pkg/config/templates/patch/rancher-monitoring/103.1.1+up45.31.1/nginx-config.yaml rename to pkg/config/templates/patch/rancher-monitoring/105.1.2+up61.3.2/nginx-config.yaml diff --git a/scripts/hack/patch-rancher-logging b/scripts/hack/patch-rancher-logging index 147af516c..bbeb740e4 100755 --- a/scripts/hack/patch-rancher-logging +++ b/scripts/hack/patch-rancher-logging @@ -22,22 +22,8 @@ patch_rancher_logging_chart() grep "harvester-patch" ./rancher-logging/templates/loggings/rke2/daemonset.yaml || true echo "patch rancher logging eventtailer" - cp -f ${pkg_logging_path}/${logging_version}/eventtailer.yaml ./rancher-logging/templates/eventtailer.yaml - grep "harvester-patch" ./rancher-logging/templates/eventtailer.yaml || true - - # replace fluentbit image version; yq can also work, but it strips all blank lines; use patch instead - local valuesfile="./rancher-logging/values.yaml" - local difffile="${pkg_logging_path}/${logging_version}/patch-vaues-fluentbit-image.diff" - echo "patch fluentbit image version" - echo "the current values.yaml has following fluentbit image version" - grep "rancher/mirrored-fluent-fluent-bit" $valuesfile -1 || true - if [ -f "$difffile" ]; then - patch $valuesfile $difffile - else - echo "diff file $difffile is not found" - fi - echo "the patched values.yaml has following fluentbit image version" - grep "rancher/mirrored-fluent-fluent-bit" $valuesfile -1 || true + cp -f ${pkg_logging_path}/${logging_version}/eventtailer.yaml ./rancher-logging/templates/logging/eventtailer.yaml + grep "harvester-patch" ./rancher-logging/templates/logging/eventtailer.yaml || true # remove existing chart rm ${chart_dir}/rancher-logging-${logging_version}.tgz diff --git a/scripts/images/rancher-images.txt b/scripts/images/rancher-images.txt index 3683f5824..33d5d6b2a 100644 --- a/scripts/images/rancher-images.txt +++ b/scripts/images/rancher-images.txt @@ -1,31 +1,30 @@ docker.io/rancher/fleet-agent:v0.11.2 docker.io/rancher/fleet:v0.11.2 docker.io/rancher/gitjob:v0.9.8 -docker.io/rancher/kubectl:v1.20.2 docker.io/rancher/kubectl:v1.21.5 docker.io/rancher/kubectl:v1.29.2 docker.io/rancher/mirrored-grafana-grafana:9.1.5 -docker.io/rancher/mirrored-ingress-nginx-kube-webhook-certgen:v20221220-controller-v1.5.1-58-g787ea74b6 +docker.io/rancher/mirrored-ingress-nginx-kube-webhook-certgen:v1.4.3 docker.io/rancher/mirrored-kiwigrid-k8s-sidecar:1.24.6 docker.io/rancher/mirrored-kube-state-metrics-kube-state-metrics:v2.10.1 docker.io/rancher/mirrored-library-busybox:1.31.1 docker.io/rancher/mirrored-library-nginx:1.24.0-alpine docker.io/rancher/mirrored-prometheus-adapter-prometheus-adapter:v0.10.0 docker.io/rancher/mirrored-prometheus-node-exporter:v1.3.1 -docker.io/rancher/mirrored-prometheus-operator-prometheus-config-reloader:v0.65.1 -docker.io/rancher/mirrored-prometheus-operator-prometheus-operator:v0.65.1 -docker.io/rancher/mirrored-prometheus-prometheus:v2.45.0 -docker.io/rancher/mirrored-prometheus-alertmanager:v0.26.0 +docker.io/rancher/mirrored-prometheus-operator-prometheus-config-reloader:v0.75.1 +docker.io/rancher/mirrored-prometheus-operator-prometheus-operator:v0.75.1 +docker.io/rancher/mirrored-prometheus-operator-admission-webhook:v0.75.1 +docker.io/rancher/mirrored-prometheus-prometheus:v2.53.1 +docker.io/rancher/mirrored-prometheus-alertmanager:v0.27.0 docker.io/rancher/rancher-webhook:v0.6.2 docker.io/rancher/rancher:v2.10.1 docker.io/rancher/rancher-agent:v2.10.1 -docker.io/rancher/shell:v0.1.26 -docker.io/rancher/shell:v0.1.24 +docker.io/rancher/shell:v0.2.1 docker.io/rancher/shell:v0.3.0 docker.io/rancher/system-agent:v0.3.11-suc docker.io/rancher/system-upgrade-controller:v0.14.2 -docker.io/rancher/mirrored-banzaicloud-fluentd:v1.14.6-alpine-5 -docker.io/rancher/mirrored-kube-logging-logging-operator:4.4.0 -docker.io/rancher/mirrored-fluent-fluent-bit:2.2.0 -docker.io/rancher/mirrored-jimmidyson-configmap-reload:v0.4.0 +docker.io/rancher/mirrored-kube-logging-fluentd:v1.16-4.10-full +docker.io/rancher/mirrored-kube-logging-logging-operator:4.10.0 +docker.io/rancher/mirrored-fluent-fluent-bit:3.1.8 +docker.io/rancher/mirrored-kube-logging-config-reloader:v0.0.6 docker.io/rancher/mirrored-cluster-api-controller:v1.8.3 diff --git a/scripts/version-logging b/scripts/version-logging index ce55ff0b9..76ffddacf 100644 --- a/scripts/version-logging +++ b/scripts/version-logging @@ -1 +1 @@ -LOGGING_VERSION=103.1.0+up4.4.0 +LOGGING_VERSION=105.2.0+up4.10.0 diff --git a/scripts/version-monitoring b/scripts/version-monitoring index 4c1cf2638..eb0bd054c 100644 --- a/scripts/version-monitoring +++ b/scripts/version-monitoring @@ -1 +1 @@ -MONITORING_VERSION=103.1.1+up45.31.1 +MONITORING_VERSION=105.1.2+up61.3.2 From 250f786539ef320d0b1b4ff606b770165f73574c Mon Sep 17 00:00:00 2001 From: Jian Wang Date: Fri, 14 Feb 2025 11:04:28 +0100 Subject: [PATCH 2/5] More updates Signed-off-by: Jian Wang --- .../105.2.0+up4.10.0/eventtailer.yaml | 43 +++---------------- .../patch-values-shell-version.diff | 10 +++++ .../patch-values-shell-version.diff | 11 +++++ scripts/build-bundle | 2 +- scripts/images/rancher-images.txt | 11 +++-- 5 files changed, 34 insertions(+), 43 deletions(-) create mode 100644 pkg/config/templates/patch/rancher-monitoring-crd/105.1.2+up61.3.2/patch-values-shell-version.diff create mode 100644 pkg/config/templates/patch/rancher-monitoring/105.1.2+up61.3.2/patch-values-shell-version.diff diff --git a/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/eventtailer.yaml b/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/eventtailer.yaml index f67a035e2..0a02a91f8 100644 --- a/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/eventtailer.yaml +++ b/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/eventtailer.yaml @@ -1,44 +1,15 @@ -{{- with $.Values.logging.eventTailer }} +{{- with $.Values.eventTailer }} # patch to ./templates/logging/eventtailer.yaml -# harvester-patch to customize the event tailer feature -{{- if and $.Values.logging.enabled .enabled }} +# harvester-patch to import the event tailer feature apiVersion: logging-extensions.banzaicloud.io/v1alpha1 kind: EventTailer metadata: name: {{ .name | default "harvester-default-event-tailer" }} namespace: {{ .namespace | default "cattle-logging-system" }} spec: - controlNamespace: {{ $.Values.logging.controlNamespace | default $.Release.Namespace }} - {{- with .image }} - image: - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .pvc }} - {{- if .enabled }} - positionVolume: - pvc: - spec: - accessModes: {{ .accessModes }} - resources: - requests: - storage: {{ .storage }} - volumeMode: {{ .volumeMode }} - {{- with .storageClassName }} - storageClassName: {{ . }} - {{- end }} - {{- end }}{{/* end if enabled */}} - {{- end }}{{/* end with pvc */}} - {{- with .workloadMetaOverrides }} - workloadMetaOverrides: - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .workloadOverrides }} + controlNamespace: {{ .controlNamespace | default "cattle-logging-system" }} +{{- with .workloadOverrides }} workloadOverrides: - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .containerOverrides }} - containerOverrides: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }}{{/* end if enabled */}} -{{- end }}{{/* end with event-tailer */}} +{{ toYaml . | indent 4 }} +{{- end }} +{{- end }} diff --git a/pkg/config/templates/patch/rancher-monitoring-crd/105.1.2+up61.3.2/patch-values-shell-version.diff b/pkg/config/templates/patch/rancher-monitoring-crd/105.1.2+up61.3.2/patch-values-shell-version.diff new file mode 100644 index 000000000..f9beb5b30 --- /dev/null +++ b/pkg/config/templates/patch/rancher-monitoring-crd/105.1.2+up61.3.2/patch-values-shell-version.diff @@ -0,0 +1,10 @@ +--- values.yaml ++++ values-new.yaml +@@ -10,7 +10,7 @@ + + image: + repository: rancher/shell +- tag: v0.2.1 ++ tag: v0.3.0 + + nodeSelector: {} diff --git a/pkg/config/templates/patch/rancher-monitoring/105.1.2+up61.3.2/patch-values-shell-version.diff b/pkg/config/templates/patch/rancher-monitoring/105.1.2+up61.3.2/patch-values-shell-version.diff new file mode 100644 index 000000000..561e5fba3 --- /dev/null +++ b/pkg/config/templates/patch/rancher-monitoring/105.1.2+up61.3.2/patch-values-shell-version.diff @@ -0,0 +1,11 @@ +--- values.yaml ++++ values-new.yaml +@@ -562,7 +562,7 @@ + ## Image to use to run the scripts + image: + repository: rancher/shell +- tag: v0.2.1 ++ tag: v0.3.0 + + ## Rancher Monitoring + ## diff --git a/scripts/build-bundle b/scripts/build-bundle index b4e779c7b..b1be7fb8a 100755 --- a/scripts/build-bundle +++ b/scripts/build-bundle @@ -48,7 +48,7 @@ update_monitoring_logging_version() { # the harvester-eventrouter image tag is first bumped on installer, then on addon, to decouple the PRs # if ENV includes keyword `IMAGE` then `addon generateTemplates` will strip the image and only keep version - local HARVESTER_EVENTROUTER_FULL_TAG="rancher/harvester-eventrouter:v0.3.3" + local HARVESTER_EVENTROUTER_FULL_TAG="rancher/harvester-eventrouter:v0.5.0" local henew="HARVESTER_EVENTROUTER_FULL_TAG=\"${HARVESTER_EVENTROUTER_FULL_TAG}\"" local hecur=$(grep $henew $target) || echo "harvester-eventrouter image tag is not found from $target" if [ -z "${hecur}" ]; then diff --git a/scripts/images/rancher-images.txt b/scripts/images/rancher-images.txt index 33d5d6b2a..e1a1c7095 100644 --- a/scripts/images/rancher-images.txt +++ b/scripts/images/rancher-images.txt @@ -3,14 +3,14 @@ docker.io/rancher/fleet:v0.11.2 docker.io/rancher/gitjob:v0.9.8 docker.io/rancher/kubectl:v1.21.5 docker.io/rancher/kubectl:v1.29.2 -docker.io/rancher/mirrored-grafana-grafana:9.1.5 +docker.io/rancher/mirrored-grafana-grafana:11.1.0 docker.io/rancher/mirrored-ingress-nginx-kube-webhook-certgen:v1.4.3 -docker.io/rancher/mirrored-kiwigrid-k8s-sidecar:1.24.6 -docker.io/rancher/mirrored-kube-state-metrics-kube-state-metrics:v2.10.1 +docker.io/rancher/mirrored-kiwigrid-k8s-sidecar:1.27.4 +docker.io/rancher/mirrored-kube-state-metrics-kube-state-metrics:v2.12.0 docker.io/rancher/mirrored-library-busybox:1.31.1 docker.io/rancher/mirrored-library-nginx:1.24.0-alpine -docker.io/rancher/mirrored-prometheus-adapter-prometheus-adapter:v0.10.0 -docker.io/rancher/mirrored-prometheus-node-exporter:v1.3.1 +docker.io/rancher/mirrored-prometheus-adapter-prometheus-adapter:v0.12.0 +docker.io/rancher/mirrored-prometheus-node-exporter:v1.8.2 docker.io/rancher/mirrored-prometheus-operator-prometheus-config-reloader:v0.75.1 docker.io/rancher/mirrored-prometheus-operator-prometheus-operator:v0.75.1 docker.io/rancher/mirrored-prometheus-operator-admission-webhook:v0.75.1 @@ -19,7 +19,6 @@ docker.io/rancher/mirrored-prometheus-alertmanager:v0.27.0 docker.io/rancher/rancher-webhook:v0.6.2 docker.io/rancher/rancher:v2.10.1 docker.io/rancher/rancher-agent:v2.10.1 -docker.io/rancher/shell:v0.2.1 docker.io/rancher/shell:v0.3.0 docker.io/rancher/system-agent:v0.3.11-suc docker.io/rancher/system-upgrade-controller:v0.14.2 From a6b54d272176c578515463b8d3e8b1fbed305daf Mon Sep 17 00:00:00 2001 From: Jian Wang Date: Mon, 17 Feb 2025 16:45:49 +0100 Subject: [PATCH 3/5] Fix kube-audit logRef missing Signed-off-by: Jian Wang --- .../105.2.0+up4.10.0/fluentbitagent.yaml | 28 +++++++++++++++++++ scripts/hack/patch-rancher-logging | 4 +++ 2 files changed, 32 insertions(+) create mode 100644 pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/fluentbitagent.yaml diff --git a/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/fluentbitagent.yaml b/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/fluentbitagent.yaml new file mode 100644 index 000000000..f374d9231 --- /dev/null +++ b/pkg/config/templates/patch/rancher-logging/105.2.0+up4.10.0/fluentbitagent.yaml @@ -0,0 +1,28 @@ +{{- define "logging-operator.fluentbitagent.kube-audit" -}} +# patch to ./templates/loggings/kube-audit/fluentbitagent.yaml +# when harvester-installer makes ISO, the original file is replaced +# harvester-patch to kube-audit fluentbitagent.yaml +# upsteam file lacks loggingRef +metadata: + name: {{ .Release.Name }}-kube-audit +spec: + {{- if .Values.additionalLoggingSources.kubeAudit.loggingRef }} + loggingRef: {{ .Values.additionalLoggingSources.kubeAudit.loggingRef }} + {{- end }} + disableKubernetesFilter: true + extraVolumeMounts: + - source: {{ template "kubeAuditPathPrefix" . }} + destination: "/kube-audit-logs" + readOnly: true + inputTail: + Tag: {{ .Values.additionalLoggingSources.kubeAudit.fluentbit.logTag }} + Path: /kube-audit-logs/{{ template "kubeAuditFilename" . }} + Parser: json + {{- with (concat (.Values.tolerations) (.Values.fluentbit.tolerations) (.Values.additionalLoggingSources.kubeAudit.fluentbit.tolerations)) }} + tolerations: {{- toYaml . | nindent 6 }} + {{- end }} + nodeSelector: {{ include "controlplaneSelector" . | nindent 6 }} +{{- end -}} +{{- if .Values.additionalLoggingSources.kubeAudit.enabled }} +{{- include "logging-operator.fluentbitagent" (list . "logging-operator.fluentbitagent.kube-audit") -}} +{{- end }} diff --git a/scripts/hack/patch-rancher-logging b/scripts/hack/patch-rancher-logging index bbeb740e4..f781a01a0 100755 --- a/scripts/hack/patch-rancher-logging +++ b/scripts/hack/patch-rancher-logging @@ -25,6 +25,10 @@ patch_rancher_logging_chart() cp -f ${pkg_logging_path}/${logging_version}/eventtailer.yaml ./rancher-logging/templates/logging/eventtailer.yaml grep "harvester-patch" ./rancher-logging/templates/logging/eventtailer.yaml || true + echo "patch rancher logging kube-audit fluentbitagent" + cp -f ${pkg_logging_path}/${logging_version}/fluentbitagent.yaml ./rancher-logging/templates/loggings/kube-audit/fluentbitagent.yaml + grep "harvester-patch" ./rancher-logging/templates/loggings/kube-audit/fluentbitagent.yaml || true + # remove existing chart rm ${chart_dir}/rancher-logging-${logging_version}.tgz From 3bc68d00c17e0fe907fa74781242606b5093cb0f Mon Sep 17 00:00:00 2001 From: Jian Wang Date: Mon, 17 Feb 2025 17:18:45 +0100 Subject: [PATCH 4/5] Update build script for patching monitoring and logging Signed-off-by: Jian Wang --- scripts/build | 3 ++ scripts/build-bundle | 49 ++--------------------------- scripts/patch-monitoring-logging | 54 ++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 47 deletions(-) create mode 100644 scripts/patch-monitoring-logging diff --git a/scripts/build b/scripts/build index f8e51aed3..512604dd8 100755 --- a/scripts/build +++ b/scripts/build @@ -68,8 +68,11 @@ if [ "$(uname)" = "Linux" ]; then fi fi +source ${SCRIPTS_DIR}/patch-monitoring-logging + # render template files cd ${addons_path} +update_monitoring_logging_version version_info go run . -generateTemplates -path ${TOP_DIR}/pkg/config/templates cd ${TOP_DIR} diff --git a/scripts/build-bundle b/scripts/build-bundle index b1be7fb8a..7c56ac013 100755 --- a/scripts/build-bundle +++ b/scripts/build-bundle @@ -9,59 +9,14 @@ PACKAGE_HARVESTER_REPO_DIR="${TOP_DIR}/package/harvester-repo" cd ${TOP_DIR} +source ${SCRIPTS_DIR}/patch-monitoring-logging + addons_path=../addons if [ ! -d ${addons_path} ];then echo "No existing addons source. Pulling..." git clone --branch main --single-branch --depth 1 https://github.com/harvester/addons.git ../addons fi -source ${SCRIPTS_DIR}/version-monitoring -source ${SCRIPTS_DIR}/version-logging - -update_monitoring_logging_version() { - # due to legacy code, monitoring and logging versions are first updated on installer - # then on addon - local target=$1 - local lnew="RANCHER_LOGGING_CHART_VERSION=\"${LOGGING_VERSION}\"" - local lcur=$(grep $lnew $target) || echo "logging chart version is not found from $target" - # if the file has no new line at end, append new ENV will be added to last line accidently - echo "" >> $target - if [ -z "${lcur}" ]; then - # remove possible existing values - sed -i '/RANCHER_LOGGING_CHART_VERSION/d' $target - echo "$lnew" >> $target - echo ""logging chart version is updated to ${LOGGING_VERSION}"" - else - echo "logging chart version is already set to ${LOGGING_VERSION}" - fi - - local mnew="RANCHER_MONITORING_CHART_VERSION=\"${MONITORING_VERSION}\"" - local mcur=$(grep $mnew $target) || echo "monitoring chart version is not found from $target" - if [ -z "${mcur}" ]; then - # remove possible existing values - sed -i '/RANCHER_MONITORING_CHART_VERSION/d' $target - echo "$mnew" >> $target - echo "monitoring chart version is updated to ${MONITORING_VERSION}" - else - echo "monitoring chart version is already set to ${MONITORING_VERSION}" - fi - - # the harvester-eventrouter image tag is first bumped on installer, then on addon, to decouple the PRs - # if ENV includes keyword `IMAGE` then `addon generateTemplates` will strip the image and only keep version - local HARVESTER_EVENTROUTER_FULL_TAG="rancher/harvester-eventrouter:v0.5.0" - local henew="HARVESTER_EVENTROUTER_FULL_TAG=\"${HARVESTER_EVENTROUTER_FULL_TAG}\"" - local hecur=$(grep $henew $target) || echo "harvester-eventrouter image tag is not found from $target" - if [ -z "${hecur}" ]; then - # remove possible existing values - sed -i '/HARVESTER_EVENTROUTER_FULL_TAG/d' $target - echo "$henew" >> $target - echo "harvester-eventrouter image tag is updated to ${HARVESTER_EVENTROUTER_FULL_TAG}" - else - echo "harvester-eventrouter image tag is already set to ${HARVESTER_EVENTROUTER_FULL_TAG}" - fi - cat $target -} - # will generate template file in ${addons_path}, and this is used for subsequent checks cd ${addons_path} update_monitoring_logging_version version_info diff --git a/scripts/patch-monitoring-logging b/scripts/patch-monitoring-logging new file mode 100644 index 000000000..e13457956 --- /dev/null +++ b/scripts/patch-monitoring-logging @@ -0,0 +1,54 @@ +#!/bin/bash +set -e + +if [ -z $SCRIPTS_DIR ]; then + TOP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )" + SCRIPTS_DIR="${TOP_DIR}/scripts" +fi + +source ${SCRIPTS_DIR}/version-monitoring +source ${SCRIPTS_DIR}/version-logging + +update_monitoring_logging_version() { + # due to legacy code, monitoring and logging versions are first updated on installer + # then on addon + local target=$1 + local lnew="RANCHER_LOGGING_CHART_VERSION=\"${LOGGING_VERSION}\"" + local lcur=$(grep $lnew $target) || echo "logging chart version is not found from $target" + # if the file has no new line at end, append new ENV will be added to last line accidently + echo "" >> $target + if [ -z "${lcur}" ]; then + # remove possible existing values + sed -i '/RANCHER_LOGGING_CHART_VERSION/d' $target + echo "$lnew" >> $target + echo ""logging chart version is updated to ${LOGGING_VERSION}"" + else + echo "logging chart version is already set to ${LOGGING_VERSION}" + fi + + local mnew="RANCHER_MONITORING_CHART_VERSION=\"${MONITORING_VERSION}\"" + local mcur=$(grep $mnew $target) || echo "monitoring chart version is not found from $target" + if [ -z "${mcur}" ]; then + # remove possible existing values + sed -i '/RANCHER_MONITORING_CHART_VERSION/d' $target + echo "$mnew" >> $target + echo "monitoring chart version is updated to ${MONITORING_VERSION}" + else + echo "monitoring chart version is already set to ${MONITORING_VERSION}" + fi + + # the harvester-eventrouter image tag is first bumped on installer, then on addon, to decouple the PRs + # if ENV includes keyword `IMAGE` then `addon generateTemplates` will strip the image and only keep version + local HARVESTER_EVENTROUTER_FULL_TAG="rancher/harvester-eventrouter:v0.5.0" + local henew="HARVESTER_EVENTROUTER_FULL_TAG=\"${HARVESTER_EVENTROUTER_FULL_TAG}\"" + local hecur=$(grep $henew $target) || echo "harvester-eventrouter image tag is not found from $target" + if [ -z "${hecur}" ]; then + # remove possible existing values + sed -i '/HARVESTER_EVENTROUTER_FULL_TAG/d' $target + echo "$henew" >> $target + echo "harvester-eventrouter image tag is updated to ${HARVESTER_EVENTROUTER_FULL_TAG}" + else + echo "harvester-eventrouter image tag is already set to ${HARVESTER_EVENTROUTER_FULL_TAG}" + fi + cat $target +} From 4eb5f9430862a6d5e49a3e0ef77315e51decfb4a Mon Sep 17 00:00:00 2001 From: Jian Wang Date: Fri, 21 Feb 2025 10:35:43 +0100 Subject: [PATCH 5/5] Update eventrouter to v1.5.0-dev.0 Signed-off-by: Jian Wang --- scripts/patch-monitoring-logging | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/patch-monitoring-logging b/scripts/patch-monitoring-logging index e13457956..d384b7b53 100644 --- a/scripts/patch-monitoring-logging +++ b/scripts/patch-monitoring-logging @@ -39,7 +39,7 @@ update_monitoring_logging_version() { # the harvester-eventrouter image tag is first bumped on installer, then on addon, to decouple the PRs # if ENV includes keyword `IMAGE` then `addon generateTemplates` will strip the image and only keep version - local HARVESTER_EVENTROUTER_FULL_TAG="rancher/harvester-eventrouter:v0.5.0" + local HARVESTER_EVENTROUTER_FULL_TAG="rancher/harvester-eventrouter:v1.5.0-dev.0" local henew="HARVESTER_EVENTROUTER_FULL_TAG=\"${HARVESTER_EVENTROUTER_FULL_TAG}\"" local hecur=$(grep $henew $target) || echo "harvester-eventrouter image tag is not found from $target" if [ -z "${hecur}" ]; then