Skip to content

CNTRLPLANE-2049: fix(api): audit and improve GCP API validation rules - #8003

Merged
openshift-merge-bot[bot] merged 5 commits into
openshift:mainfrom
cblecker:fix/gcp-api-linter-violations
Mar 20, 2026
Merged

CNTRLPLANE-2049: fix(api): audit and improve GCP API validation rules#8003
openshift-merge-bot[bot] merged 5 commits into
openshift:mainfrom
cblecker:fix/gcp-api-linter-violations

Conversation

@cblecker

@cblecker cblecker commented Mar 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Introduce GCPResourceName type alias for RFC 1035 resource names, consolidating repeated MinLength/MaxLength/XValidation markers across 5 fields (GCPResourceReference.Name, GCPNodePoolPlatform.Subnet, GCPNodePoolPlatform.NetworkTags, GCPPrivateServiceConnectSpec.ForwardingRuleName, GCPPrivateServiceConnectSpec.NATSubnet)
  • Fix region validation error message to use concrete examples instead of confusing geographic-area-location-number template
  • Fix serviceAttachmentURI region regex segment to be consistent with standalone region validation ([a-z]+-[a-z]+[0-9]+)
  • Remove unnecessary capturing groups from project/pool/provider regexes
  • Widen consumerAcceptList project number range from {6,12} to {1,30}

Compatibility

All changes are backward compatible:

  • GCPResourceName serializes identically to string in JSON (N-1/N+1 safe)
  • Regex changes are cosmetic or strictly more permissive
  • Type alias follows the existing GCPServiceAccountEmail pattern

Test plan

  • make update succeeds (CRDs, deepcopy, clients, apply configs regenerated)
  • make verify passes (staticcheck, go fmt, go vet all clean)
  • make test passes (all unit tests with race detection)
  • Verify CRD validation behavior in e2e tests

Summary by CodeRabbit

  • Refactor

    • Improved type safety for GCP resource identifiers and service account emails across the platform.
    • Simplified handling of machine image, boot disk, and maintenance options to use direct values.
  • Bug Fixes

    • Made several GCP configuration fields optional/omit-zero and standardized validations for more robust input handling.
    • Ensured consistent string conversions for network, subnet, and related fields to avoid mismatches.
  • Tests

    • Updated tests to match new typed fields and validation semantics.

cblecker and others added 3 commits March 18, 2026 11:56
- Replace Pattern markers with XValidation (CEL) for better error messages
- Add omitempty/omitzero to required fields per KAL conventions
- Create GCPServiceAccountEmail type alias for reusable validation
- Fix GCPResourceLabel.Value validation to match GCP documentation
- Drop unnecessary pointers where MinLength prevents zero values
- Add listType markers for Server-Side Apply compatibility
- Add MinLength, MinItems validation markers where applicable
- Remove 21 stale linter exclusions, add exclusions for intentional pointer usage
- Use +default instead of +kubebuilder:default
- Remove patchStrategy/patchMergeKey from CRD Conditions
- Replace complex IPv4/IPv6 regex with self.isIP() CEL function

Co-authored-by: Nirshal <37444255+Nirshal@users.noreply.github.com>
Assisted-by: Claude:claude-opus-4-6
- Add MinItems=1 to optional list fields (ResourceLabels, NetworkTags, Scopes)
  per JoelSpeed review: if list is optional with omitempty, MinItems=1 ensures
  empty arrays are not persisted
- Set GCPServiceAccountEmail MaxLength=85 (theoretical max: 30-char name +
  @ + 30-char project + .iam.gserviceaccount.com) per JoelSpeed recommendation
- Fix GCPResourceLabel.Value regex to require non-empty values start with a
  lowercase letter per GCP Compute Engine documentation

Assisted-by: Claude:claude-opus-4-6
Introduce GCPResourceName type alias for RFC 1035 resource names to DRY
out repeated validation markers across 5 fields. Fix several validation
inaccuracies found by cross-referencing GCP documentation:

- Fix region error message to use concrete examples instead of confusing
  template notation
- Fix serviceAttachmentURI region regex to be consistent with standalone
  region validation
