-
Notifications
You must be signed in to change notification settings - Fork 565
Secure metrics endpoint with cntrlr-runtime metrics authz mechanics #3660
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
base: master
Are you sure you want to change the base?
Conversation
a62b02f
to
f63b885
Compare
/lgtm |
Looks like I have to make change to the metrics e2e tests coz the current ones are not authenticating themselves which is why they're failing. Great sign that the changes are working, working on the modifications to the e2e tests..... |
f63b885
to
7704b39
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
7704b39
to
9bac784
Compare
Signed-off-by: Anik Bhattacharjee <[email protected]>
9bac784
to
63ab287
Compare
KIND_CLUSTER_NAME="kind-olmv0-${i}" \ | ||
KIND_CREATE_OPTS="--kubeconfig=${E2E_KUBECONFIG_ROOT}/kubeconfig-${i}" \ | ||
HELM_INSTALL_OPTS="--kubeconfig ${E2E_KUBECONFIG_ROOT}/kubeconfig-${i}" \ | ||
HELM_INSTALL_OPTS="--kubeconfig ${E2E_KUBECONFIG_ROOT}/kubeconfig-${i} --set certManager.enabled=false" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This presented itself as the easiest way to do all the tests we have for metrics (since these tests are about testing the metrics omitted, eg "creating a subscription emits these metrics", and not the security aspect of the endpoints).
path: /healthz | ||
port: {{ .Values.olm.service.internalPort }} | ||
scheme: {{ if .Values.olm.tlsSecret }}HTTPS{{ else }}HTTP{{end}} | ||
port: {{ if .Values.certManager.enabled }}{{ .Values.olm.service.internalPortHttps }}{{ else }}{{ .Values.olm.service.internalPort }}{{ end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which means the templates had to be updated to configure different endpoints based on the presence of the cert-manager
e2e-local: e2e-build kind-create e2e-local-deploy e2e | ||
|
||
.PHONY: e2e-local-deploy | ||
e2e-local-deploy: $(KIND) $(HELM) #HELP Deploy OLM for e2e testing (without cert-manager) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also had to make a new deploy target to deploy olm without cert-manager for e2e testing
/lgtm |
Description of the change:
Implements native metrics authentication and authorization for OLM and catalog operators using controller-runtime
filters. Adds TLS support with automatic certificate management via cert-manager, replacing unprotected HTTP metrics
endpoints with authenticated HTTPS endpoints on port 8443.
Motivation for the change:
Current metrics endpoints are unprotected and accessible to anyone with cluster access, creating potential security
risks. This change secures metrics access by requiring proper Kubernetes RBAC authentication and authorization,
following the same pattern used by operator-controller for production deployments.
Architectural changes:
WithAuthenticationAndAuthorization
filter for metrics endpointsTesting remarks:
Reviewer Checklist
/doc
[FLAKE]
are truly flaky and have an issue