Skip to content

Use regex instead of format help for KMS secret name validation - #2966

Open
JoelSpeed wants to merge 3 commits into
openshift:masterfrom
JoelSpeed:fix-kms-secret-name-cel
Open

Use regex instead of format help for KMS secret name validation#2966
JoelSpeed wants to merge 3 commits into
openshift:masterfrom
JoelSpeed:fix-kms-secret-name-cel

Conversation

@JoelSpeed

Copy link
Copy Markdown
Contributor

The current validation using the format library is breaking HyperShift integration testing, this will be functionally equivalent but not rely on the library which came later

CC @ardaguclu

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Hello @JoelSpeed! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@openshift-ci openshift-ci Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 31, 2026
@qodo-for-rh-openshift

Copy link
Copy Markdown

PR Summary by Qodo

Replace CEL format-based DNS1123 validation with regex for KMS/Vault refs

🐞 Bug fix ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Replace CEL format.dns1123Subdomain() validation with portable regex matching.
• Fix HyperShift integration failures caused by unavailable CEL format library.
• Regenerate CRD manifests so published schemas match the new validation rule.
Diagram

graph TD
  A["KMSEncryption API types"] --> B["Kubebuilder XValidation"] --> C["Generated CRDs (config)"] --> D["Payload CRDs"] --> E["API server CEL"] --> F["Resource admission"]
  subgraph Legend
    direction LR
    _code["Source code"] ~~~ _cfg["Manifest"] ~~~ _svc(["Runtime validation"])
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Require CEL format library availability
  • ➕ Keeps intent aligned with higher-level DNS1123 helper
  • ➕ Avoids maintaining a custom regex
  • ➖ Breaks older API servers/HyperShift environments lacking the format library
  • ➖ Couples validation to specific CEL feature availability
2. Use OpenAPI `pattern` instead of XValidation
  • ➕ Shifts validation to widely supported OpenAPI schema keywords
  • ➕ Avoids CEL feature/version dependencies
  • ➖ May not express identical constraints depending on tooling/CRD generation path
  • ➖ Requires reworking existing XValidation usage and regeneration expectations

Recommendation: Keep the regex-based self.matches(...) XValidation. It avoids dependency on newer CEL format helpers (the reported breakage) while preserving equivalent DNS1123 subdomain constraints, and it cleanly propagates through regenerated CRDs.

Files changed (8) +24 / -24

Bug fix (1) +3 / -3
types_kmsencryption.goSwap DNS1123 CEL format validation to regex for Vault reference fields +3/-3

Swap DNS1123 CEL format validation to regex for Vault reference fields

• Replaces 'format.dns1123Subdomain().validate(self)' XValidation rules with a portable 'self.matches(...)' regex for Vault secret name, configmap name, and TLS serverName fields. This preserves the DNS1123-like constraint without relying on the CEL format library.

config/v1/types_kmsencryption.go

Other (7) +21 / -21
0000_10_config-operator_01_apiservers-CustomNoUpgrade.crd.yamlRegenerate CustomNoUpgrade apiservers CRD with regex-based CEL rules +3/-3

Regenerate CustomNoUpgrade apiservers CRD with regex-based CEL rules

• Updates the CRD schema rule strings to use 'self.matches(...)' instead of 'format.dns1123Subdomain()' for affected fields, matching the updated kubebuilder markers.

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_apiservers-CustomNoUpgrade.crd.yaml

0000_10_config-operator_01_apiservers-DevPreviewNoUpgrade.crd.yamlRegenerate DevPreviewNoUpgrade apiservers CRD with regex-based CEL rules +3/-3

Regenerate DevPreviewNoUpgrade apiservers CRD with regex-based CEL rules

• Updates the generated CEL rule expressions to regex matching to avoid the CEL format helper dependency.

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_apiservers-DevPreviewNoUpgrade.crd.yaml

0000_10_config-operator_01_apiservers-TechPreviewNoUpgrade.crd.yamlRegenerate TechPreviewNoUpgrade apiservers CRD with regex-based CEL rules +3/-3

Regenerate TechPreviewNoUpgrade apiservers CRD with regex-based CEL rules