- Remove unnecessary capturing groups from project/pool/provider regexes
- Widen consumerAcceptList project number range from {6,12} to {1,30}

All changes are backward compatible: GCPResourceName serializes
identically to string in JSON, regex changes are cosmetic or strictly
more permissive, and the type alias follows the existing
GCPServiceAccountEmail pattern.

Assisted-by: Claude:claude-opus-4-6
@openshift-ci-robot

Copy link
Copy Markdown

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 18, 2026
@openshift-ci

openshift-ci Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

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

@coderabbitai

coderabbitai Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This pull request replaces several generic GCP-related string fields with specialized types (GCPResourceName, GCPServiceAccountEmail) across the API, CLI, controllers, and tests; adjusts JSON tags to use omitempty/omitzero for many fields; replaces many Pattern validations with XValidation rules and updated validation messages; adds and tightens collection and scalar validations (e.g., MinItems, lengths); converts code that consumed the old string/pointer types to explicitly cast or use the new types; and removes a set of GCP-specific exclusions from api/.golangci.yml.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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

@openshift-ci openshift-ci Bot added do-not-merge/needs-area area/api Indicates the PR includes changes for the API area/cli Indicates the PR includes changes for CLI area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/documentation Indicates the PR includes changes for documentation area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release area/platform/gcp PR/issue for GCP (GCPPlatform) platform and removed do-not-merge/needs-area labels Mar 18, 2026
@cblecker

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@cblecker
cblecker marked this pull request as ready for review March 19, 2026 00:19
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 19, 2026
@cblecker cblecker changed the title fix(api): audit and improve GCP API validation rules CNTRLPLANE-2049: fix(api): audit and improve GCP API validation rules Mar 19, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 19, 2026
@openshift-ci-robot

openshift-ci-robot commented Mar 19, 2026

Copy link
Copy Markdown

@cblecker: This pull request references CNTRLPLANE-2049 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 task to target either version "4.22." or "openshift-4.22.", but it targets "openshift-4.21" instead.

Details

In response to this:

Summary

  • Introduce GCPResourceName type alias for RFC 1035 resource names, consolidating repeated MinLength/MaxLength/XValidation markers across 5 fields (GCPResourceReference.Name, GCPNodePoolPlatform.Subnet, GCPNodePoolPlatform.NetworkTags, GCPPrivateServiceConnectSpec.ForwardingRuleName, GCPPrivateServiceConnectSpec.NATSubnet)
  • Fix region validation error message to use concrete examples instead of confusing geographic-area-location-number template
  • Fix serviceAttachmentURI region regex segment to be consistent with standalone region validation ([a-z]+-[a-z]+[0-9]+)
  • Remove unnecessary capturing groups from project/pool/provider regexes
  • Widen consumerAcceptList project number range from {6,12} to {1,30}

Compatibility

All changes are backward compatible:

  • GCPResourceName serializes identically to string in JSON (N-1/N+1 safe)
  • Regex changes are cosmetic or strictly more permissive
  • Type alias follows the existing GCPServiceAccountEmail pattern

Test plan

  • make update succeeds (CRDs, deepcopy, clients, apply configs regenerated)
  • make verify passes (staticcheck, go fmt, go vet all clean)
  • make test passes (all unit tests with race detection)
  • Verify CRD validation behavior in e2e tests

Summary by CodeRabbit

Release Notes

  • Refactor

  • Enhanced GCP platform configuration with improved type safety for resource identifiers and service account emails.

  • Migrated field validations to provide clearer, more explicit error messages.

  • Bug Fixes

  • Made several GCP configuration fields optional to improve cluster deployment flexibility.

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.

@openshift-ci
openshift-ci Bot requested review from csrwng and enxebre March 19, 2026 00:20
@cblecker

Copy link
Copy Markdown
Member Author

/cc @Nirshal @JoelSpeed
/uncc csrwng enxebre

@openshift-ci
openshift-ci Bot requested review from JoelSpeed and Nirshal and removed request for csrwng and enxebre March 19, 2026 00:20
@openshift-ci-robot

openshift-ci-robot commented Mar 19, 2026

Copy link
Copy Markdown

@cblecker: This pull request references CNTRLPLANE-2049 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 task to target either version "4.22." or "openshift-4.22.", but it targets "openshift-4.21" instead.

