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 7b5dda89b..b9ae25b4f 100644 --- a/Documentation/compatibility.md +++ b/Documentation/compatibility.md @@ -55,10 +55,6 @@ Prometheus Operator supports all Prometheus versions >= v2.0.0. The operator's e * v2.55.1 * v3.0.0 * v3.0.1 -* v3.0.0-beta.0 -* v3.0.0-beta.1 -* v3.0.0-rc.0 -* v3.0.0-rc.1 ``` The end-to-end tests are mostly tested against 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 fa1738279..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. @@ -78,13 +82,14 @@ var ( "v3.0.0", "v3.0.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", - } ) + +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{