Skip to content

[prometheus-pushgateway] Allow existing secret for web config#6624

Open
firasmosbehi wants to merge 3 commits intoprometheus-community:mainfrom
firasmosbehi:feat/pushgateway-webconfig-existing-secret-5979-v2
Open

[prometheus-pushgateway] Allow existing secret for web config#6624
firasmosbehi wants to merge 3 commits intoprometheus-community:mainfrom
firasmosbehi:feat/pushgateway-webconfig-existing-secret-5979-v2

Conversation

@firasmosbehi
Copy link
Copy Markdown
Contributor

@firasmosbehi firasmosbehi commented Feb 9, 2026

What this PR does

  • Adds webConfiguration.existingSecret.name support so users can provide an existing web config secret.
  • Keeps generated secret behavior for inline webConfiguration.basicAuthUsers.
  • Uses generated secret for ServiceMonitor basic auth only when inline users are provided.
  • Adds CI values to validate the new existing-secret path.

Fixes #5979.

Testing

  • helm lint charts/prometheus-pushgateway
  • GITHUB_SHA=$(git rev-parse HEAD) ct lint --config .github/linters/ct.yaml --charts charts/prometheus-pushgateway

Signed-off-by: Firas Mosbehi <firas.mosbehi@insat.ucar.tn>
Signed-off-by: Firas Mosbehi <firas.mosbehi@insat.ucar.tn>
Signed-off-by: Firas Mosbehi <firas.mosbehi@insat.ucar.tn>
Copy link
Copy Markdown
Contributor

@zeritti zeritti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thak you, @firasmosbehi, for your PR. Please, see my comments below.

webConfiguration: {}
# basicAuthUsers:
# username: password
# existingSecret:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user needs to know that the secret's key must be web-config.yaml as this name is expected in the corresponding Pushgateway's flag.

The feature itself is useful. However, setting existingSecret will lead to Pushgateway never becoming ready being repeatedly restarted. This is because probes have no knowledge of the basic authentication configuration as long as it is present in the web-config file (would receive 401). The user would have to know the configuration and enter it in the probes' headers handling the values properly as secrets. I think we should not require the user to do that as this would go against the advantage of using an existing secret.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@firasmosbehi Hello! Are you planning to make the changes mentioned?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent an exposure of the credentials in probes' configuration, we could switch from the httpGet probe to the tcpSocket probe if an existing secret is set. I am not aware of any negative impact of such a change in this case. The only thing that might not be "nice" would probably be logging TLS handshake errors at Pushgateway with TLS set up.

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 this pull request may close these issues.

[prometheus-pushgateway] Add an ability to configure basicAuthUsers via secrets

3 participants