Details

In response to this:

Summary

  • Introduce GCPResourceName type alias for RFC 1035 resource names, consolidating repeated MinLength/MaxLength/XValidation markers across 5 fields (GCPResourceReference.Name, GCPNodePoolPlatform.Subnet, GCPNodePoolPlatform.NetworkTags, GCPPrivateServiceConnectSpec.ForwardingRuleName, GCPPrivateServiceConnectSpec.NATSubnet)
  • Fix region validation error message to use concrete examples instead of confusing geographic-area-location-number template
  • Fix serviceAttachmentURI region regex segment to be consistent with standalone region validation ([a-z]+-[a-z]+[0-9]+)
  • Remove unnecessary capturing groups from project/pool/provider regexes
  • Widen consumerAcceptList project number range from {6,12} to {1,30}

Compatibility

All changes are backward compatible:

  • GCPResourceName serializes identically to string in JSON (N-1/N+1 safe)
  • Regex changes are cosmetic or strictly more permissive
  • Type alias follows the existing GCPServiceAccountEmail pattern

Test plan

  • make update succeeds (CRDs, deepcopy, clients, apply configs regenerated)
  • make verify passes (staticcheck, go fmt, go vet all clean)
  • make test passes (all unit tests with race detection)
  • Verify CRD validation behavior in e2e tests

Summary by CodeRabbit

  • Refactor

  • Improved type safety for GCP resource identifiers and service account emails across the platform.

  • Strengthened and standardized validation rules with clearer error messages.

  • Bug Fixes

  • Made several GCP configuration fields optional/omit-zero to improve deployment flexibility and input handling.

  • Adjusted behaviors to ensure consistent string handling for network, subnet, and related fields.

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 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 the current code and only fix it if needed.

Inline comments:
In `@api/hypershift/v1beta1/gcpprivateserviceconnect_types.go`:
- Around line 122-125: The EndpointIP field's XValidation allows an explicit
empty string but the struct tag includes +kubebuilder:validation:MinLength=3
which will reject "" before XValidation runs; to fix, decide the intended
behavior and apply one of two changes: if explicit empty string should be
permitted, remove the +kubebuilder:validation:MinLength=3 tag (keep EndpointIP
string `json:"endpointIP,omitempty"` and the XValidation/isIP check), or if
empty string should be forbidden, change the XValidation rule to remove `self ==
''` so MinLength=3 enforces non-empty; update the EndpointIP field accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 42bb2059-f8b1-42fc-bc3a-c970e1375cb7

📥 Commits

Reviewing files that changed from the base of the PR and between 335a2ee and a6fd718.

⛔ Files ignored due to path filters (19)
  • api/hypershift/v1beta1/zz_generated.deepcopy.go is excluded by !**/zz_generated*.go
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/gcpprivateserviceconnects.hypershift.openshift.io/GCPPlatform.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/GCPPlatform.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/GCPPlatform.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • client/applyconfiguration/hypershift/v1beta1/gcpnodepoolplatform.go is excluded by !client/**
  • cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/gcpprivateserviceconnects-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/gcpprivateserviceconnects-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • docs/content/reference/aggregated-docs.md is excluded by !docs/content/reference/aggregated-docs.md
  • docs/content/reference/api.md is excluded by !docs/content/reference/api.md
  • vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/gcp.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/gcpprivateserviceconnect_types.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/zz_generated.deepcopy.go is excluded by !vendor/**, !**/vendor/**, !**/zz_generated*.go
📒 Files selected for processing (5)
  • api/.golangci.yml
  • api/hypershift/v1beta1/gcp.go
  • api/hypershift/v1beta1/gcpprivateserviceconnect_types.go
  • hypershift-operator/controllers/nodepool/gcp.go
  • hypershift-operator/controllers/nodepool/gcp_test.go
💤 Files with no reviewable changes (1)
  • api/.golangci.yml
✅ Files skipped from review due to trivial changes (1)
  • hypershift-operator/controllers/nodepool/gcp_test.go

