pulumi / pulumi-kubernetes-operator

A Kubernetes Operator that automates the deployment of Pulumi Stacks
Apache License 2.0
222 stars 55 forks source link

[V2] Enable metrics server #706

Closed rquitales closed 1 week ago

rquitales commented 2 weeks ago

Proposed changes

This PR exposes the metrics service in our manifests and adds new unit tests to ensure the metrics logic is correct.

Technical changes

  1. Added sigs.k8s.io/controller-runtime/pkg/metrics/filters dependency to allow metrics to be secure by default (guidance from kubebuilder book/scaffold)
  2. Adds new kustomize patches and bases to expose the metrics server in a typical PKO deployment
  3. Refactor the updateStackCallback function
  4. Added the stacks_reconciling metric
  5. Added ginkgo tests to exercise the Program and Stack metrics
  6. Fixed some bugs in our metrics as determined through the unit tests

Testing

Note, e2e tests will be added in a followup PR.

Related issues (optional)

Closes: #576

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 67.27273% with 18 lines in your changes missing coverage. Please review.

Project coverage is 50.22%. Comparing base (2a67d4c) to head (2bc40ee). Report is 1 commits behind head on v2.

Files with missing lines Patch % Lines
operator/cmd/main.go 0.00% 12 Missing :warning:
...erator/internal/controller/pulumi/metrics_stack.go 88.23% 2 Missing and 2 partials :warning:
operator/internal/controller/pulumi/utils.go 60.00% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## v2 #706 +/- ## ========================================== + Coverage 49.57% 50.22% +0.65% ========================================== Files 27 27 Lines 2911 2919 +8 ========================================== + Hits 1443 1466 +23 + Misses 1290 1272 -18 - Partials 178 181 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.