1
0
mirror of https://github.com/coreos/prometheus-operator.git synced 2026-02-05 15:46:31 +01:00

fix: undo maximum version to EC2 and Lightsail SD

Signed-off-by: Hélia Barroso <helia_barroso@hotmail.com>
This commit is contained in:
Hélia Barroso
2026-01-21 16:15:02 +00:00
parent 8a8faa867e
commit cf9dd1c5ea
2 changed files with 15 additions and 64 deletions

View File

@@ -828,12 +828,6 @@ func (rs *ResourceSelector) validateDNSSDConfigs(sc *monitoringv1alpha1.ScrapeCo
func (rs *ResourceSelector) validateEC2SDConfigs(ctx context.Context, sc *monitoringv1alpha1.ScrapeConfig) error {
if len(sc.Spec.EC2SDConfigs) > 0 {
if rs.version.GTE(semver.MustParse("3.8.0")) {
return fmt.Errorf("EC2 SD configuration is only supported for Prometheus version < 3.8.0. For Prometheus 3.8.0 onwards, please use AWS SD")
}
}
for i, config := range sc.Spec.EC2SDConfigs {
if config.AccessKey != nil {
@@ -1206,14 +1200,8 @@ func (rs *ResourceSelector) validatePuppetDBSDConfigs(ctx context.Context, sc *m
}
func (rs *ResourceSelector) validateLightSailSDConfigs(ctx context.Context, sc *monitoringv1alpha1.ScrapeConfig) error {
if len(sc.Spec.LightSailSDConfigs) > 0 {
if rs.version.LT(semver.MustParse("2.27.0")) {
return fmt.Errorf("lightSail SD configuration is only supported for Prometheus version >= 2.27.0")
}
if rs.version.GTE(semver.MustParse("3.8.0")) {
return fmt.Errorf("lightSail SD configuration is only supported for Prometheus version < 3.8.0. For Prometheus 3.8.0 onwards, please use AWS SD")
}
if rs.version.LT(semver.MustParse("2.27.0")) {
return fmt.Errorf("lightSail SD configuration is only supported for Prometheus version >= 2.27.0")
}
for i, config := range sc.Spec.LightSailSDConfigs {

View File

@@ -2646,8 +2646,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: true,
valid: true,
},
{
scenario: "EC2 SD config with no secret ref provided",
@@ -2658,8 +2657,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: true,
valid: true,
},
{
scenario: "EC2 SD config with invalid secret ref for secretKey",
@@ -2682,8 +2680,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: false,
valid: false,
},
{
scenario: "EC2 SD config with valid TLS Config",
@@ -2718,8 +2715,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: true,
valid: true,
},
{
scenario: "EC2 SD config with valid HTTPS Config",
@@ -2778,8 +2774,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: false,
valid: false,
},
{
scenario: "EC2 SD config with valid proxy settings",
@@ -2808,18 +2803,6 @@ func TestSelectScrapeConfigs(t *testing.T) {
promVersion: "2.52.0",
valid: true,
},
{
scenario: "EC2 SD config with unsupported version",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.EC2SDConfigs = []monitoringv1alpha1.EC2SDConfig{
{
Region: ptr.To("us-east-1"),
},
}
},
promVersion: "3.8.0",
valid: false,
},
{
scenario: "Azure SD config with valid options for OAuth authentication method",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
@@ -4057,8 +4040,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: true,
valid: true,
},
{
scenario: "LightSail SD config with invalid TLS config with invalid CA data",
@@ -4104,8 +4086,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: true,
valid: true,
},
{
scenario: "LightSail SD config with invalid proxy settings",
@@ -4129,8 +4110,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: false,
valid: false,
},
{
scenario: "LightSail SD config with invalid secret ref",
@@ -4148,8 +4128,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: false,
valid: false,
},
{
@@ -4173,8 +4152,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: true,
valid: true,
},
{
scenario: "LightSail SD config with no secret ref provided",
@@ -4185,8 +4163,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: true,
valid: true,
},
{
scenario: "LightSail SD config with invalid secret ref for accessKey",
@@ -4209,8 +4186,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: false,
valid: false,
},
{
scenario: "LightSail SD config with invalid secret ref for secretKey",
@@ -4233,20 +4209,7 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
}
},
promVersion: "3.7.0",
valid: false,
},
{
scenario: "LightSail SD config with unsupported version",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.LightSailSDConfigs = []monitoringv1alpha1.LightSailSDConfig{
{
Region: ptr.To("us-east-1"),
},
}
},
promVersion: "3.8.0",
valid: false,
valid: false,
},
{
scenario: "OVHCloud SD config",