Comment thread api/hypershift/v1beta1/gcpprivateserviceconnect_types.go Outdated
Remove `self == '' ||` from endpointIP XValidation and restore
MinLength=3. The field has omitempty so absent values skip validation
entirely — no need to allow explicit empty string in the CEL rule.

Assisted-by: Claude:claude-opus-4-6
@openshift-ci-robot

openshift-ci-robot commented Mar 19, 2026

Copy link
Copy Markdown

@cblecker: This pull request references CNTRLPLANE-2049 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 task to target either version "4.22." or "openshift-4.22.", but it targets "openshift-4.21" instead.

Details

In response to this:

Summary

  • Introduce GCPResourceName type alias for RFC 1035 resource names, consolidating repeated MinLength/MaxLength/XValidation markers across 5 fields (GCPResourceReference.Name, GCPNodePoolPlatform.Subnet, GCPNodePoolPlatform.NetworkTags, GCPPrivateServiceConnectSpec.ForwardingRuleName, GCPPrivateServiceConnectSpec.NATSubnet)
  • Fix region validation error message to use concrete examples instead of confusing geographic-area-location-number template
  • Fix serviceAttachmentURI region regex segment to be consistent with standalone region validation ([a-z]+-[a-z]+[0-9]+)
  • Remove unnecessary capturing groups from project/pool/provider regexes
  • Widen consumerAcceptList project number range from {6,12} to {1,30}

Compatibility

All changes are backward compatible:

  • GCPResourceName serializes identically to string in JSON (N-1/N+1 safe)
  • Regex changes are cosmetic or strictly more permissive
  • Type alias follows the existing GCPServiceAccountEmail pattern

Test plan

  • make update succeeds (CRDs, deepcopy, clients, apply configs regenerated)
  • make verify passes (staticcheck, go fmt, go vet all clean)
  • make test passes (all unit tests with race detection)
  • Verify CRD validation behavior in e2e tests

Summary by CodeRabbit

  • Refactor

  • Improved type safety for GCP resource identifiers and service account emails across the platform.

  • Simplified handling of machine image, boot disk, and maintenance options to use direct values.

  • Bug Fixes

  • Made several GCP configuration fields optional/omit-zero and standardized validations for more robust input handling.

  • Ensured consistent string conversions for network, subnet, and related fields to avoid mismatches.

  • Tests

  • Updated tests to match new typed fields and validation semantics.

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 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 (4)
api/hypershift/v1beta1/gcpprivateserviceconnect_types.go (4)

40-54: Documentation marker inconsistency.

The Name field has +required (line 42) but the JSON tag uses omitempty. This creates ambiguity: the documentation indicates the field is required, but serialization allows omission. Consider aligning these by either removing omitempty or changing to +optional with validation constraints.

The Records field with MinItems=1 and +optional is correctly designed—ensures non-empty when provided.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/hypershift/v1beta1/gcpprivateserviceconnect_types.go` around lines 40 -
54, The DNSZoneStatus struct has a mismatch: the Name field is marked +required
but the JSON tag uses omitempty, so update DNSZoneStatus by making the Name
field required in serialization (remove omitempty from the json tag for Name) so
it reads json:"name" while keeping the kubebuilder validation markers on Name;
leave the Records field and its +optional/MinItems markers unchanged.

72-83: Same stale +required marker on ConsumerAcceptList; validation regex looks correct.

Line 76 still has +required but the JSON tag was changed to omitempty. The regex correctly validates both project IDs (6-30 char format) and project numbers (1-30 digits, widened as intended).

📝 Suggested fix
 	// See https://cloud.google.com/resource-manager/docs/creating-managing-projects for project ID and number formats.
-	// +required
+	// +optional
 	// +listType=set
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/hypershift/v1beta1/gcpprivateserviceconnect_types.go` around lines 72 -
83, The struct field ConsumerAcceptList has a stale +required marker but its
JSON tag is `omitempty`; remove the `+required` kubebuilder marker (or
alternatively remove `omitempty` if you intend the field to be required) so the
annotations and tag are consistent; update the annotations next to
ConsumerAcceptList to either delete `+required` or make the json tag
non-omitempty and ensure MinItems/MaxItems remain correct.

61-65: Stale +required marker on LoadBalancerIP.

