Skip to content

OCPBUGS-82292: extend supported values for MCN IRI image status field#2800

Open
andfasano wants to merge 1 commit intoopenshift:masterfrom
andfasano:iri-fix-mcn-status-field
Open

OCPBUGS-82292: extend supported values for MCN IRI image status field#2800
andfasano wants to merge 1 commit intoopenshift:masterfrom
andfasano:iri-fix-mcn-status-field

Conversation

@andfasano
Copy link
Copy Markdown
Contributor

Required by the IRI MCD manager introduced in openshift/machine-config-operator#5807

@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-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Apr 9, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@andfasano: This pull request references Jira Issue OCPBUGS-82292, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Required by the IRI MCD manager introduced in openshift/machine-config-operator#5807

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
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 9, 2026

Hello @andfasano! 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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 600497d3-22dd-4f39-a06f-33787f8d6345

📥 Commits

Reviewing files that changed from the base of the PR and between f49e19d and 373ea71.

⛔ Files ignored due to path filters (5)
  • machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-Hypershift-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-DevPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineconfignodes.machineconfiguration.openshift.io/NoRegistryClusterInstall.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
📒 Files selected for processing (7)
  • machineconfiguration/v1/tests/machineconfignodes.machineconfiguration.openshift.io/NoRegistryClusterInstall.yaml
  • machineconfiguration/v1/types_machineconfignode.go
  • machineconfiguration/v1/zz_generated.swagger_doc_generated.go
  • payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-Hypershift-CustomNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-CustomNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-DevPreviewNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-TechPreviewNoUpgrade.crd.yaml
✅ Files skipped from review due to trivial changes (1)
  • machineconfiguration/v1/zz_generated.swagger_doc_generated.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-DevPreviewNoUpgrade.crd.yaml
  • payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-TechPreviewNoUpgrade.crd.yaml
  • machineconfiguration/v1/tests/machineconfignodes.machineconfiguration.openshift.io/NoRegistryClusterInstall.yaml
  • payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-Hypershift-CustomNoUpgrade.crd.yaml
  • machineconfiguration/v1/types_machineconfignode.go

📝 Walkthrough

Walkthrough

The PR updates image-host validation and test fixtures. Test data for NoRegistryClusterInstall gains two status.internalReleaseImage.releases entries for ocp-release-bundle-4.19.0-x86_64 and ocp-release-bundle-4.20.0-x86_64. A kubebuilder XValidation regex for MachineConfigNodeStatusInternalReleaseImageRef.Image was changed to allow localhost or a dot-qualified domain as the image host. Corresponding x-kubernetes-validations regexes in multiple CRD YAMLs and the generated Swagger description were updated to match.

✨ 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.11.4)

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 and usage tips.

@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 9, 2026
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Extend MCN IRI image status field to support localhost registries

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Extend OCI image hostname validation to support localhost registries
• Update regex pattern to accept localhost and localhost.localdomain formats
• Add test cases with localhost image references
• Propagate validation changes across all CRD manifest files
Diagram
flowchart LR
  A["OCI Image Validation Regex"] -->|Add localhost support| B["Updated Pattern"]
  B -->|Applied to| C["Type Definition"]
  B -->|Applied to| D["CRD Manifests"]
  B -->|Applied to| E["Test Cases"]
  C -->|Validates| F["localhost/path@sha256:..."]
  C -->|Validates| G["localhost.localdomain/path@sha256:..."]
Loading

Grey Divider

File Changes

1. machineconfiguration/v1/types_machineconfignode.go ✨ Enhancement +1/-1

Update OCI image hostname validation regex pattern

machineconfiguration/v1/types_machineconfignode.go


2. machineconfiguration/v1/tests/machineconfignodes.machineconfiguration.openshift.io/NoRegistryClusterInstall.yaml 🧪 Tests +72/-0

Add localhost image reference test cases

machineconfiguration/v1/tests/machineconfignodes.machineconfiguration.openshift.io/NoRegistryClusterInstall.yaml


3. machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-Hypershift-CustomNoUpgrade.crd.yaml ⚙️ Configuration changes +1/-1

