openshift/api

Incorrect validation of hostname type in IngressController.operator.openshift.io/v1

monomac opened this issue · 4 comments

Hostname type definition in ./config/v1/types_ingress.go defines Hostname as a string of "hostname" format. However, validation of hostname format does not allow for top level domain to include a digit.

Example:

my.domain.com works
my.domain.c4m does not

How did I test? Creating componentRoute in Ingress. This definition works:

apiVersion: config.openshift.io/v1
kind: Ingress
metadata:
creationTimestamp: "2022-01-07T10:12:30Z"
generation: 4
name: cluster
resourceVersion: "1239439"
uid: 3460d6bf-8907-4b54-a920-3cc6a7e5ba18
spec:
componentRoutes:

  • hostname: console.apps.cp.mbs.sk.vwgtr
    name: test
    namespace: openshift-console
    domain: apps.alfa.cp.mbs.sk.vwgtr
    status: {}

This one returns an error:

ingresses.config.openshift.io "cluster" was not valid:

  • spec.componentRoutes.hostname: Invalid value: "console.apps.cp.mbs.sk.vw8tr": spec.componentRoutes.hostname in body must be of type hostname: "console.apps.cp.mbs.sk.vw8tr"

apiVersion: config.openshift.io/v1
kind: Ingress
metadata:
creationTimestamp: "2022-01-07T10:12:30Z"
generation: 4
name: cluster
resourceVersion: "1239439"
uid: 3460d6bf-8907-4b54-a920-3cc6a7e5ba18
spec:
componentRoutes:

  • hostname: console.apps.cp.mbs.sk.vw8tr
    name: test
    namespace: openshift-console
    domain: apps.alfa.cp.mbs.sk.vwgtr
    status: {}

Type definition in ./config/v1/types_ingress.go:

// Hostname is an alias for hostname string validation.
// +kubebuilder:validation:Format=hostname
type Hostname string

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

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/test-infra repository.