1
0
mirror of https://github.com/coreos/prometheus-operator.git synced 2026-02-05 06:45:27 +01:00

Merge pull request #7158 from slashpai/prom3

feat: make prometheus v3.0.1 as default version
This commit is contained in:
Jayapriya Pai
2024-12-04 19:45:25 +05:30
committed by GitHub
5 changed files with 22 additions and 23 deletions

View File

@@ -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 }}

View File

@@ -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

View File

@@ -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,

View File

@@ -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")
}

View File

@@ -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{