Bug 1659350 - Should forbidden update samplesresources.status
Summary: Should forbidden update samplesresources.status
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: ImageStreams
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.1.0
Assignee: Gabe Montero
QA Contact: XiuJuan Wang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-12-14 07:36 UTC by XiuJuan Wang
Modified: 2019-06-04 10:41 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-04 10:41:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:0758 0 None None None 2019-06-04 10:41:21 UTC

Description XiuJuan Wang 2018-12-14 07:36:47 UTC
Description of problem:
Could save Architectures|Install Type|Management State in samplesresources.status to invalid value.

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

version   0.0.1-2018-12-08-172651   True        False         33m       Cluster version is 0.0.1-2018-12-08-172651

quay.io/openshift-release-dev/ocp-v4.0@sha256:d46de909247d8002e92e7d1ad6e3f32d3b4e439e44ebe4ae9bd63a39bf9d4276

How reproducible:
always

Steps to Reproduce:
1.Config samplesresources.status.Architectures to ppc64le when the samplesresources.spec.Architectures have set to x86_64

2.Check samplesresources

3.Check cvo status

Actual results:
cvo treats this as invalid configure.

$ oc describe samplesresources 
Name:         openshift-samples
Namespace:    
Labels:       <none>
Annotations:  <none>
API Version:  samplesoperator.config.openshift.io/v1alpha1
Kind:         SamplesResource
Metadata:
  Creation Timestamp:  2018-12-13T05:16:16Z
  Finalizers:
    samplesoperator.config.openshift.io/finalizer
  Generation:        1
  Resource Version:  1324563
  Self Link:         /apis/samplesoperator.config.openshift.io/v1alpha1/samplesresources/openshift-samples
  UID:               376716ef-fe96-11e8-8c40-0aaa93c407fa
Spec:
  Architectures:
    x86_64
  Install Type:      centos
  Management State:  Managed
Status:
  Architectures:
    ppc64le
  Conditions:
    Last Transition Time:  2018-12-14T02:44:30Z
    Last Update Time:      2018-12-14T02:44:30Z
    Status:                True
    Type:                  SamplesExist
    Last Transition Time:  2018-12-14T02:54:43Z
    Last Update Time:      2018-12-14T02:54:43Z
    Status:                True
    Type:                  ImportCredentialsExists
    Last Transition Time:  2018-12-14T06:09:24Z
    Last Update Time:      2018-12-14T06:09:24Z
    Message:               cannot change architectures from []string{"ppc64le"} to []string{"x86_64"}
    Status:                False
    Type:                  ConfigurationValid
    Last Transition Time:  2018-12-14T03:32:54Z
    Last Update Time:      2018-12-14T03:32:54Z
    Status:                False
    Type:                  ChangesInProgress
    Last Transition Time:  2018-12-13T05:16:13Z
    Last Update Time:      2018-12-13T05:16:13Z
    Status:                False
    Type:                  PendingRemove
  Install Type:            centos
  Management State:        Managed
Events:                    <none>


$ oc describe clusteroperator  openshift-cluster-samples-operator 
Name:         openshift-cluster-samples-operator
Namespace:    
Labels:       <none>
Annotations:  <none>
API Version:  config.openshift.io/v1
Kind:         ClusterOperator
Metadata:
  Creation Timestamp:  2018-12-13T05:16:16Z
  Generation:          1
  Resource Version:    1324564
  Self Link:           /apis/config.openshift.io/v1/clusteroperators/openshift-cluster-samples-operator
  UID:                 378c4e9f-fe96-11e8-8c40-0aaa93c407fa
Spec:
Status:
  Conditions:
    Last Transition Time:  2018-12-14T06:09:27Z
    Message:               The samples operator configuration is invalid
    Status:                True
    Type:                  Failing
    Last Transition Time:  2018-12-14T03:32:58Z
    Message:               The samples operator is not in the process of initiating changes to the imagestreams
    Status:                False
    Type:                  Progressing
    Last Transition Time:  2018-12-14T02:44:33Z
    Message:               Samples exist in the openshift project
    Status:                True
    Type:                  Available
  Extension:               <nil>
  Version:                 
Events:                    <none>


Expected results:
Should forbidden update samplesresources.status

Additional info:
The warning message should be more simple.
cannot change architectures from []string{"ppc64le"} to []string{"x86_64"}

Comment 1 Ben Parees 2018-12-14 14:39:33 UTC
Gabe I can give you some guidance on this, you're not going to be able to fix it until we move off the operator SDK though.

Comment 2 Gabe Montero 2019-01-08 20:40:22 UTC
@Ben - now that we have a non-SDK version cooking (even if not merged yet), is it time to go over that guidance 
you mentioned last month?

Or do we want to punt on this for 4.0 ?

Comment 3 Ben Parees 2019-01-08 20:44:11 UTC
I'd like to fix it, it's relatively simple.  But let's not add it to your current in flight PR.

you can see a general idea of the things that are involved here:
https://github.com/openshift/cluster-image-registry-operator/pull/118

1) add status subresource to CRD definition
2) add rbac rules so your operator can edit the status subresource
3) when you want to update the status fields, you need to call UpdateStatus instead of Update

Comment 4 Gabe Montero 2019-01-11 01:15:02 UTC
PR https://github.com/openshift/cluster-samples-operator/pull/77 is up

Comment 5 Gabe Montero 2019-01-11 23:45:20 UTC
PR has merged

Comment 6 XiuJuan Wang 2019-01-14 10:06:22 UTC
Can't reproduce this bug. Couldn't update status of configs.samples.operator.openshift.io.

oc get clusterversion 
NAME      VERSION                           AVAILABLE   PROGRESSING   SINCE     STATUS
version   4.0.0-0.alpha-2019-01-14-015843   True        False         37m       Cluster version is 4.0.0-0.alpha-2019-01-14-015843

configs.samples.operator.openshift.io 4.0.0-alpha1-f76f4f23b

Comment 9 errata-xmlrpc 2019-06-04 10:41:16 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, 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/RHBA-2019:0758


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