Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prometheus scrape config secret not updated when enabling TLS #1955

Open
pschichtel opened this issue Jan 25, 2024 · 1 comment
Open

Prometheus scrape config secret not updated when enabling TLS #1955

pschichtel opened this issue Jan 25, 2024 · 1 comment

Comments

@pschichtel
Copy link
Contributor

Expected Behavior

When enabling TLS (in my case using requestAutoCert), then the operator should update scrape target in the scrape config to use the correct scheme (http -> https) and correct port (80 -> 443).

Current Behavior

The config is not being updated if it exists. Deleting the config will eventually resolve the issue as the operator recreates the secret with the correct contents.

Possible Solution

} else {
var scrapeConfigs []configmaps.ScrapeConfig
err := yaml.Unmarshal(secret.Data[miniov2.PrometheusAddlScrapeConfigKey], &scrapeConfigs)
if err != nil {
return err
}
// Check if the scrape config is already present
hasScrapeConfig := false
for _, sc := range scrapeConfigs {
if sc.JobName == tenant.PrometheusOperatorAddlConfigJobName() {
hasScrapeConfig = true
break
}
}
if !hasScrapeConfig {
klog.Infof("Adding MinIO tenant Prometheus scrape config")
scrapeConfigs = append(scrapeConfigs, promCfg.ScrapeConfigs...)
scrapeCfgYaml, err := yaml.Marshal(scrapeConfigs)
if err != nil {
return err
}
secret.Data[miniov2.PrometheusAddlScrapeConfigKey] = scrapeCfgYaml
_, err = c.kubeClientSet.CoreV1().Secrets(ns).Update(ctx, secret, metav1.UpdateOptions{})
if err != nil {
return err
}
}
}
seems to check that the secret exists and that it contains a scrape config, but it doesn't seem to compare the config contents with what is expected.

Steps to Reproduce (for bugs)

  1. Setup a new tenant without TLS and with promtheusOperator enabled
  2. Enable TLS

Context

I enabled TLS, requestAutoCert specifically, while setting up KES, which made that a lot simpler. My ingress controller does TLS termination, that's why I previously didn't need TLS internally.

@pschichtel
Copy link
Contributor Author

The same happens when changing the admin password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant