You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Invalid user-owned cloud.google.com/load-balancer-resource-labels annotations currently cause HCCO's aggregate resource reconciliation to fail, even though HCCO cannot safely repair them.
Validate existing native annotations before reconciling labels. If invalid, leave the Service unchanged, log a warning identifying the Service and a content-free validation reason, and continue processing other eligible Services. Preserve list, patch, and other label reconciliation errors.
Add regression coverage for malformed annotations, invalid label keys, duplicate keys, warning details, unchanged Service data, and continued reconciliation of valid Services. Document the behavior and regenerate aggregate docs.
The annotation rename and upstream CCM integration are intentionally out of scope.
HCCO's normal periodic reconciliation remains unchanged; invalid annotations no longer cause an error-driven retry.
No API, ignition, MachineConfig, or NodePool config-hash changes.
Commits are separated into shared parser implementation/tests (HO), CPO implementation/tests, and documentation per repository layout rules.
Validation passed:
GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go test -race ./control-plane-operator/hostedclusterconfigoperator/controllers/resources ./support/gcputil
GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go vet ./control-plane-operator/hostedclusterconfigoperator/controllers/resources ./support/gcputil
GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor hack/tools/bin/golangci-lint run --new-from-rev=upstream/main ./control-plane-operator/hostedclusterconfigoperator/controllers/resources/...
Configured pre-commit hooks on all four changed files; applicable checks passed, YAML/API import checks skipped because no matching files changed.
make test-changed PULL_BASE_SHA=upstream/main
make docs-aggregate and make verify-docs-nav
Commit-message gitlint, make verify-commit-layout BASE=upstream/main, formatting, and git diff --check.
New regression cases fail against the unchanged upstream implementation.
Full-repository verification/test suites and cluster/E2E validation were not run. The working tree was clean after committing.
Implementation, tests, documentation, and PR description were AI-assisted using GPT-6.1 via Codex in T3 Code; changes and validation were inspected by the assistant and require human review.
Checklist:
Subject and description added to both, commit and PR.
Relevant issues have been referenced.
This change includes docs.
This change includes unit tests.
Always review AI generated responses prior to use.
AI-assisted response via openshift-developer plugin
Summary by CodeRabbit
Bug Fixes
Services with malformed or invalid GCP resource-label annotations are left unchanged. A warning identifies the Service and gives a brief validation reason without exposing annotation contents.
Reconciliation continues for other Services instead of failing because of an invalid label annotation. Failures to list or update Services, and invalid managed-annotation metadata, remain reconciliation errors.
Documentation
Updated the GCP platform guide to describe warning events for invalid label annotations and how to view them with oc describe.
Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all
@gbarabasz: This pull request references GCP-1405 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 bug to target the "5.1.0" version, but no target version was set.
Invalid user-owned cloud.google.com/load-balancer-resource-labels annotations currently cause HCCO's aggregate resource reconciliation to fail, even though HCCO cannot safely repair them.
Validate existing native annotations before reconciling labels. If invalid, leave the Service unchanged, log a warning identifying the Service and validation failure, and continue processing other eligible Services. Preserve list, patch, and other label reconciliation errors.
Add regression coverage for malformed annotations, invalid label keys, duplicate keys, warning details, unchanged Service data, and continued reconciliation of valid Services. Document the behavior and regenerate aggregate docs.
The annotation rename and upstream CCM integration are intentionally out of scope.
HCCO's normal periodic reconciliation remains unchanged; invalid annotations no longer cause an error-driven retry.
No API, ignition, MachineConfig, or NodePool config-hash changes.
Commits are separated into CPO implementation/tests and documentation per repository layout rules.
Validation passed:
GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go test -race ./control-plane-operator/hostedclusterconfigoperator/controllers/resources ./support/gcputil
GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go vet ./control-plane-operator/hostedclusterconfigoperator/controllers/resources ./support/gcputil
GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor hack/tools/bin/golangci-lint run --new-from-rev=upstream/main ./control-plane-operator/hostedclusterconfigoperator/controllers/resources/...
Configured pre-commit hooks on all four changed files; applicable checks passed, YAML/API import checks skipped because no matching files changed.
make test-changed PULL_BASE_SHA=upstream/main
make docs-aggregate and make verify-docs-nav
Commit-message gitlint, make verify-commit-layout BASE=upstream/main, formatting, and git diff --check.
New regression cases fail against the unchanged upstream implementation.
Full-repository verification/test suites and cluster/E2E validation were not run. The working tree was clean after committing.
Implementation, tests, documentation, and PR description were AI-assisted using GPT-6.1 via Codex in T3 Code; changes and validation were inspected by the assistant and require human review.
Checklist:
Subject and description added to both, commit and PR.
Relevant issues have been referenced.
This change includes docs.
This change includes unit tests.
Always review AI generated responses prior to use.
AI-assisted response via openshift-developer plugin
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.
No actionable comments were generated in the recent review.
Walkthrough
The parser now returns typed validation errors with safe reasons for invalid native resource-label annotations. Before reconciling labels, the controller parses each selected Service’s annotation. If parsing fails, it logs a warning, emits a warning event when a recorder is configured, and skips that Service without adding an error to the aggregate result. Tests cover invalid annotations, valid Services, and managed-annotation metadata errors. The documentation describes this behavior and retains Service list and patch failures as reconciliation errors.
Sequence Diagram(s)
sequenceDiagram
participant Reconciler
participant Parser
participant EventRecorder
Reconciler->>Parser: Validate Service annotation
Parser-->>Reconciler: Return validation error and safe reason
Reconciler->>EventRecorder: Emit warning event when configured
Reconciler->>Reconciler: Log warning and skip invalid Service
Loading
Merge Risk: Minimal · up to 83b9b · assessed changes only
Path filters excluded changed files. This rating applies only to the assessed changes.
Pre-merge checks: 11
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the GCP-1405 Jira key and the change: handling invalid LoadBalancer resource-label annotations. The raw summary and objectives confirm that invalid cloud.google.com/load-balancer-resou…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names
The check applies to Ginkgo test titles (It, Describe, Context, When and similar). The changed test files do not use Ginkgo. Both gcp_lb_service_annotations_test.go and lb_resource_labels_test.go …
Test Structure And Quality
The "Test Structure and Quality" check applies to Ginkgo test code. It asks for Ginkgo-specific items such as g.It blocks, BeforeEach/AfterEach setup, and ote.Informing() marking. The PR chang…
Topology-Aware Scheduling Compatibility
The check applies to changes in deployment manifests, operator code, or controllers. This PR modifies HCCO controller code, so the check applies. The changed files are the GCP LoadBalancer Service ann…
Ipv6 And Disconnected Network Test Compatibility
This check applies only when the PR adds new Ginkgo e2e tests (It, Describe, Context, When). The PR changes seven files: the HCCO LB annotation reconciler and its unit tests (`gcp_lb_service_annotatio…
No-Weak-Crypto
The no-weak-crypto check is not triggered by this pull request. I listed the seven changed files from the review range and searched all added lines for MD5, SHA1/SHA-1, DES, 3DES, RC4, Blowfish, ECB, …
Container-Privileges
The container-privileges check does not apply to this pull request. The PR changes seven files: four Go files in the HCCO resources package and gcputil, the GCP platform doc, and the aggregated docs. …
No-Sensitive-Data-In-Logs
The PR adds one new log statement and one new Warning Event on the invalid-annotation path. Neither includes annotation contents. - gcp_lb_service_annotations.go line 54 logs `klog.Warningf("Skippin…
Full details: Title check
Explanation
The title names the GCP-1405 Jira key and the change: handling invalid LoadBalancer resource-label annotations. The raw summary and objectives confirm that invalid cloud.google.com/load-balancer-resource-labels annotations are now validated, skipped with a warning and a Warning Event, and do not fail aggregate reconciliation. The title covers the main change, though it does not mention the warning or event behavior.
Full details: Stable And Deterministic Test Names
Explanation
The check applies to Ginkgo test titles (It, Describe, Context, When and similar). The changed test files do not use Ginkgo. Both gcp_lb_service_annotations_test.go and lb_resource_labels_test.go are standard Go testing tests. They use t.Run with static string names, and the CPO test file does not import onsi/ginkgo. The check is therefore inapplicable to this PR. For comparison, the new test names are static. They contain no pod names, timestamps, UUIDs, node names, namespaces, IP addresses, or legacy Author:/platform/Polarion metadata tokens. The names use the descriptive "When ..., it should ..." form, and the dynamic values stay in the test bodies, such as the annotation input and the expected reason.
Full details: Test Structure And Quality
Explanation
The "Test Structure and Quality" check applies to Ginkgo test code. It asks for Ginkgo-specific items such as g.It blocks, BeforeEach/AfterEach setup, and ote.Informing() marking. The PR changes seven files. Two of them are test files: control-plane-operator/hostedclusterconfigoperator/controllers/resources/gcp_lb_service_annotations_test.go and support/gcputil/lb_resource_labels_test.go. Both use the standard Go testing package with top-level func Test...(t *testing.T) functions and t.Run subtests. They use Gomega only as an assertion library, with no Ginkgo Describe, It, or BeforeEach blocks. No new It() block exists, so the informing recommendation does not apply. The check is not applicable to this PR, so it passes. The PR's test quality is outside the scope of this custom check.
Full details: Topology-Aware Scheduling Compatibility
Explanation
The check applies to changes in deployment manifests, operator code, or controllers. This PR modifies HCCO controller code, so the check applies. The changed files are the GCP LoadBalancer Service annotation reconciler, its tests, the gcputil parser and its tests, the docs, and resources.go. resources.go only adds an event recorder to the reconciler, which is initialized from the manager. I searched the full added diff for scheduling-related terms: affinity, anti-affinity, topologySpread, nodeSelector, tolerations, PodDisruptionBudget, maxUnavailable, maxSurge, replicas, node-role, control-plane, master, worker, arbiter, ControlPlaneTopology, and taint. The only matches were diff file headers. No added code creates or changes pod scheduling constraints, replica counts, PDBs, or node targeting. The change therefore does not introduce any failure condition in this check.
Full details: Ipv6 And Disconnected Network Test Compatibility
Explanation
This check applies only when the PR adds new Ginkgo e2e tests (It, Describe, Context, When). The PR changes seven files: the HCCO LB annotation reconciler and its unit tests (gcp_lb_service_annotations.go and _test.go), resources.go, support/gcputil/gcputil.go and its test, docs/content/how-to/gcp-platform.md, and the aggregated docs. None of them are e2e test files, and none sit under test/. The diff contains no Ginkgo g.It(, g.Describe(, g.Context(, or g.When( blocks. The only "Context(" matches are Go t.Context() calls in standard testing unit tests. The check is therefore not applicable, and it passes.
Full details: No-Weak-Crypto
Explanation
The no-weak-crypto check is not triggered by this pull request. I listed the seven changed files from the review range and searched all added lines for MD5, SHA1/SHA-1, DES, 3DES, RC4, Blowfish, ECB, HMAC, cipher, encrypt/decrypt, random, hash, secret, token, and password terms. No matches. The code changes in gcp_lb_service_annotations.go and support/gcputil/gcputil.go add error typing, a warning log, a warning event, and a skip path for invalid cloud.google.com/load-balancer-resource-labels annotations. They do not add or change any cryptographic primitive, custom crypto, or secret or token comparison. The remaining changes are tests, docs, and the event recorder wiring in resources.go.
Full details: Container-Privileges
Explanation
The container-privileges check does not apply to this pull request. The PR changes seven files: four Go files in the HCCO resources package and gcputil, the GCP platform doc, and the aggregated docs. None of these is a container or Kubernetes manifest. A search of the full review diff for privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, allowPrivilegeEscalation, runAsUser, securityContext, and capabilities returned no matches. The Go changes validate the cloud.google.com/load-balancer-resource-labels annotation on Services and do not add or change any pod or container spec. No failure condition in the check is met.
Full details: No-Sensitive-Data-In-Logs
Explanation
The PR adds one new log statement and one new Warning Event on the invalid-annotation path. Neither includes annotation contents. - gcp_lb_service_annotations.go line 54 logs klog.Warningf("Skipping GCP resource label reconciliation for Service %s/%s: %s", service.Namespace, service.Name, reason). The reason value comes from LBResourceLabelsValidationError.Reason or a fixed fallback string. It is not the raw annotation value. - The Warning Event (lines 55–58) uses reason InvalidGCPResourceLabels. Its message contains the reason and the annotation name (gcputil.LBResourceLabelsAnnotation), not the value. - In support/gcputil/gcputil.go, each Reason is a constant string: "too many labels", "expected key=value format", "invalid label key or value", "duplicate label key". The detailed error messages, which can include the pair text or key, are not passed to any new log or event. They only remain on the error chain. - The Service namespace and name are Kubernetes object identifiers. They are not credentials, PII, or customer data. The docs state that the log and Event exclude annotation contents. Other errors (list, patch, and managed-key reconcile errors) keep their existing behavior. Those errors are returned, not newly logged, and this PR does not change what they contain. The diff adds no logging of tokens, passwords, or other sensitive values.
Warning
Some tools did not complete. Review the errors below.
golangci-lint (2.15.0)
golangci-lint (2.15.0) skipped for .golangci.yml: configuration contains disallowed or uninspectable plugin or linter settings. Use supported built-in linters.
Files skipped from review as they are similar to previous changes: 1
docs/content/how-to/gcp-platform.md
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.91%. Comparing base (0f43b29) to head (d015a8c). ⚠️ Report is 15 commits behind head on main.
⚠️Current head d015a8c differs from pull request most recent head 83b9b3a
Please upload reports for the commit 83b9b3a to get more accurate results.
Reason: The change is in HCCO's GCP LoadBalancer Service annotation reconciler. When a guest Service has a malformed or invalid cloud.google.com/load-balancer-resource-labels annotation, HCCO now logs a warning and skips that Service instead of returning an aggregate reconcile error. This is a runtime behaviour change in a shipped controller, so it is not Low. It is Moderate rather than Critical because it is a fix confined to a path that already fails. On main, ReconcileLBResourceLabelAnnotations already calls ParseLBResourceLabelsAnnotation first and returns its error. The new pre-check calls that same validator, so Services with valid annotations take exactly the same path as before. Services with invalid annotations were never patched before and still are not. Errors from invalid managed-key metadata, list and patch still surface, as the tests confirm. A plausible defect would leave labels unreconciled on a Service, or hide an error that used to trigger a retry. It would not touch Service data paths, node pools, config hashes or APIs. The other files are unit tests and docs. Signals: 4 files, +78/-13, no API or CRD changes, full diff read.
Change it with @redhat-chai-bot /risk-tier <low|moderate|critical>: anyone can raise the tier; lowering it needs two OWNERS approvers and lasts until the next push.
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.
Reason: This changes how HCCO reconciles GCP LoadBalancer Service annotations at runtime. If a guest Service has a malformed or invalid cloud.google.com/load-balancer-resource-labels annotation, HCCO now logs a warning with a safe reason and skips that Service. Before, it returned an aggregate reconcile error that caused a retry. Because a shipped controller behaves differently, this is not Low. It is Moderate rather than Critical because the fix is confined to a path that already fails. On main, ReconcileLBResourceLabelAnnotations already calls ParseLBResourceLabelsAnnotation first and returns its error. The new pre-check calls the same validator, so Services with valid annotations follow exactly the same path. Services with invalid annotations were not patched before and still are not. In support/gcputil, the parser's errors are now wrapped in LBResourceLabelsValidationError. That type embeds the original error, so its Error() text does not change. A search of the base branch found no callers of the parser other than the reconcile function and the new pre-check. Errors from invalid managed-key metadata, from listing Services and from patching them still surface. A plausible defect would leave labels unreconciled on a Service, or hide an error that used to trigger a retry. It would not reach Service data paths, NodePools, config hashes or APIs. The remaining files are unit tests and docs. Signals: 6 files, +121/-17, no API or CRD changes, full diff read.
Change it with @redhat-chai-bot /risk-tier <low|moderate|critical>: anyone can raise the tier; lowering it needs two OWNERS approvers and lasts until the next push.
…tations
Leave invalid native Service annotations unchanged and warn instead of
failing aggregate HCCO reconciliation. Continue processing other Services
while retaining operational and other label reconciliation errors.
Log the Service identity and safe validation reason without raw annotation
content. Emit a Warning Event on the affected guest Service so its owner
can identify and correct the annotation without management-cluster access.
Test annotation preservation, safe warning and Event contents, absence of
Events for valid Services, and continued reconciliation.
Refs: GCP-1405
Assisted-by: LLM
Signed-off-by: Grzegorz (Greg) Barabasz <gbarabas@redhat.com>
Document that invalid native annotations are preserved and skipped with a
content-free warning while other Services continue reconciling. Explain
how users can inspect the Warning Event on the affected guest Service.
Clarify that list and patch failures remain errors, and regenerate
aggregate documentation.
Refs: GCP-1405
Assisted-by: LLM
Signed-off-by: Grzegorz (Greg) Barabasz <gbarabas@redhat.com>
This pull-request has been approved by: patjlm Once this PR has been reviewed and has the lgtm label, please assign devguyio for approval. For more information see the Code Review Process.
The full list of commands accepted by this bot can be found here.
Details
Needs approval from an approver in each of these files:
Reason: This head changes how HCCO reconciles GCP LoadBalancer Service annotations at runtime. Before, a malformed or invalid cloud.google.com/load-balancer-resource-labels annotation on a guest Service produced an aggregate reconcile error and a retry. Now HCCO logs a warning with a safe reason, skips that Service and continues with the others. New in this head: the HCCO resources reconciler gets an event recorder from opts.Manager.GetEventRecorderFor, and HCCO records an InvalidGCPResourceLabels Warning Event on the affected guest Service. A search of the base branch found no event recorder in HCCO before this change, so emitting these events is new HCCO behaviour. The rubric names emitting a Kubernetes event as Moderate. A failure to record an event does not block the reconcile. The rest is a fix confined to a path that already fails. The pre-check calls the same parser that ReconcileLBResourceLabelAnnotations already calls first, so Services with valid annotations take an unchanged path. Services with invalid annotations were not patched before and still are not. The parser's errors are now wrapped in LBResourceLabelsValidationError, which embeds the original error, so their Error() text does not change. Errors from listing Services, patching them and invalid managed-key metadata still surface. A plausible defect would leave labels unreconciled, hide a retry, or produce extra or failed events. It would not reach NodePool config hashes, ignition, APIs or Service data paths, so this is not Critical. Signals: 7 files, +150/-18, no API or CRD changes, full diff read; tests and docs are Low.
Change it with @redhat-chai-bot /risk-tier <low|moderate|critical>: anyone can raise the tier; lowering it needs two OWNERS approvers and lasts until the next push.
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
area/control-plane-operatorIndicates the PR includes changes for the control plane operator - in an OCP releasearea/documentationIndicates the PR includes changes for documentationarea/hypershift-operatorIndicates the PR includes changes for the hypershift operator and API - outside an OCP releasearea/platform/gcpPR/issue for GCP (GCPPlatform) platformchai-risk-assessment/moderateChai risk assessment of the latest commit: moderate (may change product behaviour).jira/valid-referenceIndicates that this PR references a valid Jira ticket of any type.lgtmIndicates that a PR is ready to be merged.
4 participants
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.
What this PR does / why we need it:
Invalid user-owned
cloud.google.com/load-balancer-resource-labelsannotations currently cause HCCO's aggregate resource reconciliation to fail, even though HCCO cannot safely repair them.Validate existing native annotations before reconciling labels. If invalid, leave the Service unchanged, log a warning identifying the Service and a content-free validation reason, and continue processing other eligible Services. Preserve list, patch, and other label reconciliation errors.
Add regression coverage for malformed annotations, invalid label keys, duplicate keys, warning details, unchanged Service data, and continued reconciliation of valid Services. Document the behavior and regenerate aggregate docs.
Which issue(s) this PR fixes:
Fixes GCP-1405.
Special notes for your reviewer:
Validation passed:
GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go test -race ./control-plane-operator/hostedclusterconfigoperator/controllers/resources ./support/gcputilGO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go vet ./control-plane-operator/hostedclusterconfigoperator/controllers/resources ./support/gcputilGO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor hack/tools/bin/golangci-lint run --new-from-rev=upstream/main ./control-plane-operator/hostedclusterconfigoperator/controllers/resources/...make test-changed PULL_BASE_SHA=upstream/mainmake docs-aggregateandmake verify-docs-navmake verify-commit-layout BASE=upstream/main, formatting, andgit diff --check.Full-repository verification/test suites and cluster/E2E validation were not run. The working tree was clean after committing.
Implementation, tests, documentation, and PR description were AI-assisted using GPT-6.1 via Codex in T3 Code; changes and validation were inspected by the assistant and require human review.
Checklist:
Always review AI generated responses prior to use.
AI-assisted response via openshift-developer plugin
Summary by CodeRabbit
Bug Fixes
Documentation
oc describe.