Bug 2066388

Summary: Wrong Error generates when https is missing in the value of `regionEndpoint` in `configs.imageregistry.operator.openshift.io/cluster`
Product: OpenShift Container Platform Reporter: naygupta
Component: Image RegistryAssignee: Oleg Bulatov <obulatov>
Status: CLOSED ERRATA QA Contact: XiuJuan Wang <xiuwang>
Severity: medium Docs Contact:
Priority: high    
Version: 4.8CC: milang
Target Milestone: ---   
Target Release: 4.13.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-17 22:46:32 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 naygupta 2022-03-21 16:11:55 UTC
Description of problem:

Openshift 4.8 
Storage : s3 bucket

`cluster-image-registry-operator` pod is stuck in crashloopbackoff
Upgrade get stuck due to the below error in Image-registry-operator pod logs:

Error:
E0318 12:39:22.582371       1 runtime.go:78] Observed a panic: 
runtime.boundsError{x:3, y:2, signed:true, code:0x3} (runtime error: slice 
bounds out of range [3:2])


$ oc edit configs.imageregistry.operator.openshift.io/cluster
 ...
 managementState: Managed
 s3:
   bucket: ocp-xxx-registry
   encrypt: true
   region: us-east-1
   regionEndpoint: netappsxxx.xxx.at:18x82 
     

image-registry-operator generates panic messages in logs :

~~~
2022-03-18T12:51:54.716112751Z E0318 12:51:54.715730       1 
runtime.go:78] Observed a panic: runtime.boundsError{x:3, y:2, 
signed:true, code:0x3} (runtime error: slice boun
ds out of range [3:2])
2022-03-18T12:51:54.716112751Z goroutine 466 [running]:
2022-03-18T12:51:54.716112751Z 
k8s.io/apimachinery/pkg/util/runtime.logPanic(0x2af0d40, 
0xc001c62930)
2022-03-18T12:51:54.716112751Z  /go/src/github.com/openshift/cluster- 
image-registry- 
operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:74 +0x95
2022-03-18T12:51:54.716112751Z k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
2022-03-18T12:51:54.716112751Z  /go/src/github.com/openshift/cluster-image-registry-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:48 +0x86
2022-03-18T12:51:54.716112751Z panic(0x2af0d40, 0xc001c62930)
~~~

Solution:
- Add https:// and \ at the end of regionEndpoint URL:
  regionEndpoint: https://netappsxxx.xxx.at:18x82/ 


Expectation:
Error message should be relatable to storage URL or something( `regionEndpoint`  parameter). This panic error leads to nowhere to troubleshoot the issue

Comment 3 Oleg Bulatov 2022-11-18 16:51:04 UTC
We cannot add validation for this field as may cause even more problems for customers who already have invalid value in this field. Let's update the documentation for the field.

Comment 6 XiuJuan Wang 2022-12-13 09:36:14 UTC
$oc explain configs.imageregistry.operator.openshift.io.spec.storage.s3.regionEndpoint
KIND:     Config
VERSION:  imageregistry.operator.openshift.io/v1

FIELD:    regionEndpoint <string>

DESCRIPTION:
     regionEndpoint is the endpoint for S3 compatible storage services. It
     should be a valid URL with scheme, e.g. https://s3.example.com. Optional,
     defaults based on the Region that is provided.

$oc version
Client Version: 4.13.0-0.nightly-2022-12-02-011756
Kustomize Version: v4.5.7
Server Version: 4.13.0-0.nightly-2022-12-08-170038
Kubernetes Version: v1.25.2+5497c42


Move to verified

Comment 9 errata-xmlrpc 2023-05-17 22:46:32 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.13.0 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-2023:1326