• Replaces format-based DNS1123 validation rules with regex-based 'self.matches(...)' in the generated schema.

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_apiservers-TechPreviewNoUpgrade.crd.yaml

KMSEncryption.yamlUpdate featuregated KMSEncryption CRD to use regex-based CEL validation +3/-3

Update featuregated KMSEncryption CRD to use regex-based CEL validation

• Aligns the featuregated KMSEncryption CRD manifest with the new regex-based XValidation rules to ensure consistent validation across feature gates.

config/v1/zz_generated.featuregated-crd-manifests/apiservers.config.openshift.io/KMSEncryption.yaml

0000_10_config-operator_01_apiservers-CustomNoUpgrade.crd.yamlUpdate payload CustomNoUpgrade CRD with regex-based CEL rules +3/-3

Update payload CustomNoUpgrade CRD with regex-based CEL rules

• Propagates the regex-based CEL validation rules into the payload CRD so clusters enforce the portable rule at runtime.

payload-manifests/crds/0000_10_config-operator_01_apiservers-CustomNoUpgrade.crd.yaml

0000_10_config-operator_01_apiservers-DevPreviewNoUpgrade.crd.yamlUpdate payload DevPreviewNoUpgrade CRD with regex-based CEL rules +3/-3

Update payload DevPreviewNoUpgrade CRD with regex-based CEL rules

• Updates the payload CRD schema rule strings to the regex-based form for compatibility with environments lacking the format library.

payload-manifests/crds/0000_10_config-operator_01_apiservers-DevPreviewNoUpgrade.crd.yaml

0000_10_config-operator_01_apiservers-TechPreviewNoUpgrade.crd.yamlUpdate payload TechPreviewNoUpgrade CRD with regex-based CEL rules +3/-3

Update payload TechPreviewNoUpgrade CRD with regex-based CEL rules

• Ensures the TechPreview payload CRD uses 'self.matches(...)' for DNS1123-like validation consistent with the API types.

payload-manifests/crds/0000_10_config-operator_01_apiservers-TechPreviewNoUpgrade.crd.yaml

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This change replaces CEL format-based validation with explicit regular expressions and length checks. It updates DNS validation for KMS, API server, and Authentication fields. It also updates ingress label-value and label-key validation and adjusts the related test error.

Suggested reviewers: deads2k, everettraven, leo6leo

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title describes replacing format library validation with regex for KMS secret name validation, but the changeset actually addresses multiple validation types across KMS, DNS, Ingress, and Authentication — not only KMS secret names. Revise the title to reflect the broader scope: replace 'KMS secret name validation' with 'validation rules' or list the specific validation categories affected.
✅ Passed checks (14 passed)
Check name Status Explanation
Description check ✅ Passed The description mentions KMS secret name validation and HyperShift integration testing, which relate to the stated PR objectives of replacing format library validation with regex equivalents.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 All Ginkgo test names in the modified test file (IngressComponentRouteLabels.yaml) are static and deterministic. The 17 test names contain no dynamic values like UUIDs, timestamps, pod names, names...
Test Structure And Quality ✅ Passed The pull request changes only Go type definitions and generated CRD YAML; no Ginkgo test files, It blocks, or cluster operations were added or modified.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests are added. The PR modifies validation rules and CRD schemas, not e2e test cases. The IngressComponentRouteLabels.yaml file is a declarative CRD validation test, not a Ginkgo...
Single Node Openshift (Sno) Test Compatibility ✅ Passed The patch changes validation declarations and generated CRDs only; no test files or added Ginkgo declarations were found, so the SNO compatibility check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed The diff changes only Go validation annotations and CustomResourceDefinition CEL rules; it adds no deployments, controllers, replicas, affinities, topology constraints, selectors, tolerations, or P...
Ote Binary Stdout Contract ✅ Passed PR modifies only Go struct validation tags and YAML test/manifest files—no process-level code, imports, or stdout-writing patterns detected. Changes are purely declarative/structural validation upd...
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR does not add new Ginkgo e2e tests. It modifies API type definitions and CRD validation rules, and a test expectations YAML file only. The check does not apply.
No-Weak-Crypto ✅ Passed PR modifies only validation rules in configuration types and CRDs, replacing format library calls with regex validation. No weak cryptographic algorithms, custom crypto implementations, or insecure...
Container-Privileges ✅ Passed The PR modifies validation rules in OpenAPI schemas and Go type definitions. No container privilege configurations (privileged mode, hostPID, hostNetwork, hostIPC, SYS_ADMIN, allowPrivilegeEscalati...
No-Sensitive-Data-In-Logs ✅ Passed PR contains only validation rule replacements in Go annotations and YAML CRD manifests. No logging statements or sensitive data exposure detected.
✨ 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)

Error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented
The command is terminated due to an error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented


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

@openshift-ci
openshift-ci Bot requested review from deads2k and everettraven July 31, 2026 14:04
@qodo-for-rh-openshift

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

@ardaguclu

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 31, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aws-ovn
/test e2e-aws-ovn-hypershift
/test e2e-aws-ovn-hypershift-conformance
/test e2e-aws-ovn-techpreview
/test e2e-aws-serial-1of2
/test e2e-aws-serial-2of2
/test e2e-aws-serial-techpreview-1of2
/test e2e-aws-serial-techpreview-2of2
/test e2e-azure
/test e2e-gcp
/test e2e-upgrade
/test e2e-upgrade-out-of-change
/test minor-e2e-upgrade-minor

@ardaguclu

Copy link
Copy Markdown
Member

/approve

@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@config/v1/types_ingress.go`:
- Line 281: Update the XValidation rule on the ingress label-key field in
config/v1/types_ingress.go so each DNS prefix label and the name segment are
length-validated independently, enforcing the qualified-name limits while
allowing a valid 253-character prefix plus “/x”; then regenerate all three CRDs.
Apply the generated schema changes to
payload-manifests/crds/0000_10_config-operator_01_ingresses-CustomNoUpgrade.crd.yaml:122-123,
payload-manifests/crds/0000_10_config-operator_01_ingresses-DevPreviewNoUpgrade.crd.yaml:122-123,
and
payload-manifests/crds/0000_10_config-operator_01_ingresses-TechPreviewNoUpgrade.crd.yaml:122-123,
and add boundary tests covering valid and invalid segment lengths.
- Line 174: Make the LabelValue XValidation regex optional so empty values pass
while preserving rejection of invalid non-empty values and trailing separators;
update the validation in config/v1/types_ingress.go:174, regenerate the affected
config/v1/zz_generated* CRDs, and update the corresponding schemas in
payload-manifests/crds/0000_10_config-operator_01_ingresses-CustomNoUpgrade.crd.yaml:93,
payload-manifests/crds/0000_10_config-operator_01_ingresses-DevPreviewNoUpgrade.crd.yaml:93,
and
payload-manifests/crds/0000_10_config-operator_01_ingresses-TechPreviewNoUpgrade.crd.yaml:93.
Add regression coverage for empty, one-character, valid, and trailing-separator
LabelValue inputs.
🪄 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: cc9f98bb-1b58-48ca-9793-d1b3bd9082f7

📥 Commits

Reviewing files that changed from the base of the PR and between e5a6b6c and 910203b.

⛔ Files ignored due to path filters (4)
  • config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_ingresses-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_ingresses-DevPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_ingresses-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.featuregated-crd-manifests/ingresses.config.openshift.io/IngressComponentRouteLabels.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
📒 Files selected for processing (4)
  • config/v1/types_ingress.go
  • payload-manifests/crds/0000_10_config-operator_01_ingresses-CustomNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_10_config-operator_01_ingresses-DevPreviewNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_10_config-operator_01_ingresses-TechPreviewNoUpgrade.crd.yaml

Comment thread config/v1/types_ingress.go Outdated
Comment thread config/v1/types_ingress.go
@openshift-ci openshift-ci Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 4, 2026
@JoelSpeed
JoelSpeed force-pushed the fix-kms-secret-name-cel branch from 5377c74 to d74ec2a Compare August 4, 2026 15:31
@JoelSpeed

Copy link
Copy Markdown
Contributor Author

CC @jhadvig @Leo6Leo @everettraven

@ardaguclu

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 4, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aws-ovn
/test e2e-aws-ovn-hypershift
/test e2e-aws-ovn-hypershift-conformance
/test e2e-aws-ovn-techpreview
/test e2e-aws-serial-1of2
/test e2e-aws-serial-2of2
/test e2e-aws-serial-techpreview-1of2
/test e2e-aws-serial-techpreview-2of2
/test e2e-azure
/test e2e-gcp
/test e2e-upgrade
/test e2e-upgrade-out-of-change
/test minor-e2e-upgrade-minor

@JoelSpeed
JoelSpeed force-pushed the fix-kms-secret-name-cel branch from d74ec2a to 5289f85 Compare August 4, 2026 16:23
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 4, 2026
@JoelSpeed

Copy link
Copy Markdown
Contributor Author

/verified by @JoelSpeed

I've locally vendored these changes into hypershift and checked that the integration tests now pass

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

Copy link
Copy Markdown

@JoelSpeed: This PR has been marked as verified by @JoelSpeed.

Details

In response to this:

/verified by @JoelSpeed

I've locally vendored these changes into hypershift and checked that the integration tests now pass

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

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
`@payload-manifests/crds/0000_10_config-operator_01_ingresses-TechPreviewNoUpgrade.crd.yaml`:
- Around line 118-127: The first validation rule at line 120 applies a
63-character limit to all label keys, which incorrectly rejects valid qualified
names with DNS prefixes that exceed 63 characters but remain within the
253-character total limit. Update the first rule to only enforce the
63-character constraint on simple keys without a DNS prefix, or condition its
application appropriately. In the second rule, refactor the regex pattern to
explicitly enforce the 63-character limit on just the final name segment after
the slash (if present) rather than applying constraints that fail to isolate
that segment, while keeping the overall key-size limit at 253 characters as
specified.
🪄 Autofix

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: 393fa27a-d8c6-419e-9176-71782b7baaeb

📥 Commits

Reviewing files that changed from the base of the PR and between d74ec2a and 5289f85.

⛔ Files ignored due to path filters (8)
  • config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-DevPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_authentications-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_ingresses-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_ingresses-DevPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_ingresses-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • config/v1/zz_generated.featuregated-crd-manifests/authentications.config.openshift.io/ExternalOIDCExternalClaimsSourcing.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • config/v1/zz_generated.featuregated-crd-manifests/ingresses.config.openshift.io/IngressComponentRouteLabels.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
📒 Files selected for processing (9)
  • config/v1/tests/ingresses.config.openshift.io/IngressComponentRouteLabels.yaml
  • config/v1/types_authentication.go
  • config/v1/types_ingress.go
  • payload-manifests/crds/0000_10_config-operator_01_authentications-CustomNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_10_config-operator_01_authentications-DevPreviewNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_10_config-operator_01_authentications-TechPreviewNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_10_config-operator_01_ingresses-CustomNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_10_config-operator_01_ingresses-DevPreviewNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_10_config-operator_01_ingresses-TechPreviewNoUpgrade.crd.yaml
🚧 Files skipped from review as they are similar to previous changes (7)
  • payload-manifests/crds/0000_10_config-operator_01_authentications-TechPreviewNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_10_config-operator_01_ingresses-DevPreviewNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_10_config-operator_01_authentications-DevPreviewNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_10_config-operator_01_authentications-CustomNoUpgrade.crd.yaml
  • config/v1/types_ingress.go
  • payload-manifests/crds/0000_10_config-operator_01_ingresses-CustomNoUpgrade.crd.yaml
  • config/v1/types_authentication.go

Comment on lines +118 to +127
- message: label keys must be between 1 and 63 characters in
length
rule: self.all(key, key.size() <= 63 && key.size() > 0)
- message: label keys must be valid qualified names, consisting
of an optional DNS subdomain prefix of up to 253 characters
followed by a slash and a name segment of 1-63 characters,
that consists only of alphanumeric characters, dashes, underscores,
and dots, and must start and end with an alphanumeric character
rule: self.all(key, !format.qualifiedName().validate(key).hasValue())
rule: self.all(key, key.matches('^([a-z0-9]([a-z0-9\\-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9\\-]*[a-z0-9])?)*\\/)?[a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?$')
&& key.size() <= 253)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Allow a 63-character name segment after a DNS prefix.

Line 120 applies the 63-character limit to the complete key. A valid qualified key with a DNS prefix and a 63-character name segment is rejected when its total length exceeds 63. The regex also does not limit the final name segment independently.

Keep the total-key limit at 253. Encode the 63-character limit on the final name segment in the regex. Add a test for a valid prefixed key longer than 63 characters.

Proposed validation change
-                        rule: self.all(key, key.size() <= 63 && key.size() > 0)
+                        rule: self.all(key, key.size() > 0 && key.size() <= 253)
...
-                        rule: self.all(key, key.matches('^([a-z0-9]([a-z0-9\\-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9\\-]*[a-z0-9])?)*\\/)?[a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?$')
-                          && key.size() <= 253)
+                        rule: self.all(key, key.matches('^([a-z0-9]([a-z0-9\\-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9\\-]*[a-z0-9])?)*\\/)?[a-zA-Z0-9]([a-zA-Z0-9._-]{0,61}[a-zA-Z0-9])?$')
+                          && key.size() <= 253)
📝 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
- message: label keys must be between 1 and 63 characters in
length
rule: self.all(key, key.size() <= 63 && key.size() > 0)
- message: label keys must be valid qualified names, consisting
of an optional DNS subdomain prefix of up to 253 characters
followed by a slash and a name segment of 1-63 characters,
that consists only of alphanumeric characters, dashes, underscores,
and dots, and must start and end with an alphanumeric character
rule: self.all(key, !format.qualifiedName().validate(key).hasValue())
rule: self.all(key, key.matches('^([a-z0-9]([a-z0-9\\-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9\\-]*[a-z0-9])?)*\\/)?[a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?$')
&& key.size() <= 253)
- message: label keys must be between 1 and 63 characters in
length
rule: self.all(key, key.size() > 0 && key.size() <= 253)
- message: label keys must be valid qualified names, consisting
of an optional DNS subdomain prefix of up to 253 characters
followed by a slash and a name segment of 1-63 characters,
that consists only of alphanumeric characters, dashes, underscores,
and dots, and must start and end with an alphanumeric character
rule: self.all(key, key.matches('^([a-z0-9]([a-z0-9\\-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9\\-]*[a-z0-9])?)*\\/)?[a-zA-Z0-9]([a-zA-Z0-9._-]{0,61}[a-zA-Z0-9])?$')
&& key.size() <= 253)
🤖 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
`@payload-manifests/crds/0000_10_config-operator_01_ingresses-TechPreviewNoUpgrade.crd.yaml`
around lines 118 - 127, The first validation rule at line 120 applies a
63-character limit to all label keys, which incorrectly rejects valid qualified
names with DNS prefixes that exceed 63 characters but remain within the
253-character total limit. Update the first rule to only enforce the
63-character constraint on simple keys without a DNS prefix, or condition its
application appropriately. In the second rule, refactor the regex pattern to
explicitly enforce the 63-character limit on just the final name segment after
the slash (if present) rather than applying constraints that fail to isolate
that segment, while keeping the overall key-size limit at 253 characters as
specified.

@everettraven everettraven 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

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

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ardaguclu, everettraven

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-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aws-ovn
/test e2e-aws-ovn-hypershift
/test e2e-aws-ovn-hypershift-conformance
/test e2e-aws-ovn-techpreview
/test e2e-aws-serial-1of2
/test e2e-aws-serial-2of2
/test e2e-aws-serial-techpreview-1of2
/test e2e-aws-serial-techpreview-2of2
/test e2e-azure
/test e2e-gcp
/test e2e-upgrade
/test e2e-upgrade-out-of-change
/test minor-e2e-upgrade-minor

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 4, 2026
@everettraven

Copy link
Copy Markdown
Contributor

/override ci/prow/verify-crdify

@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@everettraven: Overrode contexts on behalf of everettraven: ci/prow/verify-crdify

Details

In response to this:

/override ci/prow/verify-crdify

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.

@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@JoelSpeed: 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/e2e-aws-ovn-techpreview 5289f85 link true /test e2e-aws-ovn-techpreview
ci/prow/verify-hypershift-integration 5289f85 link true /test verify-hypershift-integration
ci/prow/e2e-aws-ovn-hypershift-conformance 5289f85 link true /test e2e-aws-ovn-hypershift-conformance

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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants