diff --git a/.github/workflows/e2e-prometheus3.yaml b/.github/workflows/e2e-prometheus2.yaml similarity index 98% rename from .github/workflows/e2e-prometheus3.yaml rename to .github/workflows/e2e-prometheus2.yaml index 224ff9100..4d990bbe5 100644 --- a/.github/workflows/e2e-prometheus3.yaml +++ b/.github/workflows/e2e-prometheus2.yaml @@ -66,7 +66,7 @@ jobs: - name: Run tests env: E2E_DIAGNOSTIC_DIRECTORY: ${{ env.E2E_DIAGNOSTIC_DIRECTORY }} - TEST_EXPERIMENTAL_PROMETHEUS: "true" + TEST_PROMETHEUS_V2: "true" run: | make ${{ matrix.target }} diff --git a/Documentation/compatibility.md b/Documentation/compatibility.md index 2f92d2148..b9ae25b4f 100644 --- a/Documentation/compatibility.md +++ b/Documentation/compatibility.md @@ -53,10 +53,6 @@ Prometheus Operator supports all Prometheus versions >= v2.0.0. The operator's e * v2.54.1 * v2.55.0 * v2.55.1 -* v3.0.0-beta.0 -* v3.0.0-beta.1 -* v3.0.0-rc.0 -* v3.0.0-rc.1 * v3.0.0 * v3.0.1 ``` @@ -64,7 +60,7 @@ Prometheus Operator supports all Prometheus versions >= v2.0.0. The operator's e The end-to-end tests are mostly tested against ```$ mdox-exec="go run ./cmd/po-docgen/. compatibility defaultPrometheusVersion" -* v2.55.1 +* v3.0.1 ``` ## Alertmanager diff --git a/cmd/po-docgen/compatibility.go b/cmd/po-docgen/compatibility.go index 8aa9d8ecb..68691a7d3 100644 --- a/cmd/po-docgen/compatibility.go +++ b/cmd/po-docgen/compatibility.go @@ -27,7 +27,7 @@ type compatibilityMatrix struct { func getCompatibilityMatrix() compatibilityMatrix { return compatibilityMatrix{ - PrometheusVersions: append(operator.PrometheusCompatibilityMatrix, operator.PrometheusExperimentalVersions...), + PrometheusVersions: operator.PrometheusCompatibilityMatrix, DefaultPrometheus: operator.DefaultPrometheusVersion, DefaultAlertmanager: operator.DefaultAlertmanagerVersion, DefaultThanos: operator.DefaultThanosVersion, diff --git a/pkg/operator/defaults.go b/pkg/operator/defaults.go index 49f9e181e..8967ca9ac 100644 --- a/pkg/operator/defaults.go +++ b/pkg/operator/defaults.go @@ -14,7 +14,11 @@ package operator -import "github.com/prometheus/common/version" +import ( + "strings" + + "github.com/prometheus/common/version" +) const ( // DefaultAlertmanagerVersion is a default image tag for the prometheus alertmanager. @@ -36,8 +40,8 @@ const ( var ( // DefaultPrometheusVersion is a default image tag for the prometheus. DefaultPrometheusVersion = PrometheusCompatibilityMatrix[len(PrometheusCompatibilityMatrix)-1] - // DefaultPrometheusExperimentalVersion is a default image tag for the prometheus experimental version (like Prometheus 3 beta). - DefaultPrometheusExperimentalVersion = PrometheusExperimentalVersions[len(PrometheusExperimentalVersions)-1] + // DefaultPrometheusV2 is latest version of Prometheus v2. + DefaultPrometheusV2 = getLatestPrometheusV2() // DefaultPrometheusBaseImage is a base container registry address for the prometheus. DefaultPrometheusBaseImage = "quay.io/prometheus/prometheus" // DefaultPrometheusImage is a default image pulling address for the prometheus. @@ -75,17 +79,17 @@ var ( "v2.54.1", "v2.55.0", "v2.55.1", - } - - // Note: Issues in this version won't be supported by operator till its stable - // This is only added for users to try the unstable versions. - PrometheusExperimentalVersions = []string{ - "v3.0.0-beta.0", - "v3.0.0-beta.1", - "v3.0.0-rc.0", - "v3.0.0-rc.1", - // TODO: To be moved to default latest version once we tested fully. "v3.0.0", "v3.0.1", } ) + +func getLatestPrometheusV2() string { + for i, version := range PrometheusCompatibilityMatrix { + // Since last v2 version would be one just before the first v3 version + if strings.HasPrefix(version, "v3") { + return PrometheusCompatibilityMatrix[i-1] + } + } + panic("failed to find a v2.x entry in the compatibility matrix") +} diff --git a/test/framework/prometheus.go b/test/framework/prometheus.go index b0bc027b9..e259ccaa1 100644 --- a/test/framework/prometheus.go +++ b/test/framework/prometheus.go @@ -179,9 +179,8 @@ func (f *Framework) CreateCertificateResources(namespace, certsDir string, prwtc func (f *Framework) MakeBasicPrometheus(ns, name, group string, replicas int32) *monitoringv1.Prometheus { promVersion := operator.DefaultPrometheusVersion - // Because Prometheus 3 is supported from version 0.77.0 only - if os.Getenv("TEST_EXPERIMENTAL_PROMETHEUS") == "true" && f.operatorVersion.Minor >= 77 { - promVersion = operator.DefaultPrometheusExperimentalVersion + if os.Getenv("TEST_PROMETHEUS_V2") == "true" { + promVersion = operator.DefaultPrometheusV2 } return &monitoringv1.Prometheus{ ObjectMeta: metav1.ObjectMeta{