The AI summary indicates this field was intentionally changed from required to optional, but the +required marker on line 61 remains. The comment on lines 58-60 also states it's "Populated by the observer," which suggests it shouldn't be required at creation time.

📝 Suggested fix
 	// loadBalancerIP is the IP address of the Internal Load Balancer
 	// Populated by the observer from service status
 	// This value must be a valid IPv4 or IPv6 address.
-	// +required
+	// +optional
 	// +kubebuilder:validation:XValidation:rule="isIP(self)",message="loadBalancerIP must be a valid IPv4 or IPv6 address"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/hypershift/v1beta1/gcpprivateserviceconnect_types.go` around lines 61 -
65, The field annotation for LoadBalancerIP is stale: remove the "+required"
kubebuilder marker (or replace it with "+optional") so the LoadBalancerIP string
field is truly optional as intended; update the comment/markers around the
LoadBalancerIP declaration in the LoadBalancerIP struct field (the
LoadBalancerIP string `json:"loadBalancerIP,omitempty"`) to reflect it is
populated by the observer and not required at creation time.

98-98: MinItems=1 on optional status collections.

Conditions (line 98) and DNSZones (line 129) are +optional but have MinItems=1. This means:

  • Omitting the field: ✓ valid
  • Providing []: ✗ fails MinItems
  • Providing non-empty list: ✓ valid

For status fields that are populated asynchronously, ensure controllers don't set empty arrays. This is likely fine since status validation is typically lenient, but worth noting.

Also applies to: 129-129

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/hypershift/v1beta1/gcpprivateserviceconnect_types.go` at line 98, The
status slice fields Conditions and DNSZones currently have
+kubebuilder:validation:MinItems=1 while also marked +optional, which rejects
empty arrays; either remove the MinItems=1 constraint from those fields
(Conditions and DNSZones in gcpprivateserviceconnect_types.go) so empty slices
are allowed, or make the fields required and document that controllers must
never write an empty slice—pick the former for typical async status fields and
update the kubebuilder markers accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@api/hypershift/v1beta1/gcpprivateserviceconnect_types.go`:
- Around line 40-54: The DNSZoneStatus struct has a mismatch: the Name field is
marked +required but the JSON tag uses omitempty, so update DNSZoneStatus by
making the Name field required in serialization (remove omitempty from the json
tag for Name) so it reads json:"name" while keeping the kubebuilder validation
markers on Name; leave the Records field and its +optional/MinItems markers
unchanged.
- Around line 72-83: The struct field ConsumerAcceptList has a stale +required
marker but its JSON tag is `omitempty`; remove the `+required` kubebuilder
marker (or alternatively remove `omitempty` if you intend the field to be
required) so the annotations and tag are consistent; update the annotations next
to ConsumerAcceptList to either delete `+required` or make the json tag
non-omitempty and ensure MinItems/MaxItems remain correct.
- Around line 61-65: The field annotation for LoadBalancerIP is stale: remove
the "+required" kubebuilder marker (or replace it with "+optional") so the
LoadBalancerIP string field is truly optional as intended; update the
comment/markers around the LoadBalancerIP declaration in the LoadBalancerIP
struct field (the LoadBalancerIP string `json:"loadBalancerIP,omitempty"`) to
reflect it is populated by the observer and not required at creation time.
- Line 98: The status slice fields Conditions and DNSZones currently have
+kubebuilder:validation:MinItems=1 while also marked +optional, which rejects
empty arrays; either remove the MinItems=1 constraint from those fields
(Conditions and DNSZones in gcpprivateserviceconnect_types.go) so empty slices
are allowed, or make the fields required and document that controllers must
never write an empty slice—pick the former for typical async status fields and
update the kubebuilder markers accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 2035c117-b5a1-4b81-965a-f63a002d0b30

📥 Commits

Reviewing files that changed from the base of the PR and between a6fd718 and e7b0d49.

⛔ Files ignored due to path filters (4)
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/gcpprivateserviceconnects.hypershift.openshift.io/GCPPlatform.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/gcpprivateserviceconnects-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/gcpprivateserviceconnects-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/gcpprivateserviceconnect_types.go is excluded by !vendor/**, !**/vendor/**
📒 Files selected for processing (1)
  • api/hypershift/v1beta1/gcpprivateserviceconnect_types.go

@cblecker

Copy link
Copy Markdown
Member Author

GKE test failing until #7965 merges

@JoelSpeed JoelSpeed 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.

/lgtm
/approve

Will need a HyperShift approver for the non-api parts

CC @enxebre

// +optional
// +kubebuilder:default="pd-balanced"
// +default="pd-balanced"
// +kubebuilder:validation:Enum=pd-standard;pd-ssd;pd-balanced

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.

Before we ship, would be good to make sure Enum values are consistently PascalCase to align with K8s API conventions

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.

We'll want this API to pass the linter clean before promoting it.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Mar 20, 2026
@openshift-ci-robot

Copy link
Copy Markdown

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks-4-21
/test e2e-aws-4-21
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws

x-kubernetes-validations:
- message: loadBalancerIP must be a valid IPv4 or IPv6 address
rule: self.matches('^((\\d{1,3}\\.){3}\\d{1,3})$') || self.matches('^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$')
rule: isIP(self)

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.

we'll want to address #8016 before removing the gate for this API

@enxebre

enxebre commented Mar 20, 2026

Copy link
Copy Markdown
Member

/approve

@openshift-ci

openshift-ci Bot commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cblecker, enxebre, JoelSpeed

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 Mar 20, 2026
@cwbotbot

cwbotbot commented Mar 20, 2026

Copy link
Copy Markdown

Test Results

e2e-aws

e2e-aks

@cblecker

Copy link
Copy Markdown
Member Author

/retest

1 similar comment
@cblecker

Copy link
Copy Markdown
Member Author

/retest

@cblecker

Copy link
Copy Markdown
Member Author

/skip

@cblecker

Copy link
Copy Markdown
Member Author

/verified by e2e @cblecker

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 20, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@cblecker: This PR has been marked as verified by e2e @cblecker.

Details

In response to this:

/verified by e2e @cblecker

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.

@openshift-ci

openshift-ci Bot commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

@cblecker: The following test 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/e2e-gke e7b0d49 link false /test e2e-gke

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.

@openshift-merge-bot
openshift-merge-bot Bot merged commit a84a3f8 into openshift:main Mar 20, 2026
27 checks passed
@cblecker
cblecker deleted the fix/gcp-api-linter-violations branch March 20, 2026 23:11
cristianoveiga added a commit to cristianoveiga/hypershift that referenced this pull request Mar 23, 2026
Update expected error substrings in TestOnCreateAPIUX to match the new
XValidation rule messages introduced in PR openshift#8003. The old expectations
used Pattern-style messages ("in body should match") which were replaced
by custom XValidation messages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cristianoveiga added a commit to cristianoveiga/hypershift that referenced this pull request Mar 23, 2026
Update expected error substrings in TestOnCreateAPIUX to match the new
XValidation rule messages introduced in PR openshift#8003. The old expectations
used Pattern-style messages ("in body should match") which were replaced
by custom XValidation messages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cristianoveiga added a commit to cristianoveiga/hypershift that referenced this pull request Mar 24, 2026
Update expected error substrings in the v2 e2e test suite
(api_ux_validation_test.go) to match the new XValidation rule messages
introduced in PR openshift#8003, same as the v1 e2e test fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mehabhalodiya pushed a commit to mehabhalodiya/hypershift that referenced this pull request Apr 13, 2026
Update expected error substrings in TestOnCreateAPIUX to match the new
XValidation rule messages introduced in PR openshift#8003. The old expectations
used Pattern-style messages ("in body should match") which were replaced
by custom XValidation messages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mehabhalodiya pushed a commit to mehabhalodiya/hypershift that referenced this pull request Apr 13, 2026
Update expected error substrings in the v2 e2e test suite
(api_ux_validation_test.go) to match the new XValidation rule messages
introduced in PR openshift#8003, same as the v1 e2e test fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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. area/api Indicates the PR includes changes for the API area/cli Indicates the PR includes changes for CLI area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/documentation Indicates the PR includes changes for documentation area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release area/platform/gcp PR/issue for GCP (GCPPlatform) platform jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants