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 has the wrong format #990

Closed
WolfspiritM opened this issue Jan 28, 2022 · 1 comment · Fixed by #991
Closed

Prometheus scrape config has the wrong format #990

WolfspiritM opened this issue Jan 28, 2022 · 1 comment · Fixed by #991

Comments

@WolfspiritM
Copy link
Contributor

WolfspiritM commented Jan 28, 2022

When using the prometheus operator configuration then the scrape config gets created in the wrong format.

The content of the secret "minio-prom-additional-scrape-config" is:

- BearerToken:  ey...
  JobName: minio-minio-job
  MetricsPath: /minio/v2/metrics/cluster
  Scheme: http
  StaticConfigs:
  - Targets:
    - minio.namespace.svc.cluster.local:80
  TLSConfig:
    CAFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt

Expected Behavior

The correct format should be used. (e.g. bearer_token instead of BearerToken)

Current Behavior

Prometheus fails to start cause the scrape config is wrong.

level=error ts=2022-01-28T11:47:19.304Z caller=main.go:356 msg="Error loading config (--config.file=/etc/prometheus/config_out/prometheus.env.yaml)" err="parsing YAML file /etc/prometheus/config_out/prometheus.env.yaml: yaml: unmarshal errors:\n line 1494: field BearerToken not found in type config.ScrapeConfig\n line 1495: field JobName not found in type config.ScrapeConfig\n line 1496: field MetricsPath not found in type config.ScrapeConfig\n line 1497: field Scheme not found in type config.ScrapeConfig\n line 1498: field StaticConfigs not found in type config.ScrapeConfig\n line 1501: field TLSConfig not found in type config.ScrapeConfig"

Possible Solution

I think I found the reason.

yaml.Marshal is from "sigs.k8s.io/yaml" which doesn't respect the struct tags!
https://go.dev/play/p/3byqOcao1je

While the "gopkg.in/yaml.v2" version does:
https://go.dev/play/p/iJyWgTr8gZa

The PR that broke it is:
#986

Steps to Reproduce (for bugs)

  1. Use the prometheus operator setting
  2. Look into the "minio-prom-additional-scrape-config" secret

Context

Prometheus stopped working completly

Regression

No

Your Environment

  • Version used (minio-operator): 4.4.4
  • Environment name and version (e.g. kubernetes v1.17.2): kubernetes v1.21.8+rke2r1
  • Server type and version:
  • Operating System and version (uname -a): Ubuntu
  • Link to your deployment file:
@WolfspiritM
Copy link
Contributor Author

@dvaldivia @kanagarajkm Hi. Maybe you can take a look as this currently prevents prometheus from starting at all (Crashloop)

WolfspiritM added a commit to WolfspiritM/operator that referenced this issue Jan 28, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Jan 30, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Jan 30, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Jan 30, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Jan 30, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Jan 30, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Jan 30, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Feb 1, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Feb 1, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Feb 1, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Feb 1, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Feb 1, 2022
harshavardhana added a commit to harshavardhana/operator that referenced this issue Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant