Bug 2054787 - SRO controller goes to CrashLoopBackOff status when the pull-secret does not have the correct permissions
Summary: SRO controller goes to CrashLoopBackOff status when the pull-secret does not ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Special Resource Operator
Version: 4.9
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.11.0
Assignee: Pablo Acevedo
QA Contact: Udi Kalifon
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-15 17:16 UTC by Dahir Osman
Modified: 2022-08-10 10:50 UTC (History)
0 users

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-08-10 10:49:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift-psap special-resource-operator pull 259 0 None open Don't return a nil err in case of error 2022-02-16 15:26:25 UTC
Github openshift special-resource-operator pull 114 0 None open Bug 2054787: SRO controller crashes when pull-secret holds bad permissions 2022-02-28 16:56:39 UTC
Red Hat Product Errata RHSA-2022:5069 0 None None None 2022-08-10 10:50:23 UTC

Description Dahir Osman 2022-02-15 17:16:39 UTC
Description of problem:

If one's quay.io credentials do not have correct permissions to pull the driver toolkit image, the SRO controller goes to a CrashLoopBackOff status.

How reproducible:
100%

Steps to Reproduce:
1. Deploy SRO from the 4.9 channel
2. Set the quay.io pull secret to one that does not have permissions to pull the DTK Images.
3. Apply the simple-kmod SR

Actual results:

2022-02-15T17:00:27.863Z        INFO    filter          CREATE IsSpecialResource (reflect)      {"Name": "simple-kmod", "Type": "*v1beta1.SpecialResource"}
2022-02-15T17:00:27.863Z        INFO    preamble        Controller Request      {"Name": "simple-kmod", "Namespace": ""}
2022-02-15T17:00:27.867Z        INFO    cache   Nodes cached    {"name": "cnfde9.ptp.lab.eng.bos.redhat.com"}
2022-02-15T17:00:27.867Z        INFO    cache   Node list:      {"length": 1}
2022-02-15T17:00:27.867Z        INFO    cache   Nodes   {"num": 1}
2022-02-15T17:00:27.872Z        INFO    upgrade         History {"entry": "quay.io/openshift-release-dev/ocp-release@sha256:5c55be02e32e688ec5a404858a08cf533ba15b50b6f0e028089635b47db5866e"}
2022-02-15T17:00:30.298Z        INFO    warning         OnError: Cannot extract manifest: GET https://quay.io/v2/openshift-release-dev/ocp-v4.0-art-dev/manifests/sha256:65369b6ccff0f3dcdaa8685ce4d765b8eba0438a506dad5d4221770a6ac1960a: UNAUTHORIZED: access to the requested resource is not a
uthorized; map[]                                                                                                                                 
2022-02-15T17:00:30.298Z        INFO    exit    OnError: upgrade.DriverToolkitVersion[upgrade.go:170] Cannot extract last layer for DTK from: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:65369b6ccff0f3dcdaa8685ce4d765b8eba0438a506dad5d4221770a6ac1960a  


Expected results:
A valid BuildConfig

Additional info:
There is an typo where the LastLayer function returns a 'nil' error where it should have returned the err.  This causes the calling function to think there was no error and de-reference the nil result.

https://github.com/openshift-psap/special-resource-operator/blob/master/pkg/registry/registry.go#L103


Patch to fix:
diff --git a/pkg/registry/registry.go b/pkg/registry/registry.go
index d937e663..2acfe305 100644
--- a/pkg/registry/registry.go
+++ b/pkg/registry/registry.go
@@ -101,7 +101,7 @@ func (r *registry) LastLayer(entry string) (v1.Layer, error) {
        manifest, err := crane.Manifest(entry, options)
        if err != nil {
                warn.OnError(fmt.Errorf("cannot extract manifest: %v", err))
-               return nil, nil
+               return nil, err
        }
 
        release := unstructured.Unstructured{}

Comment 2 Udi Kalifon 2022-03-14 14:55:39 UTC
Verified. I see this error in the build pod:
STEP 1/22: FROM quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:8705564ee52c5b655529860687f73db78daef4eaa54f5fdd3160cfbfc4aac438
Trying to pull quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:8705564ee52c5b655529860687f73db78daef4eaa54f5fdd3160cfbfc4aac438...
error: build error: error creating build container: initializing source docker://quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:8705564ee52c5b655529860687f73db78daef4eaa54f5fdd3160cfbfc4aac438: reading manifest sha256:8705564ee52c5b655529860687f73db78daef4eaa54f5fdd3160cfbfc4aac438 in quay.io/openshift-release-dev/ocp-v4.0-art-dev: unauthorized: access to the requested resource is not authorized

Comment 5 errata-xmlrpc 2022-08-10 10:49:51 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


Note You need to log in before you can comment on or make changes to this bug.