From be53f06e480a28514517b934135edb6e26a428b4 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 18 Oct 2023 14:06:36 -0700 Subject: [PATCH 1/2] ci-operator/step-registry/ipi/conf/telemetry: Disable by default (again) We'd tried this previously in 3c1da8eb20 (OTA-740: ci-operator/step-registry/ipi/conf/telemetry: Disable Telemetry (#32153), 2022-09-13), but had to roll it back with d61129c814 (ci-operator/step-registry/ipi/conf/telemetry: Restore Telemetry (#32249), 2022-09-13), to avoid failing: Prometheus when installed on the cluster should report telemetry if a cloud.openshift.com token is present Subsequently, openshift/origin@76652fa4fa (test/extended/prometheus: Consider telemeterClient.enabled, 2022-09-15, openshift/origin#27422) taught that test-case about the config knob this step uses to disable Telemetry. Those test-case changes are present in origin test suites starting in 4.12: $ for Y in $(seq 11 15); do git --no-pager grep 'should report telemetry' "origin/release-4.${Y}" -- test/extended/prometheus/prometheus.go; done origin/release-4.11:test/extended/prometheus/prometheus.go: g.It("should report telemetry if a cloud.openshift.com token is present [Late]", func() { origin/release-4.12:test/extended/prometheus/prometheus.go: g.It("should report telemetry [Late]", func() { origin/release-4.13:test/extended/prometheus/prometheus.go: g.It("should report telemetry [Late]", func() { origin/release-4.14:test/extended/prometheus/prometheus.go: g.It("should report telemetry [Serial] [Late]", func() { origin/release-4.15:test/extended/prometheus/prometheus.go: g.It("should report telemetry [Serial] [Late]", func() { and 4.10 is end-of-life since 2023-09-10 [1]. That leaves tests using 4.11 versions of the origin suite, and I'm addressing those via the JOB_NAME checks [2,3]. The checks are brittle, leaving out 4.9 and earlier, and possibly not matching some 4.11 jobs, but they will hopefully be sufficient to get us through until 4.11 goes end-of-life on 2024-02-10 [3]. And when the defaulting logic breaks down, jobs that have an opinion can set TELEMETRY_ENABLED explicitly to match their needs. [1]: https://access.redhat.com/support/policy/updates/openshift/#dates [2]: https://docs.ci.openshift.org/docs/architecture/step-registry/#available-environment-variables [3]: https://docs.prow.k8s.io/docs/jobs/#job-environment-variables --- .../conf/telemetry/ipi-conf-telemetry-commands.sh | 12 ++++++++++++ .../ipi/conf/telemetry/ipi-conf-telemetry-ref.yaml | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-commands.sh b/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-commands.sh index c49d91211fb5e..fed4bb993a9a3 100755 --- a/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-commands.sh +++ b/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-commands.sh @@ -4,6 +4,18 @@ set -o nounset set -o errexit set -o pipefail +if test -z "${TELEMETRY_ENABLED}" +then + if [[ "${JOB_NAME}" =~ '4.11' ]] + then + TELEMETRY_ENABLED=true + echo "TELEMETRY_ENABLED is empty, defaulting to '${TELEMETRY_ENABLED}' for the 4.11 ${JOB_NAME}" + else + TELEMETRY_ENABLED=false + echo "TELEMETRY_ENABLED is empty, defaulting to '${TELEMETRY_ENABLED}' for the not-4.11 ${JOB_NAME}" + fi +fi + if test true = "${TELEMETRY_ENABLED}" then echo "Nothing to do with TELEMETRY_ENABLED='${TELEMETRY_ENABLED}'" diff --git a/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-ref.yaml b/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-ref.yaml index 55be6be9ac990..feafeb3454d31 100644 --- a/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-ref.yaml +++ b/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-ref.yaml @@ -11,10 +11,10 @@ ref: memory: 100Mi env: - name: TELEMETRY_ENABLED - default: "true" + default: "" documentation: |- Enable Telemetry: - * "false" - do not enable Telemetry - * "true" (default) - enable Telemetry + * "false" (default for most jobs) - do not enable Telemetry + * "true" (default when JOB_NAME includes 4.11) - enable Telemetry documentation: |- The configure telemetry step generates a "${SHARED_DIR}/manifest_cluster-monitoring-config.yaml" manifest, or manipulates the manifest if it already exists, to configure telemeterClient's enabled property. From f7102a78dbd7f2d97ee46428290feabaa3d085ca Mon Sep 17 00:00:00 2001 From: Justin Pierce Date: Thu, 19 Oct 2023 09:08:51 -0400 Subject: [PATCH 2/2] Make 4.11 regex pass shellcheck --- .../ipi/conf/telemetry/ipi-conf-telemetry-commands.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-commands.sh b/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-commands.sh index fed4bb993a9a3..bcc712a083687 100755 --- a/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-commands.sh +++ b/ci-operator/step-registry/ipi/conf/telemetry/ipi-conf-telemetry-commands.sh @@ -6,7 +6,7 @@ set -o pipefail if test -z "${TELEMETRY_ENABLED}" then - if [[ "${JOB_NAME}" =~ '4.11' ]] + if [[ "${JOB_NAME}" =~ (^|[^[:digit:]]+)4.11([^[:digit:]]+|$) ]] then TELEMETRY_ENABLED=true echo "TELEMETRY_ENABLED is empty, defaulting to '${TELEMETRY_ENABLED}' for the 4.11 ${JOB_NAME}"