Skip to content

USHIFT-6951: Add metrics-server as optional MicroShift component#6808

Open
copejon wants to merge 9 commits into
openshift:mainfrom
copejon:ushift-6951/metrics-server
Open

USHIFT-6951: Add metrics-server as optional MicroShift component#6808
copejon wants to merge 9 commits into
openshift:mainfrom
copejon:ushift-6951/metrics-server

Conversation

@copejon

@copejon copejon commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Add metrics-server as an optional MicroShift component deployed via kustomize manifests and packaged as microshift-metrics-server and microshift-metrics-server-release-info RPM sub-packages.

This is PR 1/3 splitting #6763 into independently-mergeable patches. The three PRs can merge in any order.
Siblings: #6809 (kube-state-metrics), #6810 (node-exporter)

What's included

  • Kustomize manifests (assets/optional/metrics-server/) — Deployment, APIService, RBAC, NetworkPolicy, PDB, service-ca TLS, and openshift-monitoring namespace
  • Kubelet client cert provisioning — dedicated cert under kube-apiserver-to-kubelet-signer, applied as Secret + ConfigMap after the namespace exists (pkg/cmd/metrics.go)
  • Healthcheck registrationmergeWorkloads() function and metrics-server map entry in optional workload paths
  • RPM sub-packages%package metrics-server and %package metrics-server-release-info with per-file installs
  • Otel-collector drop-inotelcol.d/ directory structure and microshift-metrics-server.yaml scrape config; service file updated to load drop-in configs via bash wrapper
  • Auto-rebase integrationupdate_metrics_images() in rebase.sh + assets_metrics.yaml for all three exporters (shared infrastructure lives in this PR)
  • Test infra — RPM names added to test/bin/common.sh

Summary by CodeRabbit

Release Notes

  • New Features

    • Added metrics-server as an optional component for Kubernetes cluster metrics collection and monitoring.
    • Integrated metrics-server with OpenTelemetry observability pipeline via collector configuration.
  • Chores

    • Updated observability subsystem dependencies and test infrastructure to support metrics-server deployment.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 5, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 5, 2026

Copy link
Copy Markdown

@copejon: This pull request references USHIFT-6951 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Add metrics-server as an optional MicroShift component deployed via kustomize manifests and packaged as microshift-metrics-server and microshift-metrics-server-release-info RPM sub-packages.

This is PR 1/3 splitting #6763 into independently-mergeable patches. The three PRs can merge in any order.

What's included

  • Kustomize manifests (assets/optional/metrics-server/) — Deployment, APIService, RBAC, NetworkPolicy, PDB, service-ca TLS, and openshift-monitoring namespace
  • Kubelet client cert provisioning — dedicated cert under kube-apiserver-to-kubelet-signer, applied as Secret + ConfigMap after the namespace exists (pkg/cmd/metrics.go)
  • Healthcheck registrationmergeWorkloads() function and metrics-server map entry in optional workload paths
  • RPM sub-packages%package metrics-server and %package metrics-server-release-info with per-file installs
  • Otel-collector drop-inotelcol.d/ directory structure and microshift-metrics-server.yaml scrape config; service file updated to load drop-in configs via bash wrapper
  • Auto-rebase integrationupdate_metrics_images() in rebase.sh + assets_metrics.yaml for all three exporters (shared infrastructure lives in this PR)
  • Test infra — RPM names added to test/bin/common.sh

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR adds metrics-server as an optional observability component to MicroShift. It includes Kubernetes manifests with RBAC and security hardening, TLS certificate provisioning, OpenTelemetry integration, RPM packaging, and build automation to generate per-architecture image overrides and release metadata during rebasing.

Changes

Metrics-Server Component Integration

Layer / File(s) Summary
Namespace and RBAC foundation
assets/optional/metrics-server/00-namespace.yaml, assets/optional/metrics-server/01-service-account.yaml, assets/optional/metrics-server/01-cluster-role.yaml, assets/optional/metrics-server/01-cluster-role-binding.yaml, assets/optional/metrics-server/01-cluster-role-binding-auth-delegator.yaml, assets/optional/metrics-server/01-role-binding-auth-reader.yaml
Creates openshift-monitoring namespace with pod-security enforcement and defines ServiceAccount, ClusterRole granting read access to nodes/metrics, pods, and nodes, plus ClusterRoleBindings and RoleBinding for API server authentication and delegation.
Deployment, Service, and configuration
assets/optional/metrics-server/03-deployment.yaml, assets/optional/metrics-server/02-configmap-audit-profiles.yaml, assets/optional/metrics-server/04-service.yaml, assets/optional/metrics-server/04-api-service.yaml
Deploys metrics-server container with TLS/cipher configuration, kubelet connectivity, HTTPS probes, security hardening (non-root, read-only root, no privilege escalation, dropped capabilities), audit profiles ConfigMap, and exposes via Service on port 443 and APIService registering metrics.k8s.io/v1beta1.
Kustomization and release configuration
assets/optional/metrics-server/kustomization.yaml, assets/optional/metrics-server/kustomization.aarch64.yaml, assets/optional/metrics-server/kustomization.x86_64.yaml, assets/optional/metrics-server/release-metrics-server-aarch64.json, assets/optional/metrics-server/release-metrics-server-x86_64.json
Base kustomization lists all resources; architecture-specific overlays pin image digests; release JSON files track per-architecture image metadata for version management.
TLS certificate provisioning
pkg/cmd/init.go, pkg/cmd/run.go, pkg/util/cryptomaterial/certinfo.go, pkg/components/metrics.go
Registers metrics-server kubelet client CSR in init phase, provides MetricsServerKubeletClientCertDir helper, implements ProvisionMetricsServerCerts to create TLS Secret and CA ConfigMap in openshift-monitoring namespace, and integrates provisioning as background goroutine after kustomize startup.
OpenTelemetry Collector integration
packaging/observability/microshift-observability.service, packaging/observability/otelcol.d/microshift-metrics-server.yaml, test/assets/observability/otel_config.yaml
Updates systemd service to load drop-in configs from otelcol.d/, adds prometheus receiver scraping metrics-server HTTPS endpoint with Kubernetes discovery and relabeling, connects to batch processor and OTLP exporter, and adds OTLP exporter test configuration.
RPM subpackage definitions and installation
packaging/rpm/microshift.spec
Adds microshift-metrics-server (x86_64/aarch64) and microshift-metrics-server-release-info (noarch) subpackages; observability depends on metrics-server; installs manifests to /usr/lib/microshift/manifests.d/080-microshift-metrics-server with arch-specific overlays and release JSON to release data directory.
Optional component framework and build automation
pkg/healthcheck/microshift_optional_workloads.go, scripts/auto-rebase/rebase.sh, scripts/auto-rebase/assets_metrics.yaml, test/bin/common.sh
Adds workload merging for namespace accumulation, extends download_release() to clone optional component repos, implements update_metrics_images to generate per-arch release JSON and kustomization overlays with pinned digests during rebasing, registers metrics-server and related components in asset/RPM lists.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested labels