Propagate localhost validation to Hypershift CRD

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-Hypershift-CustomNoUpgrade.crd.yaml


View more (8)
4. machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-CustomNoUpgrade.crd.yaml ⚙️ Configuration changes +1/-1

Propagate localhost validation to SelfManagedHA CRD

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-CustomNoUpgrade.crd.yaml


5. machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-DevPreviewNoUpgrade.crd.yaml ⚙️ Configuration changes +1/-1

Propagate localhost validation to DevPreview CRD

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-DevPreviewNoUpgrade.crd.yaml


6. machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-TechPreviewNoUpgrade.crd.yaml ⚙️ Configuration changes +1/-1

Propagate localhost validation to TechPreview CRD

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-TechPreviewNoUpgrade.crd.yaml


7. machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineconfignodes.machineconfiguration.openshift.io/NoRegistryClusterInstall.yaml ⚙️ Configuration changes +1/-1

Propagate localhost validation to featuregated CRD

machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineconfignodes.machineconfiguration.openshift.io/NoRegistryClusterInstall.yaml


8. payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-Hypershift-CustomNoUpgrade.crd.yaml ⚙️ Configuration changes +1/-1

Propagate localhost validation to payload Hypershift CRD

payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-Hypershift-CustomNoUpgrade.crd.yaml


9. payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-CustomNoUpgrade.crd.yaml ⚙️ Configuration changes +1/-1

Propagate localhost validation to payload SelfManagedHA CRD

payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-CustomNoUpgrade.crd.yaml


10. payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-DevPreviewNoUpgrade.crd.yaml ⚙️ Configuration changes +1/-1

Propagate localhost validation to payload DevPreview CRD

payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-DevPreviewNoUpgrade.crd.yaml


11. payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-TechPreviewNoUpgrade.crd.yaml ⚙️ Configuration changes +1/-1

Propagate localhost validation to payload TechPreview CRD

payload-manifests/crds/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-TechPreviewNoUpgrade.crd.yaml


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Apr 9, 2026

Code Review by Qodo

🐞 Bugs (0)   📘 Rule violations (1)   📎 Requirement gaps (0)   🎨 UX Issues (0)
📘\ ⚙ Maintainability (1)

Grey Divider


Action required

1. Image XValidation not documented 📘
Description
The updated Image validation now explicitly only permits localhost or a dot-qualified domain,
but the field comment still documents the host portion generically as host[:port]..., leaving
enforced constraints undocumented. This violates the requirement that validation markers/constraints
be fully described in human-readable field documentation.
Code

machineconfiguration/v1/types_machineconfignode.go[219]

+	// +kubebuilder:validation:XValidation:rule=`(self.split('@')[0].matches('^(localhost|([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9-]+)(:[0-9]{2,5})?/([a-zA-Z0-9-_]{0,61}/)?[a-zA-Z0-9-_.]*?$'))`,message="the OCI Image name should follow the host[:port][/namespace]/name format, resembling a valid URL without the scheme"
Evidence
PR Compliance ID 6 requires field comments to document all validation marker constraints. The
modified XValidation regex constrains the allowed registry host to localhost or a domain
containing at least one dot, but the field comment does not describe this constraint.

AGENTS.md
machineconfiguration/v1/types_machineconfignode.go[211-220]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `Image` field comment does not fully document the constraints enforced by the updated `+kubebuilder:validation:XValidation` rule (allowed host is `localhost` or a dot-qualified DNS name, plus optional `:port`).

## Issue Context
This PR changed the host-regex XValidation to allow `localhost` and still require dotted domains for non-localhost values; documentation must match enforced validation.

## Fix Focus Areas
- machineconfiguration/v1/types_machineconfignode.go[211-220]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment thread machineconfiguration/v1/types_machineconfignode.go Outdated
@andfasano andfasano force-pushed the iri-fix-mcn-status-field branch from f49e19d to 373ea71 Compare April 9, 2026 13:10
@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 Apr 9, 2026
@andfasano
Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot
Copy link
Copy Markdown

@andfasano: This pull request references Jira Issue OCPBUGS-82292, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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.

@andfasano
Copy link
Copy Markdown
Contributor Author

/retest

// +kubebuilder:validation:MaxLength=447
// +kubebuilder:validation:XValidation:rule=`(self.split('@').size() == 2 && self.split('@')[1].matches('^sha256:[a-f0-9]{64}$'))`,message="the OCI Image reference must end with a valid '@sha256:<digest>' suffix, where '<digest>' is 64 characters long"
// +kubebuilder:validation:XValidation:rule=`(self.split('@')[0].matches('^([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9-]+(:[0-9]{2,5})?/([a-zA-Z0-9-_]{0,61}/)?[a-zA-Z0-9-_.]*?$'))`,message="the OCI Image name should follow the host[:port][/namespace]/name format, resembling a valid URL without the scheme"
// +kubebuilder:validation:XValidation:rule=`(self.split('@')[0].matches('^(localhost|([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9-]+)(:[0-9]{2,5})?/([a-zA-Z0-9-_]{0,61}/)?[a-zA-Z0-9-_.]*?$'))`,message="the OCI Image name should follow the host[:port][/namespace]/name format, resembling a valid URL without the scheme; host must be either 'localhost' or a dot-qualified domain name"
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.

I'm curious, why is using 127.0.0.1:{port} not sufficient?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IPv6 will not be accepted with that validation (ie ::1 or [::1]:22625). We currently support either ipv4, ipv6 or dualstack, so using localhost will be a nice simplification at this level

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.

What if you added support for ipv6 to the validation?

I won't block this PR based on the approach, but it seems odd to me to add a localhost label to resolve this.

If you support ipv6 would it ever be reasonable for an end-user to want to be able to specify an ipv6 hostname that is not localhost, much like the current validation would allow for ipv4?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe I'm wrong but I don't think the original validation rule (coming from ImageDigestFormat and reused in many other resources) was meant to support directly an IP (either v4 or v6) as part of the host section. Neither was our intention to support that.
This field will be consumed only by the MCD IRI manager to check the status on its local node, and it's not meant to be directly used by an end-user.
The end-user will instead look to the (singleton) IRI resource, which will aggregate the various MCNs and will use api-int as a valid pullspec (this latter part currently under implementation)

message: ""
lastTransitionTime: "2024-12-01T08:04:30Z"
- name: ocp-release-bundle-4.20.0-x86_64
image: localhost.localdomain/openshift/release-images@sha256:f98795f7932441b30bb8bcfbbf05912875383fad1f2b3be08a22ec148d68607f
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.

My understanding based on the field documentation and validation change is that something like this shouldn't be allowed - is that incorrect?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That should be ok. Will not be accepted no-dot domains (with just the single exception of localhost), domains starting with a dot (.com) or ending with a dot (example.)

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.

Okay. I think I interpreted the documentation change of:

The host must be either exactly "localhost" or a dot-qualified domain name.

To mean that something like localhost.* would be considered invalid (either you use exactly localhost or a dot-qualified domain name not containing localhost. Maybe we can clarify the documentation a bit more to be less prone to incorrect interpretation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just for the sake of clarity I also added Single-label hosts other than "localhost" are not permitted.. Any other dot-qualified (included localhost.* remain valid, as it was in the previous version of the rule)

@everettraven
Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 15, 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

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 15, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 15, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 15, 2026

@andfasano: 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 373ea71 link true /test e2e-aws-ovn
ci/prow/e2e-azure 373ea71 link true /test e2e-azure
ci/prow/e2e-aws-serial-techpreview-2of2 373ea71 link true /test e2e-aws-serial-techpreview-2of2
ci/prow/e2e-aws-ovn-techpreview 373ea71 link true /test e2e-aws-ovn-techpreview
ci/prow/e2e-aws-serial-techpreview-1of2 373ea71 link true /test e2e-aws-serial-techpreview-1of2
ci/prow/e2e-aws-ovn-hypershift-conformance 373ea71 link true /test e2e-aws-ovn-hypershift-conformance
ci/prow/e2e-gcp 373ea71 link true /test e2e-gcp

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants