Bug 2016425

Summary: Adoption controller generating invalid metadata.Labels for an already adopted Subscription resource
Product: OpenShift Container Platform Reporter: tflannag
Component: OLMAssignee: Per da Silva <pegoncal>
OLM sub component: OLM QA Contact: kuiwang
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: jiazha, pegoncal, sscheink
Version: 4.9   
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Invalid Subscription labels were being generated when resource name was greater than 63 characters Consequence: An invalid Subscription was being created Fix: Truncated the label for cases that would exceed the 63 character limit Result: Subscription resource no longer rejected my Kubernetes API
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-10 10:39:06 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 tflannag 2021-10-21 13:52:22 UTC
Description of problem:
The adoption controller failed to adopt an already existing (and appears to already have been adopted) Subscription when generating the adoption metadata.Labels:

```
{"level":"error","ts":1634738113.834287,"logger":"controllers.adoption","msg":"Error adopting Subscription","request":"openshift-special-resource-operator/sro-operator-subscription","error":"Subscription.operators.coreos.com \"sro-operator-subscription\" is invalid: metadata.labels: Invalid value: \"operators.coreos.com/openshift-special-resource-operator.openshift-special-resource-\": name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\t/build/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:114\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/build/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:311\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/build/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/build/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227"}
```

Link to a CI job that contains more context: https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/openshift-kni_cnf-features-deploy/750/pull-ci-openshift-kni-cnf-features-deploy-master-e2e-gcp-ran-profile/1450809562331353088

Version-Release number of selected component (if applicable):
4.9

How reproducible:
Unknown

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 3 Per da Silva 2022-04-08 12:46:48 UTC
Seems the upstream PR is stale and open since October. We should just close it and take over.

Comment 5 Per da Silva 2022-04-19 13:30:10 UTC
This has merged downstream! It's ready for QA.

Comment 9 errata-xmlrpc 2022-08-10 10:39:06 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 (Important: OpenShift Container Platform 4.11.0 bug fix and security 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-2022:5069