ready-for-human-review


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error Found klog.Infof lines in pkg/cmd/init.go logging internal hostnames/IPs and DNS (NodeIP and %s DNS/server), which the check treats as sensitive. Remove/avoid printing NodeIP/DNS in klog.Infof (e.g., log generic messages or move to higher verbosity with masking) so internal addresses aren’t written to logs.
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (13 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding metrics-server as an optional MicroShift component. It directly aligns with the comprehensive changeset across manifests, RPM packaging, certificate provisioning, and integration work.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No Ginkgo tests detected in repo (no ginkgo imports or ginkgo.It/Describe/Context/When/Specify in test/pkg/cmd), so no unstable/dynamic test titles to flag.
Test Structure And Quality ✅ Passed No Ginkgo test code found: zero non-deps Go files import github.com/onsi/ginkgo/onsi/ginkgo, so the requested Ginkgo quality requirements aren’t applicable.
Microshift Test Compatibility ✅ Passed PR #6808 only touches test/assets/observability/otel_config.yaml and test/bin/common.sh; no new Ginkgo/e2e test files were added, so no MicroShift API incompatibilities to flag.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR #6808 changes only manifests/packaging/runtime code (no *_test.go or ginkgo/e2e tests added), so no new SNO multi-node assumptions to flag.
Topology-Aware Scheduling Compatibility ✅ Passed Deployment 03-deployment.yaml uses nodeSelector kubernetes.io/os=linux and only tolerates master taint; no nodeSelector/affinity to master/control-plane, no anti-affinity/topologySpread/PDB/maxUnav...
Ote Binary Stdout Contract ✅ Passed In PR-touched Go files (pkg/cmd/init.go, pkg/cmd/run.go, pkg/components/metrics.go, pkg/healthcheck, pkg/util/cryptomaterial), no stdout writes (fmt.Print/os.Stdout) or process-level main/init/Test...
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Diff touches 37 files for metrics-server assets/scripts; scan for Ginkgo It/Describe/Context/When in changed files found none (only a 'Ginkgo' mention in test/bin/common.sh).
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB usage found in metrics-server assets and related Go/script files; metrics-server TLS cipher suites are only AES-GCM/ChaCha20; no custom-crypto or token/secret...
Container-Privileges ✅ Passed No container privileges detected: metrics-server Deployment has allowPrivilegeEscalation: false and runAsNonRoot: true, with no hostPID/hostNetwork/hostIPC/SYS_ADMIN or privileged: true in the metr...
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=warning msg="The linter 'gomodguard' is deprecated (since v2.12.0) due to: new major version. Replaced by gomodguard_v2."
level=warning msg="Suggested new configuration:\nlinters:\n enable:\n - gomodguard_v2\n"
level=error msg="Running error: context loading failed: failed to load packages: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: inconsistent vendoring in :\n\tgithub.com/apparentlymart/go-cidr@v1.1.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/coreos/go-systemd@v0.0.0-20190321100706-95778dfbb74e: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/google/go-cmp@v0.7.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/miekg/dns@v1.1.63: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/openshift/api@v0.0.0-20260511191110-9b69e5fa27e9: is

... [truncated 31032 characters] ...

elet: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/metrics: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/mount-utils: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/pod-security-admission: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/sample-apiserver: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/sample-cli-plugin: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\tk8s.io/sample-controller: is replaced in go.mod, but not marked as replaced in vendor/modules.txt\n\n\tTo ignore the vendor directory, use -mod=readonly or -mod=mod.\n\tTo sync the vendor directory, run:\n\t\tgo mod vendor\n"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from eslutsky and pacevedom June 5, 2026 04:30
@openshift-ci

openshift-ci Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: copejon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 5, 2026
@copejon copejon force-pushed the ushift-6951/metrics-server branch from a185390 to 2f00a69 Compare June 5, 2026 06:29

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 9

🧹 Nitpick comments (1)
packaging/observability/microshift-observability.service (1)

11-11: ⚡ Quick win

Use an argv array instead of a concatenated shell string

Building ARGS as a string is brittle (word-splitting/path edge cases). Use a bash array and quoted expansion.

Proposed change
-ExecStart=/bin/bash -c 'ARGS="--config=file:/etc/microshift/observability/opentelemetry-collector.yaml"; for f in /etc/microshift/observability/otelcol.d/*.yaml; do [ -f "$$f" ] && ARGS="$$ARGS --config=file:$$f"; done; exec /usr/bin/opentelemetry-collector $$ARGS'
+ExecStart=/bin/bash -c 'args=(--config=file:/etc/microshift/observability/opentelemetry-collector.yaml); for f in /etc/microshift/observability/otelcol.d/*.yaml; do [ -f "$$f" ] && args+=(--config=file:$$f); done; exec /usr/bin/opentelemetry-collector "$${args[@]}"'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packaging/observability/microshift-observability.service` at line 11, The
ExecStart line builds a brittle space-joined ARGS string; change it to build a
bash array and use quoted array expansion when executing the collector:
initialize ARGS=() (or ARGS=()), append elements as
ARGS+=(--config="file:/etc/microshift/observability/opentelemetry-collector.yaml")
and inside the loop for f in /etc/microshift/observability/otelcol.d/*.yaml; do
[ -f "$f" ] && ARGS+=(--config="file:$f"); done; finally exec
/usr/bin/opentelemetry-collector "${ARGS[@]}" so that each --config is a
separate argv element and you avoid word-splitting/path edge cases for the
ExecStart/ARGS usage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@assets/optional/metrics-server/00-namespace.yaml`:
- Around line 7-9: The namespace-level PodSecurity labels
pod-security.kubernetes.io/enforce, pod-security.kubernetes.io/audit, and
pod-security.kubernetes.io/warn are set to "privileged" which is too permissive;
change their values to a safer profile (e.g., "baseline" or "restricted") unless
you have a documented exception, and ensure the three keys (enforce, audit,
warn) are updated consistently to the chosen profile so namespace-wide policies
default to the tightened posture.

In `@assets/optional/metrics-server/03-deployment.yaml`:
- Around line 67-70: The metrics-server container currently only specifies
resource requests; add a matching limits block under the same resources section
for the metrics-server container to enforce CPU and memory caps (e.g.,
limits.cpu: 100m and limits.memory: 100Mi). Update the Deployment's container
resources block (the metrics-server container in the manifest) to include both
requests and limits so it conforms to the "Resource limits (cpu, memory) on
every container" guideline.
- Around line 71-75: The container securityContext currently sets
allowPrivilegeEscalation, readOnlyRootFilesystem and runAsNonRoot but does not
drop Linux capabilities; update the Pod/Container spec by adding a capabilities
block under securityContext (e.g., in the same container spec that contains
allowPrivilegeEscalation/readOnlyRootFilesystem/runAsNonRoot) with
capabilities.drop set to ["ALL"] so all capabilities are removed by default and
then explicitly add back any minimal capabilities only if absolutely required
elsewhere; ensure the change is applied alongside the existing
terminationMessagePolicy and other securityContext fields.

In `@assets/optional/metrics-server/kustomization.yaml`:
- Around line 3-13: The kustomization.yaml resources list is missing the two
RPM-installed manifests; update the resources array (the same block that
currently lists 00-namespace.yaml, 03-deployment.yaml, 04-service.yaml, etc.) to
include network-policy-downstream.yaml and pod-disruption-budget.yaml so both
NetworkPolicy and PodDisruptionBudget are applied; add those two filenames to
the resources list in assets/optional/metrics-server/kustomization.yaml.

In `@pkg/cmd/metrics.go`:
- Around line 44-50: The polling closure passed to wait.PollUntilContextTimeout
currently treats any Get() error as "not ready" and keeps retrying; change the
logic in the closure used with wait.PollUntilContextTimeout so that after
calling clientset.CoreV1().Namespaces().Get(ctx, ns, metav1.GetOptions{}), if
err == nil return true,nil; if apierrors.IsNotFound(err) log and return
false,nil to keep retrying; for any other error return false, err (so the poll
stops and surfaces auth/TLS/transport failures). Ensure you import/use
apierrors.IsNotFound and update the closure around
clientset.CoreV1().Namespaces().Get accordingly.
- Around line 24-31: The current check uses
util.PathExists(metricsServerManifestPath) so provisioning proceeds whenever the
file exists even if the metrics component is not enabled; change the gating to
verify the component is enabled and that any configured kustomization paths are
present (e.g., read the configured kustomizationPaths or component flag used by
your installer and ensure they are enabled) before attempting cert provisioning.
Update the logic around util.PathExists(metricsServerManifestPath) to first
consult the metrics enablement/config (the same config that controls
installation) and validate each configured kustomization path exists, returning
early if the component is disabled or no configured paths are present.

In `@scripts/auto-rebase/assets_metrics.yaml`:
- Around line 34-37: Update the two YAML asset entries so they match the rest of
the PR naming convention: change the "file" values
"release-metrics-aarch64.json" and "release-metrics-x86_64.json" to
"release-metrics-server-aarch64.json" and "release-metrics-server-x86_64.json"
respectively in the assets_metrics.yaml file (the two "- file:" entries shown),
leaving the corresponding "ignore" values unchanged.

In `@scripts/auto-rebase/assets.yaml`:
- Around line 304-326: The asset list under the optional/metrics-server/ entry
is missing the two manifests that the packaging script expects; update the files
list for the optional/metrics-server/ dir to include entries for
network-policy-downstream.yaml and pod-disruption-budget.yaml so the asset set
matches packaging/rpm/microshift.spec; ensure the new entries use the same
indentation/format as the existing file: ... entries (e.g., add "- file:
network-policy-downstream.yaml" and "- file: pod-disruption-budget.yaml" under
the files: block for the optional/metrics-server/ dir).

In `@scripts/auto-rebase/rebase.sh`:
- Around line 1184-1187: The script currently skips unknown images when
release_tag is empty (checking release_tag, orig_image, component_dir) which
allows silent incomplete kustomization.*.yaml outputs; change the behavior to
fail-fast by replacing the continue path with a non-zero exit (e.g., >&2 echo
descriptive error including orig_image and component_dir, then exit 1) so the
rebase.sh run stops immediately on unmapped images and surfaces the problem to
CI.

---

Nitpick comments:
In `@packaging/observability/microshift-observability.service`:
- Line 11: The ExecStart line builds a brittle space-joined ARGS string; change
it to build a bash array and use quoted array expansion when executing the
collector: initialize ARGS=() (or ARGS=()), append elements as
ARGS+=(--config="file:/etc/microshift/observability/opentelemetry-collector.yaml")
and inside the loop for f in /etc/microshift/observability/otelcol.d/*.yaml; do
[ -f "$f" ] && ARGS+=(--config="file:$f"); done; finally exec
/usr/bin/opentelemetry-collector "${ARGS[@]}" so that each --config is a
separate argv element and you avoid word-splitting/path edge cases for the
ExecStart/ARGS usage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 25baa466-07b1-4aa1-90d3-a9e96b03c015

📥 Commits

Reviewing files that changed from the base of the PR and between 93e835e and 2f00a69.

📒 Files selected for processing (27)
  • assets/optional/metrics-server/00-namespace.yaml
  • assets/optional/metrics-server/01-cluster-role-binding-auth-delegator.yaml
  • assets/optional/metrics-server/01-cluster-role-binding.yaml
  • assets/optional/metrics-server/01-cluster-role.yaml
  • assets/optional/metrics-server/01-role-binding-auth-reader.yaml
  • assets/optional/metrics-server/01-service-account.yaml
  • assets/optional/metrics-server/02-configmap-audit-profiles.yaml
  • assets/optional/metrics-server/03-deployment.yaml
  • assets/optional/metrics-server/04-api-service.yaml
  • assets/optional/metrics-server/04-service.yaml
  • assets/optional/metrics-server/kustomization.aarch64.yaml
  • assets/optional/metrics-server/kustomization.x86_64.yaml
  • assets/optional/metrics-server/kustomization.yaml
  • assets/optional/metrics-server/release-metrics-server-aarch64.json
  • assets/optional/metrics-server/release-metrics-server-x86_64.json
  • packaging/observability/microshift-observability.service
  • packaging/observability/otelcol.d/microshift-metrics-server.yaml
  • packaging/rpm/microshift.spec
  • pkg/cmd/init.go
  • pkg/cmd/metrics.go
  • pkg/cmd/run.go
  • pkg/healthcheck/microshift_optional_workloads.go
  • pkg/util/cryptomaterial/certinfo.go
  • scripts/auto-rebase/assets.yaml
  • scripts/auto-rebase/assets_metrics.yaml
  • scripts/auto-rebase/rebase.sh
  • test/bin/common.sh

Comment thread assets/optional/metrics-server/00-namespace.yaml
Comment thread assets/optional/metrics-server/03-deployment.yaml
Comment thread assets/optional/metrics-server/03-deployment.yaml
Comment thread assets/optional/metrics-server/kustomization.yaml
Comment thread pkg/components/metrics.go
Comment thread pkg/components/metrics.go
Comment thread scripts/auto-rebase/assets_metrics.yaml Outdated
Comment thread scripts/auto-rebase/assets.yaml Outdated
Comment thread scripts/auto-rebase/rebase.sh
@copejon copejon force-pushed the ushift-6951/metrics-server branch from 2f00a69 to 2552538 Compare June 5, 2026 06:46

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@assets/optional/metrics-server/02-configmap-audit-profiles.yaml`:
- Around line 2-38: The embedded audit policy YAMLs are malformed because keys
and values are written with JSON-style quoted strings; update
metadata-profile.yaml, none-profile.yaml, request-profile.yaml and
requestresponse-profile.yaml inside the ConfigMap data to valid YAML by removing
the unnecessary quotes around keys (apiVersion, kind, metadata, name,
omitStages, rules, level) and unquoting list items (e.g., RequestReceived), and
ensure each rule is a proper mapping (e.g., - level: Metadata) with correct
indentation so each policy is valid Kubernetes audit policy YAML.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 070ff4b2-5dbd-4430-8057-ef1fec980558

📥 Commits

Reviewing files that changed from the base of the PR and between 2f00a69 and 2552538.

⛔ Files ignored due to path filters (3)
  • etcd/vendor/github.com/openshift/microshift/pkg/config/config.go is excluded by !**/vendor/**
  • etcd/vendor/github.com/openshift/microshift/pkg/config/dns.go is excluded by !**/vendor/**
  • etcd/vendor/github.com/openshift/microshift/pkg/util/cryptomaterial/certinfo.go is excluded by !**/vendor/**
📒 Files selected for processing (27)
  • assets/optional/metrics-server/00-namespace.yaml
  • assets/optional/metrics-server/01-cluster-role-binding-auth-delegator.yaml
  • assets/optional/metrics-server/01-cluster-role-binding.yaml
  • assets/optional/metrics-server/01-cluster-role.yaml
  • assets/optional/metrics-server/01-role-binding-auth-reader.yaml
  • assets/optional/metrics-server/01-service-account.yaml
  • assets/optional/metrics-server/02-configmap-audit-profiles.yaml
  • assets/optional/metrics-server/03-deployment.yaml
  • assets/optional/metrics-server/04-api-service.yaml
  • assets/optional/metrics-server/04-service.yaml
  • assets/optional/metrics-server/kustomization.aarch64.yaml
  • assets/optional/metrics-server/kustomization.x86_64.yaml
  • assets/optional/metrics-server/kustomization.yaml
  • assets/optional/metrics-server/release-metrics-server-aarch64.json
  • assets/optional/metrics-server/release-metrics-server-x86_64.json
  • packaging/observability/microshift-observability.service
  • packaging/observability/otelcol.d/microshift-metrics-server.yaml
  • packaging/rpm/microshift.spec
  • pkg/cmd/init.go
  • pkg/cmd/metrics.go
  • pkg/cmd/run.go
  • pkg/healthcheck/microshift_optional_workloads.go
  • pkg/util/cryptomaterial/certinfo.go
  • scripts/auto-rebase/assets.yaml
  • scripts/auto-rebase/assets_metrics.yaml
  • scripts/auto-rebase/rebase.sh
  • test/bin/common.sh
✅ Files skipped from review due to trivial changes (5)
  • assets/optional/metrics-server/kustomization.aarch64.yaml
  • test/bin/common.sh
  • scripts/auto-rebase/assets_metrics.yaml
  • assets/optional/metrics-server/release-metrics-server-x86_64.json
  • assets/optional/metrics-server/release-metrics-server-aarch64.json
🚧 Files skipped from review as they are similar to previous changes (19)
  • pkg/cmd/run.go
  • assets/optional/metrics-server/kustomization.x86_64.yaml
  • assets/optional/metrics-server/01-cluster-role-binding-auth-delegator.yaml
  • assets/optional/metrics-server/00-namespace.yaml
  • assets/optional/metrics-server/kustomization.yaml
  • assets/optional/metrics-server/01-cluster-role.yaml
  • scripts/auto-rebase/assets.yaml
  • assets/optional/metrics-server/01-role-binding-auth-reader.yaml
  • packaging/observability/microshift-observability.service
  • packaging/observability/otelcol.d/microshift-metrics-server.yaml
  • assets/optional/metrics-server/04-api-service.yaml
  • assets/optional/metrics-server/01-cluster-role-binding.yaml
  • pkg/cmd/init.go
  • pkg/healthcheck/microshift_optional_workloads.go
  • assets/optional/metrics-server/01-service-account.yaml
  • pkg/cmd/metrics.go
  • assets/optional/metrics-server/03-deployment.yaml
  • packaging/rpm/microshift.spec
  • scripts/auto-rebase/rebase.sh

Comment thread assets/optional/metrics-server/02-configmap-audit-profiles.yaml Outdated
@copejon copejon force-pushed the ushift-6951/metrics-server branch from 2552538 to 6f8a50b Compare June 5, 2026 07:24
@coderabbitai coderabbitai Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 5, 2026
@copejon copejon force-pushed the ushift-6951/metrics-server branch from 6f8a50b to 82550e8 Compare June 5, 2026 07:37
@coderabbitai coderabbitai Bot removed the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 5, 2026
@copejon copejon force-pushed the ushift-6951/metrics-server branch 2 times, most recently from 9cc9d0e to 261c1a0 Compare June 5, 2026 08:12

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

♻️ Duplicate comments (1)
scripts/auto-rebase/rebase.sh (1)

1191-1193: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Do not skip unmapped manifest images.

Still valid from the earlier review: warning-and-continue here can emit a partial kustomization.${arch}.yaml, so the rebase succeeds with broken output.

Patch
                 if [[ -z "${release_tag}" ]]; then
-                    >&2 echo "WARNING: Unknown metrics image '${orig_image}' in ${component_dir}, skipping"
-                    continue
+                    >&2 echo "ERROR: Unknown metrics image '${orig_image}' in ${component_dir}"
+                    return 1
                 fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/auto-rebase/rebase.sh` around lines 1191 - 1193, The current block in
rebase.sh that checks if [[ -z "${release_tag}" ]] and then echoes a warning and
continues causes partial kustomization.${arch}.yaml output when an image
(orig_image) isn't in the mapping; instead, stop skipping: when release_tag is
empty, still emit the image into the kustomization entry (use orig_image as the
image reference or a sensible fallback) and log the warning but do not use
continue; update the code paths that write into kustomization.${arch}.yaml so
they handle unmapped images (referencing variables release_tag, orig_image and
component_dir) and ensure the resulting kustomization.${arch}.yaml always
includes an image entry for every manifest image.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/auto-rebase/rebase.sh`:
- Around line 1169-1176: The script assumes jq successfully finds a pullspec;
validate that the jq result is non-empty before writing files: after computing
release_tag and new_image (from the jq command that selects .from.name), check
if new_image is empty (or if new_digest parsed from new_image is empty), and if
so emit a clear error mentioning the release_tag and json_key and exit with a
non-zero status instead of writing component_release_json; apply the same guard
to the other identical block (the one that mirrors lines ~1196-1204) so
malformed release-*.json / kustomization.*.yaml are never created when the
payload tag is missing.

---

Duplicate comments:
In `@scripts/auto-rebase/rebase.sh`:
- Around line 1191-1193: The current block in rebase.sh that checks if [[ -z
"${release_tag}" ]] and then echoes a warning and continues causes partial
kustomization.${arch}.yaml output when an image (orig_image) isn't in the
mapping; instead, stop skipping: when release_tag is empty, still emit the image
into the kustomization entry (use orig_image as the image reference or a
sensible fallback) and log the warning but do not use continue; update the code
paths that write into kustomization.${arch}.yaml so they handle unmapped images
(referencing variables release_tag, orig_image and component_dir) and ensure the
resulting kustomization.${arch}.yaml always includes an image entry for every
manifest image.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 33a078aa-483a-4842-a2dd-2d3d185e3f96

📥 Commits

Reviewing files that changed from the base of the PR and between 82550e8 and 4aa1099.

⛔ Files ignored due to path filters (3)
  • etcd/vendor/github.com/openshift/microshift/pkg/config/config.go is excluded by !**/vendor/**
  • etcd/vendor/github.com/openshift/microshift/pkg/config/dns.go is excluded by !**/vendor/**
  • etcd/vendor/github.com/openshift/microshift/pkg/util/cryptomaterial/certinfo.go is excluded by !**/vendor/**
📒 Files selected for processing (27)
  • assets/optional/metrics-server/00-namespace.yaml
  • assets/optional/metrics-server/01-cluster-role-binding-auth-delegator.yaml
  • assets/optional/metrics-server/01-cluster-role-binding.yaml
  • assets/optional/metrics-server/01-cluster-role.yaml
  • assets/optional/metrics-server/01-role-binding-auth-reader.yaml
  • assets/optional/metrics-server/01-service-account.yaml
  • assets/optional/metrics-server/02-configmap-audit-profiles.yaml
  • assets/optional/metrics-server/03-deployment.yaml
  • assets/optional/metrics-server/04-api-service.yaml
  • assets/optional/metrics-server/04-service.yaml
  • assets/optional/metrics-server/kustomization.aarch64.yaml
  • assets/optional/metrics-server/kustomization.x86_64.yaml
  • assets/optional/metrics-server/kustomization.yaml
  • assets/optional/metrics-server/release-metrics-server-aarch64.json
  • assets/optional/metrics-server/release-metrics-server-x86_64.json
  • packaging/observability/microshift-observability.service
  • packaging/observability/otelcol.d/microshift-metrics-server.yaml
  • packaging/rpm/microshift.spec
  • pkg/cmd/init.go
  • pkg/cmd/metrics.go
  • pkg/cmd/run.go
  • pkg/healthcheck/microshift_optional_workloads.go
  • pkg/util/cryptomaterial/certinfo.go
  • scripts/auto-rebase/assets.yaml
  • scripts/auto-rebase/assets_metrics.yaml
  • scripts/auto-rebase/rebase.sh
  • test/bin/common.sh
✅ Files skipped from review due to trivial changes (4)
  • packaging/observability/microshift-observability.service
  • assets/optional/metrics-server/kustomization.yaml
  • assets/optional/metrics-server/kustomization.aarch64.yaml
  • test/bin/common.sh
🚧 Files skipped from review as they are similar to previous changes (20)
  • assets/optional/metrics-server/release-metrics-server-aarch64.json
  • assets/optional/metrics-server/01-service-account.yaml
  • pkg/healthcheck/microshift_optional_workloads.go
  • assets/optional/metrics-server/01-cluster-role.yaml
  • assets/optional/metrics-server/04-api-service.yaml
  • assets/optional/metrics-server/00-namespace.yaml
  • assets/optional/metrics-server/01-cluster-role-binding.yaml
  • assets/optional/metrics-server/02-configmap-audit-profiles.yaml
  • assets/optional/metrics-server/04-service.yaml
  • pkg/cmd/run.go
  • assets/optional/metrics-server/03-deployment.yaml
  • packaging/observability/otelcol.d/microshift-metrics-server.yaml
  • scripts/auto-rebase/assets_metrics.yaml
  • assets/optional/metrics-server/kustomization.x86_64.yaml
  • pkg/cmd/init.go
  • scripts/auto-rebase/assets.yaml
  • packaging/rpm/microshift.spec
  • assets/optional/metrics-server/01-role-binding-auth-reader.yaml
  • pkg/cmd/metrics.go
  • assets/optional/metrics-server/01-cluster-role-binding-auth-delegator.yaml

Comment thread scripts/auto-rebase/rebase.sh
@copejon

copejon commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@copejon copejon force-pushed the ushift-6951/metrics-server branch from f70198d to 0a515ed Compare June 5, 2026 18:33
@copejon

copejon commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 8, 2026
Comment thread test/assets/observability/otel_config.yaml
@copejon

copejon commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@CodeRabbit help

@copejon copejon force-pushed the ushift-6951/metrics-server branch from f204ce6 to 9893ecd Compare June 9, 2026 22:21
@copejon

copejon commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-tests-bootc-periodic-arm-el10

@copejon copejon force-pushed the ushift-6951/metrics-server branch from 9893ecd to 01cda48 Compare June 11, 2026 05:26
@coderabbitai coderabbitai Bot removed the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 11, 2026

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
pkg/healthcheck/microshift_optional_workloads.go (1)

48-56: ⚡ Quick win

Consider defensive slice allocation to avoid backing-array aliasing.

The current implementation appends directly to existing slices, which may modify shared backing arrays if capacity exists. While correct in current usage, pre-allocating with exact capacity prevents potential aliasing bugs if code changes in the future.

♻️ Suggested defensive implementation
 func mergeWorkloads(existing, incoming NamespaceWorkloads) NamespaceWorkloads {
+	deployments := make([]string, 0, len(existing.Deployments)+len(incoming.Deployments))
+	deployments = append(deployments, existing.Deployments...)
+	deployments = append(deployments, incoming.Deployments...)
+
+	daemonSets := make([]string, 0, len(existing.DaemonSets)+len(incoming.DaemonSets))
+	daemonSets = append(daemonSets, existing.DaemonSets...)
+	daemonSets = append(daemonSets, incoming.DaemonSets...)
+
+	statefulSets := make([]string, 0, len(existing.StatefulSets)+len(incoming.StatefulSets))
+	statefulSets = append(statefulSets, existing.StatefulSets...)
+	statefulSets = append(statefulSets, incoming.StatefulSets...)
+
 	return NamespaceWorkloads{
-		Deployments:  append(existing.Deployments, incoming.Deployments...),
-		DaemonSets:   append(existing.DaemonSets, incoming.DaemonSets...),
-		StatefulSets: append(existing.StatefulSets, incoming.StatefulSets...),
+		Deployments:  deployments,
+		DaemonSets:   daemonSets,
+		StatefulSets: statefulSets,
 	}
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/healthcheck/microshift_optional_workloads.go` around lines 48 - 56,
mergeWorkloads currently appends incoming slices onto existing slices which can
mutate shared backing arrays; change it to allocate new slices with capacity
equal to len(existing)+len(incoming) for each field (Deployments, DaemonSets,
StatefulSets), copy the existing items into the new slice, then append or copy
the incoming items, and return the new NamespaceWorkloads so no original backing
arrays are aliased or modified.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/healthcheck/microshift_optional_workloads.go`:
- Around line 48-56: mergeWorkloads currently appends incoming slices onto
existing slices which can mutate shared backing arrays; change it to allocate
new slices with capacity equal to len(existing)+len(incoming) for each field
(Deployments, DaemonSets, StatefulSets), copy the existing items into the new
slice, then append or copy the incoming items, and return the new
NamespaceWorkloads so no original backing arrays are aliased or modified.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 1281c4a3-137b-4007-bc64-0b8c9b0cab4d

📥 Commits

Reviewing files that changed from the base of the PR and between aa9354d and 01cda48.

⛔ Files ignored due to path filters (1)
  • etcd/vendor/github.com/openshift/microshift/pkg/util/cryptomaterial/certinfo.go is excluded by !**/vendor/**
📒 Files selected for processing (28)
  • assets/optional/metrics-server/00-namespace.yaml
  • assets/optional/metrics-server/01-cluster-role-binding-auth-delegator.yaml
  • assets/optional/metrics-server/01-cluster-role-binding.yaml
  • assets/optional/metrics-server/01-cluster-role.yaml
  • assets/optional/metrics-server/01-role-binding-auth-reader.yaml
  • assets/optional/metrics-server/01-service-account.yaml
  • assets/optional/metrics-server/02-configmap-audit-profiles.yaml
  • assets/optional/metrics-server/03-deployment.yaml
  • assets/optional/metrics-server/04-api-service.yaml
  • assets/optional/metrics-server/04-service.yaml
  • assets/optional/metrics-server/kustomization.aarch64.yaml
  • assets/optional/metrics-server/kustomization.x86_64.yaml
  • assets/optional/metrics-server/kustomization.yaml
  • assets/optional/metrics-server/release-metrics-server-aarch64.json
  • assets/optional/metrics-server/release-metrics-server-x86_64.json
  • packaging/observability/microshift-observability.service
  • packaging/observability/otelcol.d/microshift-metrics-server.yaml
  • packaging/rpm/microshift.spec
  • pkg/cmd/init.go
  • pkg/cmd/metrics.go
  • pkg/cmd/run.go
  • pkg/healthcheck/microshift_optional_workloads.go
  • pkg/util/cryptomaterial/certinfo.go
  • scripts/auto-rebase/assets.yaml
  • scripts/auto-rebase/assets_metrics.yaml
  • scripts/auto-rebase/rebase.sh
  • test/assets/observability/otel_config.yaml
  • test/bin/common.sh
✅ Files skipped from review due to trivial changes (2)
  • assets/optional/metrics-server/release-metrics-server-x86_64.json
  • assets/optional/metrics-server/release-metrics-server-aarch64.json
🚧 Files skipped from review as they are similar to previous changes (23)
  • pkg/util/cryptomaterial/certinfo.go
  • assets/optional/metrics-server/kustomization.yaml
  • assets/optional/metrics-server/00-namespace.yaml
  • assets/optional/metrics-server/01-cluster-role.yaml
  • assets/optional/metrics-server/01-service-account.yaml
  • packaging/observability/otelcol.d/microshift-metrics-server.yaml
  • scripts/auto-rebase/assets.yaml
  • assets/optional/metrics-server/04-service.yaml
  • assets/optional/metrics-server/01-cluster-role-binding.yaml
  • assets/optional/metrics-server/kustomization.aarch64.yaml
  • assets/optional/metrics-server/kustomization.x86_64.yaml
  • packaging/observability/microshift-observability.service
  • test/bin/common.sh
  • assets/optional/metrics-server/02-configmap-audit-profiles.yaml
  • pkg/cmd/init.go
  • assets/optional/metrics-server/03-deployment.yaml
  • assets/optional/metrics-server/04-api-service.yaml
  • packaging/rpm/microshift.spec
  • pkg/cmd/run.go
  • scripts/auto-rebase/assets_metrics.yaml
  • pkg/cmd/metrics.go
  • assets/optional/metrics-server/01-role-binding-auth-reader.yaml
  • scripts/auto-rebase/rebase.sh

@agullon

agullon commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

I reviewed the 3 PRs and they look good to me. But at least some basic RF tests are missing.

@agullon

agullon commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

/retest

Comment thread pkg/cmd/metrics.go Outdated
if err != nil {
return fmt.Errorf("creating clientset: %w", err)
}
const ns = "openshift-monitoring"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why ns is here, but metricsServerManifestPath outside the function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

both constants are now package-level in a grouped const block, matching the convention in certificateauthority.go.

copejon@2c6da6f

Comment thread pkg/cmd/metrics.go Outdated

const metricsServerManifestPath = "/usr/lib/microshift/manifests.d/080-microshift-metrics-server"

func provisionMetricsServerCerts(ctx context.Context, cfg *config.Config) error {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks like it might make a good generic function to create secrets with certs from the disk. Not big deal, just metrics.go seems a bit too specific to be in cmd/. So far I think it's mostly individual commands in each file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've moved metrics.go to pkg/components and exported provisionMetricsServerCerts, which is now called in pkg/cmd/run.go. Of the 3 metrics components, metrics-server is special in that it requires a kubelet client cert in order to get cluster resource data. Hence the need to generate that cert just before applying the component's manifests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread pkg/cmd/run.go Outdated
// Provision certs for optional components after kustomize creates their namespaces.
go func() {
defer func() {
if r := recover(); r != nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we expect a panic here or is this just very defensive coding?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Defensive, and overkill. Nothing the func can panic. Removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread scripts/auto-rebase/assets.yaml Outdated
- file: service.yaml
- file: serviceaccount.yaml

- dir: optional/metrics-server/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we have assets_metrics.yaml, then I don't think we should have this entry in this file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the duplicate block — assets_metrics.yaml is the sole tracker. copejon@d61c8be

copejon and others added 6 commits June 11, 2026 11:14
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add otlp exporter stub to the observability test config so that
metrics drop-in configs (which define pipelines exporting to otlp)
don't crash otelcol when the test replaces the production config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Strip JSON-style quoted keys from the embedded audit policy
documents to match the repo's YAML conventions. Values remain
quoted. No functional change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Jonathan H. Cope <jcope@redhat.com>
@copejon copejon force-pushed the ushift-6951/metrics-server branch from 01cda48 to 0f5a0f3 Compare June 11, 2026 16:14
@coderabbitai coderabbitai Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 11, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packaging/observability/microshift-observability.service`:
- Line 11: The ExecStart line currently builds a space-joined ARGS string and
then expands it unquoted (variable ARGS) which risks word-splitting/pathname
expansion; change the inline shell to build a bash array (e.g.,
ARGS=("--config=file:/etc/microshift/observability/opentelemetry-collector.yaml")
and append with ARGS+=("--config=file:$f") inside the loop) and finally exec
/usr/bin/opentelemetry-collector "$${ARGS[@]}" to preserve argument boundaries;
update references to ARGS in the ExecStart command accordingly.

In `@scripts/auto-rebase/assets_metrics.yaml`:
- Around line 66-88: The assets_metrics.yaml entry for dir
"optional/kube-state-metrics/" is missing the generated release JSON entries;
update the files list under that dir (near the existing
kustomization.aarch64.yaml / kustomization.x86_64.yaml entries) to add entries
for release-kube-state-metrics-aarch64.json and
release-kube-state-metrics-x86_64.json with ignore: "Provided by MicroShift" so
the rebase.sh generated release files are recognized.
- Around line 39-64: The node-exporter asset block is missing the generated
release JSON entries; update the assets_metrics.yaml node-exporter files list
(near the kustomization.aarch64.yaml and kustomization.x86_64.yaml entries) to
include two new file entries: release-node-exporter-aarch64.json and
release-node-exporter-x86_64.json, each with ignore: "Provided by MicroShift",
so the generated release JSONs are tracked the same way metrics-server does.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 0e9aa2e0-c0af-4de9-ab7b-b053620becdc

📥 Commits

Reviewing files that changed from the base of the PR and between 01cda48 and 0f5a0f3.

⛔ Files ignored due to path filters (1)
  • etcd/vendor/github.com/openshift/microshift/pkg/util/cryptomaterial/certinfo.go is excluded by !**/vendor/**
📒 Files selected for processing (28)
  • assets/optional/metrics-server/00-namespace.yaml
  • assets/optional/metrics-server/01-cluster-role-binding-auth-delegator.yaml
  • assets/optional/metrics-server/01-cluster-role-binding.yaml
  • assets/optional/metrics-server/01-cluster-role.yaml
  • assets/optional/metrics-server/01-role-binding-auth-reader.yaml
  • assets/optional/metrics-server/01-service-account.yaml
  • assets/optional/metrics-server/02-configmap-audit-profiles.yaml
  • assets/optional/metrics-server/03-deployment.yaml
  • assets/optional/metrics-server/04-api-service.yaml
  • assets/optional/metrics-server/04-service.yaml
  • assets/optional/metrics-server/kustomization.aarch64.yaml
  • assets/optional/metrics-server/kustomization.x86_64.yaml
  • assets/optional/metrics-server/kustomization.yaml
  • assets/optional/metrics-server/release-metrics-server-aarch64.json
  • assets/optional/metrics-server/release-metrics-server-x86_64.json
  • packaging/observability/microshift-observability.service
  • packaging/observability/otelcol.d/microshift-metrics-server.yaml
  • packaging/rpm/microshift.spec
  • pkg/cmd/init.go
  • pkg/cmd/metrics.go
  • pkg/cmd/run.go
  • pkg/healthcheck/microshift_optional_workloads.go
  • pkg/util/cryptomaterial/certinfo.go
  • scripts/auto-rebase/assets.yaml
  • scripts/auto-rebase/assets_metrics.yaml
  • scripts/auto-rebase/rebase.sh
  • test/assets/observability/otel_config.yaml
  • test/bin/common.sh
✅ Files skipped from review due to trivial changes (4)
  • assets/optional/metrics-server/01-service-account.yaml
  • assets/optional/metrics-server/release-metrics-server-x86_64.json
  • assets/optional/metrics-server/release-metrics-server-aarch64.json
  • assets/optional/metrics-server/00-namespace.yaml
🚧 Files skipped from review as they are similar to previous changes (20)
  • test/assets/observability/otel_config.yaml
  • assets/optional/metrics-server/kustomization.x86_64.yaml
  • assets/optional/metrics-server/01-cluster-role-binding-auth-delegator.yaml
  • pkg/healthcheck/microshift_optional_workloads.go
  • assets/optional/metrics-server/01-cluster-role-binding.yaml
  • packaging/observability/otelcol.d/microshift-metrics-server.yaml
  • test/bin/common.sh
  • assets/optional/metrics-server/04-service.yaml
  • assets/optional/metrics-server/kustomization.yaml
  • assets/optional/metrics-server/01-cluster-role.yaml
  • assets/optional/metrics-server/04-api-service.yaml
  • assets/optional/metrics-server/01-role-binding-auth-reader.yaml
  • pkg/cmd/run.go
  • assets/optional/metrics-server/02-configmap-audit-profiles.yaml
  • pkg/cmd/metrics.go
  • pkg/cmd/init.go
  • assets/optional/metrics-server/03-deployment.yaml
  • scripts/auto-rebase/assets.yaml
  • packaging/rpm/microshift.spec
  • scripts/auto-rebase/rebase.sh

Comment thread packaging/observability/microshift-observability.service Outdated
Comment thread scripts/auto-rebase/assets_metrics.yaml
Comment thread scripts/auto-rebase/assets_metrics.yaml
@copejon

copejon commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

2 unrelated flakes resulted in failures

/test e2e-aws-tests
/test e2e-aws-tests-bootc-periodic-el9

…ntries

Use a bash array for otelcol config arguments to prevent word-splitting,
and add generated release JSON entries for node-exporter and
kube-state-metrics in assets_metrics.yaml to match metrics-server.

Signed-off-by: Jonathan H. Cope <jcope@redhat.com>
@coderabbitai coderabbitai Bot removed the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 11, 2026
copejon added 2 commits June 12, 2026 11:10
…er fit for ./pkg/components/. components.ProvisionMetricsServerCerts must still be called from ./pkg/cmd/run.go because the metrics-server needs its client tls certs on host prior to deploying the component
@coderabbitai coderabbitai Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 12, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/components/metrics.go`:
- Around line 82-85: When handling AlreadyExists for the
metrics-server-client-certs Secret and kubelet-serving-ca-bundle ConfigMap in
pkg/components/metrics.go, preserve metadata.resourceVersion before calling
Update: fetch the existing Secret/ConfigMap (or inspect the returned error to
Get the current object), copy its ObjectMeta.ResourceVersion into the
secret.ObjectMeta.ResourceVersion / configMap.ObjectMeta.ResourceVersion, then
call clientset.CoreV1().Secrets(...).Update(...) or
clientset.CoreV1().ConfigMaps(...).Update(...). This ensures Kubernetes accepts
the Update and TLS material can rotate/reconcile.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 47f8b340-9498-4acf-9808-35a8ab10d668

📥 Commits

Reviewing files that changed from the base of the PR and between 41d2ad8 and d61c8be.

📒 Files selected for processing (2)
  • pkg/cmd/run.go
  • pkg/components/metrics.go

Comment thread pkg/components/metrics.go
Comment on lines +82 to +85
_, err = clientset.CoreV1().Secrets(metricsServerNamespace).Create(ctx, secret, metav1.CreateOptions{})
if apierrors.IsAlreadyExists(err) {
_, err = clientset.CoreV1().Secrets(metricsServerNamespace).Update(ctx, secret, metav1.UpdateOptions{})
}

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.

⚠️ Potential issue | 🟠 Major

Preserve resourceVersion on Secret/ConfigMap Update so TLS material can reconcile
In pkg/components/metrics.go, the AlreadyExists path for the metrics-server-client-certs Secret (around 82-85) and the kubelet-serving-ca-bundle ConfigMap (around 107-110) calls Update with objects that omit metadata.resourceVersion; Kubernetes Update requires it, so rotation won’t apply after the first creation (even though these are mounted by assets/optional/metrics-server/03-deployment.yaml).

Suggested fix
-	_, err = clientset.CoreV1().Secrets(metricsServerNamespace).Create(ctx, secret, metav1.CreateOptions{})
-	if apierrors.IsAlreadyExists(err) {
-		_, err = clientset.CoreV1().Secrets(metricsServerNamespace).Update(ctx, secret, metav1.UpdateOptions{})
-	}
+	_, err = clientset.CoreV1().Secrets(metricsServerNamespace).Create(ctx, secret, metav1.CreateOptions{})
+	if apierrors.IsAlreadyExists(err) {
+		existing, getErr := clientset.CoreV1().Secrets(metricsServerNamespace).Get(ctx, secret.Name, metav1.GetOptions{})
+		if getErr != nil {
+			return fmt.Errorf("getting existing metrics-server client cert secret: %w", getErr)
+		}
+		secret.ResourceVersion = existing.ResourceVersion
+		_, err = clientset.CoreV1().Secrets(metricsServerNamespace).Update(ctx, secret, metav1.UpdateOptions{})
+	}
 	if err != nil {
 		return fmt.Errorf("applying metrics-server client cert secret: %w", err)
 	}
@@
-	_, err = clientset.CoreV1().ConfigMaps(metricsServerNamespace).Create(ctx, cm, metav1.CreateOptions{})
-	if apierrors.IsAlreadyExists(err) {
-		_, err = clientset.CoreV1().ConfigMaps(metricsServerNamespace).Update(ctx, cm, metav1.UpdateOptions{})
-	}
+	_, err = clientset.CoreV1().ConfigMaps(metricsServerNamespace).Create(ctx, cm, metav1.CreateOptions{})
+	if apierrors.IsAlreadyExists(err) {
+		existing, getErr := clientset.CoreV1().ConfigMaps(metricsServerNamespace).Get(ctx, cm.Name, metav1.GetOptions{})
+		if getErr != nil {
+			return fmt.Errorf("getting existing kubelet serving CA configmap: %w", getErr)
+		}
+		cm.ResourceVersion = existing.ResourceVersion
+		_, err = clientset.CoreV1().ConfigMaps(metricsServerNamespace).Update(ctx, cm, metav1.UpdateOptions{})
+	}
 	if err != nil {
 		return fmt.Errorf("applying kubelet serving CA configmap: %w", err)
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
_, err = clientset.CoreV1().Secrets(metricsServerNamespace).Create(ctx, secret, metav1.CreateOptions{})
if apierrors.IsAlreadyExists(err) {
_, err = clientset.CoreV1().Secrets(metricsServerNamespace).Update(ctx, secret, metav1.UpdateOptions{})
}
_, err = clientset.CoreV1().Secrets(metricsServerNamespace).Create(ctx, secret, metav1.CreateOptions{})
if apierrors.IsAlreadyExists(err) {
existing, getErr := clientset.CoreV1().Secrets(metricsServerNamespace).Get(ctx, secret.Name, metav1.GetOptions{})
if getErr != nil {
return fmt.Errorf("getting existing metrics-server client cert secret: %w", getErr)
}
secret.ResourceVersion = existing.ResourceVersion
_, err = clientset.CoreV1().Secrets(metricsServerNamespace).Update(ctx, secret, metav1.UpdateOptions{})
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/components/metrics.go` around lines 82 - 85, When handling AlreadyExists
for the metrics-server-client-certs Secret and kubelet-serving-ca-bundle
ConfigMap in pkg/components/metrics.go, preserve metadata.resourceVersion before
calling Update: fetch the existing Secret/ConfigMap (or inspect the returned
error to Get the current object), copy its ObjectMeta.ResourceVersion into the
secret.ObjectMeta.ResourceVersion / configMap.ObjectMeta.ResourceVersion, then
call clientset.CoreV1().Secrets(...).Update(...) or
clientset.CoreV1().ConfigMaps(...).Update(...). This ensures Kubernetes accepts
the Update and TLS material can rotate/reconcile.

@copejon

copejon commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Ah, need to re-rebase. Handling that now

@openshift openshift deleted a comment from coderabbitai Bot Jun 12, 2026
@openshift-ci

openshift-ci Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@copejon: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/verify d61c8be link true /test verify
ci/prow/e2e-aws-tests-bootc-el10 d61c8be link true /test e2e-aws-tests-bootc-el10
ci/prow/test-rebase d61c8be link false /test test-rebase
ci/prow/e2e-aws-tests-bootc-periodic-el10 d61c8be link true /test e2e-aws-tests-bootc-periodic-el10

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants