Bug 1924961

Summary: k8sutil.TrimDNS1123Label creates invalid values
Product: OpenShift Container Platform Reporter: Jesus M. Rodriguez <jesusr>
Component: Operator SDKAssignee: Jesus M. Rodriguez <jesusr>
Status: CLOSED ERRATA QA Contact: Fan Jia <jfan>
Severity: high Docs Contact:
Priority: high    
Version: 4.7CC: aos-bugs
Target Milestone: ---   
Target Release: 4.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-24 15:58:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jesus M. Rodriguez 2021-02-04 01:46:56 UTC
## Bug Report

#### What did you do?
```
operator-sdk run bundle --install-mode AllNamespaces -n proactive-node-scaling-operator quay.io/$repo/proactive-node-scaling-operator-bundle:latest
I0202 10:50:13.277327   46403 request.go:645] Throttling request took 1.051324502s, request: GET:https://api.control-cluster-raffa.demo.red-chesterfield.com:6443/apis/authentication.k8s.io/v1beta1?timeout=32s
FATA[0010] Failed to run bundle: create catalog: error creating registry pod: error creating registry pod: create registry pod: Pod "-raffaelespazzoli-proactive-node-scaling-operator-bundle-latest" is invalid: metadata.name: Invalid value: "-raffaelespazzoli-proactive-node-scaling-operator-bundle-latest": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*') 
```
I never got this error before. The catalog source pod name is clearly wrong: `-raffaelespazzoli-proactive-node-scaling-operator-bundle-latest`, I probably made some mistake somewhere. How is that name generated?

#### What did you expect to see?

Working bundle

#### What did you see instead? Under which circumstances?
```
Invalid value: "-raffaelespazzoli-proactive-node-scaling-operator-bundle-latest": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*') 
```
#### Environment

**Operator type:**

<!-- Uncomment one or more of the following lines corresponding to the language of the operator type -->

/language go
<!-- /language ansible -->
<!-- /language helm -->

**Kubernetes cluster type:**

Unknown

`$ operator-sdk version`
```
operator-sdk version
operator-sdk version: "v1.3.0", commit: "1abf57985b43bf6a59dcd18147b3c574fa57d3f6", kubernetes version: "1.19.4", go version: "go1.15.5", GOOS: "linux", GOARCH: "amd64
```

`$ go version` (if language is Go)
1.15.5

`$ kubectl version`

N/A

#### Possible Solution

<!-- Only if you have suggestions on a fix for the bug -->

#### Additional context

<!-- Add any other context about the problem here. -->

Comment 4 errata-xmlrpc 2021-02-24 15:58:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:5633