-
Notifications
You must be signed in to change notification settings - Fork 39
refactor: enable metrics manifests #79
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
Merged
k8s-ci-robot
merged 10 commits into
kubernetes-sigs:main
from
AvineshTripathi:feat/controller-metrics
Jan 29, 2026
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3d5fe4d
refactor: enable metrics manifests
AvineshTripathi 50a3a97
Merge branch 'main' into feat/controller-metrics
AvineshTripathi 4b24a17
feat(config): refactor metrics to use Kustomize components and dynami…
AvineshTripathi 4822acb
feat(makefile): avoid nested make call when running build
AvineshTripathi 6f8d37a
Merge branch 'main' into feat/controller-metrics
AvineshTripathi 7388144
fix(makefile): revert changes done in crd-ref-docs
AvineshTripathi 57f445e
fix(makefile): remove debug-deploy command
AvineshTripathi f6a70ac
fix: rename total rule metrics
AvineshTripathi a272040
feat(Makefile): add helper targets for metrics
AvineshTripathi 28d1d94
feat(config): remove clusterscope bindings from the config
AvineshTripathi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # The following manifests contain a self-signed issuer CR and a certificate CR. | ||
| # More document can be found at https://docs.cert-manager.io | ||
| apiVersion: cert-manager.io/v1 | ||
| kind: Issuer | ||
| metadata: | ||
| name: selfsigned-issuer | ||
| namespace: system | ||
|
ajaysundark marked this conversation as resolved.
|
||
| spec: | ||
| selfSigned: {} | ||
| --- | ||
| apiVersion: cert-manager.io/v1 | ||
| kind: Certificate | ||
| metadata: | ||
| name: metrics-certs | ||
| namespace: system | ||
| spec: | ||
| commonName: nrr-metrics | ||
| dnsNames: | ||
| - $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc | ||
| - $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local | ||
| issuerRef: | ||
| kind: Issuer | ||
| name: selfsigned-issuer | ||
| secretName: metrics-server-cert | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1alpha1 | ||
| kind: Component | ||
| resources: | ||
| - certificate.yaml | ||
|
|
||
| configurations: | ||
| - kustomizeconfig.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| nameReference: | ||
| - kind: Issuer | ||
| group: cert-manager.io | ||
| fieldSpecs: | ||
| - kind: Certificate | ||
| group: cert-manager.io | ||
| path: spec/issuerRef/name | ||
|
|
||
| - kind: Secret | ||
| version: v1 | ||
| fieldSpecs: | ||
| - kind: Certificate | ||
| group: cert-manager.io | ||
| path: spec/secretName | ||
|
|
||
| varReference: | ||
| - kind: Certificate | ||
| group: cert-manager.io | ||
| path: spec/dnsNames |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,22 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1alpha1 | ||
| kind: Component | ||
| resources: | ||
| - monitor.yaml | ||
| - metrics_service.yaml | ||
|
|
||
| # [PROMETHEUS-WITH-CERTS] The following patch configures the ServiceMonitor in ../prometheus | ||
| # to securely reference certificates created and managed by cert-manager. | ||
| # Additionally, ensure that you uncomment the [METRICS WITH CERTMANAGER] patch under config/default/kustomization.yaml | ||
| # to mount the "metrics-server-cert" secret in the Manager Deployment. | ||
| #patches: | ||
| # - path: monitor_tls_patch.yaml | ||
| # target: | ||
| # kind: ServiceMonitor | ||
| patches: | ||
| # Bind metrics to port 8080 for HTTP. | ||
| # This matches the Service and ServiceMonitor configuration in this directory. | ||
| # - path: manager_prometheus_metrics.yaml | ||
| # target: | ||
| # kind: Deployment | ||
| # name: controller-manager | ||
|
|
||
| # By default, metrics are disabled in the manager (default : "0"). | ||
| # This component adds the Service and ServiceMonitor for Prometheus, | ||
| # and applies the patch to bind the manager to port :8080(it is done in Makefile for now). | ||
|
|
||
| # Patches for TLS are in the 'tls' component which will: | ||
| # 1. Overlay the HTTPS args (:8443) and security flags | ||
| # 2. Add ServiceMonitor TLS config | ||
| # 3. Mount CertManager secrets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # This patch adds the args to allow exposing the metrics endpoint using HTTP | ||
| - op: add | ||
| path: /spec/template/spec/containers/0/args/- | ||
| value: --metrics-bind-address=:8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # This patch adds the args, volumes, and ports to allow the manager to use the metrics-server certs. | ||
|
|
||
| # Add the volumeMount for the metrics-server certs | ||
| - op: add | ||
| path: /spec/template/spec/containers/0/volumeMounts/- | ||
| value: | ||
| mountPath: /tmp/k8s-metrics-server/metrics-certs | ||
| name: metrics-certs | ||
| readOnly: true | ||
|
|
||
| # Add the metrics-server certs volume configuration | ||
| - op: add | ||
| path: /spec/template/spec/volumes/- | ||
| value: | ||
| name: metrics-certs | ||
| secret: | ||
| secretName: metrics-server-cert | ||
| optional: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1alpha1 | ||
| kind: Component | ||
|
|
||
| patches: | ||
| # Enable HTTPS args in Deployment | ||
| - path: manager_prometheus_metrics_tls.yaml | ||
| target: | ||
| kind: Deployment | ||
| # Configure ServiceMonitor for TLS | ||
| - path: monitor_tls_patch.yaml | ||
| target: | ||
| kind: ServiceMonitor | ||
| # Mount CertManager secrets in Deployment | ||
| - path: cert_metrics_manager_patch.yaml | ||
| target: | ||
| kind: Deployment | ||
| # Switch Service to 8443 for TLS | ||
| - path: metrics_service_tls_patch.yaml | ||
| target: | ||
| kind: Service | ||
|
|
||
| replacements: | ||
| - source: | ||
| kind: Service | ||
| version: v1 | ||
| name: controller-manager-metrics-service | ||
| fieldPath: metadata.name | ||
| targets: | ||
| - select: | ||
| kind: Certificate | ||
| group: cert-manager.io | ||
| version: v1 | ||
| name: metrics-certs | ||
| fieldPaths: | ||
| - spec.dnsNames.0 | ||
| - spec.dnsNames.1 | ||
| options: | ||
| delimiter: '.' | ||
| index: 0 | ||
| create: true | ||
| - select: | ||
| kind: ServiceMonitor | ||
| group: monitoring.coreos.com | ||
| version: v1 | ||
| name: controller-manager-metrics-monitor | ||
| fieldPaths: | ||
| - spec.endpoints.0.tlsConfig.serverName | ||
| options: | ||
| delimiter: '.' | ||
| index: 0 | ||
| create: true | ||
| - source: | ||
| kind: Service | ||
| version: v1 | ||
| name: controller-manager-metrics-service | ||
| fieldPath: metadata.namespace | ||
| targets: | ||
| - select: | ||
| kind: Certificate | ||
| group: cert-manager.io | ||
| version: v1 | ||
| name: metrics-certs | ||
| fieldPaths: | ||
| - spec.dnsNames.0 | ||
| - spec.dnsNames.1 | ||
| options: | ||
| delimiter: '.' | ||
| index: 1 | ||
| create: true | ||
| - select: | ||
| kind: ServiceMonitor | ||
| group: monitoring.coreos.com | ||
| version: v1 | ||
| name: controller-manager-metrics-monitor | ||
| fieldPaths: | ||
| - spec.endpoints.0.tlsConfig.serverName | ||
| options: | ||
| delimiter: '.' | ||
| index: 1 | ||
| create: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # This patch adds the args to allow exposing the metrics endpoint using HTTPS | ||
| - op: add | ||
| path: /spec/template/spec/containers/0/args/- | ||
| value: --metrics-bind-address=:8443 | ||
| - op: add | ||
| path: /spec/template/spec/containers/0/args/- | ||
| value: --metrics-secure | ||
| - op: add | ||
| path: /spec/template/spec/containers/0/args/- | ||
| value: --metrics-cert-dir=/tmp/k8s-metrics-server/metrics-certs |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.