feat: add flag to enable anonymous metrics access#3110
feat: add flag to enable anonymous metrics access#3110jindijamie wants to merge 3 commits intokubernetes-sigs:mainfrom
Conversation
|
Hi @jindijamie. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3110 +/- ##
===========================================
- Coverage 45.50% 24.64% -20.86%
===========================================
Files 79 126 +47
Lines 7782 17992 +10210
===========================================
+ Hits 3541 4435 +894
- Misses 4099 13265 +9166
- Partials 142 292 +150 🚀 New features to boost your workflow:
|
52216f8 to
e3ba267
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ccojocar, jindijamie The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/release-note-none |
e3ba267 to
6f0acb9
Compare
|
New changes are detected. LGTM label has been removed. |
|
/retest |
|
@jindijamie: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@jindijamie: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
saschagrunert
left a comment
There was a problem hiding this comment.
Follow-up review. The flag rename to enable-insecure-metrics-access and the release note address the previous round's concerns, but a few issues remain, one of them significant.
Also: the three commits ("feat: add flag...", "Update the name...", "Fix lint issue") should be squashed into one.
| if ctx.Bool(enableInsecureMetricsAccessFlag) { | ||
| setupLog.Info("Insecure metrics access allowed (TLS and authentication disabled)") | ||
|
|
||
| metricsOptions.SecureServing = false |
There was a problem hiding this comment.
This flag is defined and consumed in runDaemon, but there's no mechanism to propagate it to the spod daemonset. The operator manages the daemonset; users can't set env vars on it directly without the operator overwriting them on the next reconciliation.
The established pattern (see EnableProfiling in api/spod/v1alpha1/spod_types.go:289 and spod_controller.go:773) is:
- Add a field to
SPODSpec(e.g.EnableInsecureMetricsAccess bool) - Read it in the spod controller and inject
ENABLE_INSECURE_METRICS_ACCESSas an env var into the daemon container
Without this integration, the flag is unusable in a standard SPO deployment.
| &cli.BoolFlag{ | ||
| Name: enableInsecureMetricsAccessFlag, | ||
| Usage: "enable insecure metrics access (disables TLS and authentication)", | ||
| EnvVars: []string{config.EnableInsecureMetricsAccessEnvKey}, | ||
| }, |
There was a problem hiding this comment.
This flag is only consumed in runDaemon but is registered as a global flag. All other daemon-specific feature flags (seccompFlag, selinuxFlag, recordingFlag, memOptimFlag) are registered under the daemon subcommand's flags (lines 185-212). Move it there for consistency.
| } | ||
|
|
||
| if ctx.Bool(enableInsecureMetricsAccessFlag) { | ||
| setupLog.Info("Insecure metrics access allowed (TLS and authentication disabled)") |
There was a problem hiding this comment.
Follow-up from the previous round: since there's no warning level on setupLog, consider making the message stand out by prefixing it:
| setupLog.Info("Insecure metrics access allowed (TLS and authentication disabled)") | |
| setupLog.Info("WARNING: Insecure metrics access enabled, TLS and authentication disabled") |
| // EnableInsecureMetricsAccessEnvKey is the environment variable key for enabling insecure | ||
| // metrics access(disables TLS and authentication). |
There was a problem hiding this comment.
Missing space before parenthesis.
| // EnableInsecureMetricsAccessEnvKey is the environment variable key for enabling insecure | |
| // metrics access(disables TLS and authentication). | |
| // EnableInsecureMetricsAccessEnvKey is the environment variable key for enabling insecure | |
| // metrics access (disables TLS and authentication). |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Allow metrics access without authentication.
The default behavior is still require authentication.
Which issue(s) this PR fixes:
Does this PR have test?
N/A
Special notes for your reviewer:
Does this PR introduce a user-facing change?