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

chore: add test for Prometheus v2

Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>
This commit is contained in:
Jayapriya Pai
2024-12-03 17:27:56 +05:30
parent 7a7ebbbf98
commit 2826f866f6
5 changed files with 21 additions and 21 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

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

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

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{