Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPBUGS-14149: account for single object in status.conditions instead… #12866

Merged
merged 1 commit into from Jun 1, 2023

Conversation

rhamilto
Copy link
Member

@rhamilto rhamilto commented May 30, 2023

… of an array of objects

Kepler operands return a single object for status.conditions [1] instead of an array of objects. This fix accounts for this unexpected behavior from the operand.

[1]

apiVersion: kepler.system.sustainable.computing.io/v1alpha1
kind: Kepler
metadata:
  creationTimestamp: '2023-05-30T18:04:03Z'
  generation: 1
  labels:
    app.kubernetes.io/created-by: kepler-operator
    app.kubernetes.io/instance: kepler
    app.kubernetes.io/managed-by: kustomize
    app.kubernetes.io/name: kepler
    app.kubernetes.io/part-of: kepler-operator
  managedFields:
    - apiVersion: kepler.system.sustainable.computing.io/v1alpha1
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:labels':
            .: {}
            'f:app.kubernetes.io/created-by': {}
            'f:app.kubernetes.io/instance': {}
            'f:app.kubernetes.io/managed-by': {}
            'f:app.kubernetes.io/name': {}
            'f:app.kubernetes.io/part-of': {}
        'f:spec':
          .: {}
          'f:collector':
            .: {}
            'f:collectorPort': {}
            'f:image': {}
      manager: Mozilla
      operation: Update
      time: '2023-05-30T18:04:03Z'
    - apiVersion: kepler.system.sustainable.computing.io/v1alpha1
      fieldsType: FieldsV1
      fieldsV1:
        'f:status':
          .: {}
          'f:conditions':
            .: {}
            'f:lastTransitionTime': {}
            'f:message': {}
            'f:reason': {}
            'f:status': {}
            'f:type': {}
      manager: manager
      operation: Update
      subresource: status
      time: '2023-05-30T18:04:05Z'
  name: kepler
  namespace: openshift-operators
  resourceVersion: '10230'
  uid: 396ce277-db6c-4800-b87d-e8e278c6b68b
spec:
  collector:
    collectorPort: 9103
    image: 'quay.io/sustainable_computing_io/kepler:release-0.4'
status:
  conditions:
    lastTransitionTime: '2023-05-30T18:04:03Z'
    message: Reconcile complete
    reason: ReconcileComplete
    status: 'True'
    type: Reconciled

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 30, 2023
@openshift-ci-robot
Copy link
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-14149, which is invalid:

  • expected the bug to target the "4.14.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

… of an array of objects

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot added component/olm Related to OLM approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 30, 2023
@openshift-ci-robot
Copy link
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-14149, which is invalid:

  • expected the bug to target the "4.14.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

… of an array of objects

Kepler operands return a single object for status.conditions [1] instead of an array of objects. This fix accounts for this unexpected behavior from the operand.

[1]

apiVersion: kepler.system.sustainable.computing.io/v1alpha1
kind: Kepler
metadata:
 creationTimestamp: '2023-05-30T18:04:03Z'
 generation: 1
 labels:
   app.kubernetes.io/created-by: kepler-operator
   app.kubernetes.io/instance: kepler
   app.kubernetes.io/managed-by: kustomize
   app.kubernetes.io/name: kepler
   app.kubernetes.io/part-of: kepler-operator
 managedFields:
   - apiVersion: kepler.system.sustainable.computing.io/v1alpha1
     fieldsType: FieldsV1
     fieldsV1:
       'f:metadata':
         'f:labels':
           .: {}
           'f:app.kubernetes.io/created-by': {}
           'f:app.kubernetes.io/instance': {}
           'f:app.kubernetes.io/managed-by': {}
           'f:app.kubernetes.io/name': {}
           'f:app.kubernetes.io/part-of': {}
       'f:spec':
         .: {}
         'f:collector':
           .: {}
           'f:collectorPort': {}
           'f:image': {}
     manager: Mozilla
     operation: Update
     time: '2023-05-30T18:04:03Z'
   - apiVersion: kepler.system.sustainable.computing.io/v1alpha1
     fieldsType: FieldsV1
     fieldsV1:
       'f:status':
         .: {}
         'f:conditions':
           .: {}
           'f:lastTransitionTime': {}
           'f:message': {}
           'f:reason': {}
           'f:status': {}
           'f:type': {}
     manager: manager
     operation: Update
     subresource: status
     time: '2023-05-30T18:04:05Z'
 name: kepler
 namespace: openshift-operators
 resourceVersion: '10230'
 uid: 396ce277-db6c-4800-b87d-e8e278c6b68b
spec:
 collector:
   collectorPort: 9103
   image: 'quay.io/sustainable_computing_io/kepler:release-0.4'
status:
 conditions:
   lastTransitionTime: '2023-05-30T18:04:03Z'
   message: Reconcile complete
   reason: ReconcileComplete
   status: 'True'
   type: Reconciled

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@rhamilto
Copy link
Member Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label May 30, 2023
@openshift-ci-robot
Copy link
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-14149, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.14.0) matches configured target version for branch (4.14.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @yapei

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label May 30, 2023
@openshift-ci openshift-ci bot requested a review from yapei May 30, 2023 18:07
const trueConditions = conditions?.filter((c: K8sResourceCondition) => c.status === 'True');
const conditionsIsObject =
typeof conditions === 'object' && !Array.isArray(conditions) && conditions !== null;
const conditionsArray = conditionsIsObject ? [conditions] : conditions;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditionsArray name can be misleading because it could be null (or even a string if conditions can be a string or other non-object type).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, @stleerh. How do you feel about formattedConditions instead? Still not great...

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 30, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhamilto, stleerh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD b454f29 and 2 for PR HEAD 9c03b0f in total

@rhamilto
Copy link
Member Author

/retest

2 similar comments
@rhamilto
Copy link
Member Author

/retest

@rhamilto
Copy link
Member Author

/retest

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD c85d678 and 1 for PR HEAD 9c03b0f in total

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 1, 2023

@rhamilto: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 541738b into openshift:master Jun 1, 2023
6 checks passed
@openshift-ci-robot
Copy link
Contributor

@rhamilto: Jira Issue OCPBUGS-14149: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-14149 has been moved to the MODIFIED state.

In response to this:

… of an array of objects

Kepler operands return a single object for status.conditions [1] instead of an array of objects. This fix accounts for this unexpected behavior from the operand.

[1]

apiVersion: kepler.system.sustainable.computing.io/v1alpha1
kind: Kepler
metadata:
 creationTimestamp: '2023-05-30T18:04:03Z'
 generation: 1
 labels:
   app.kubernetes.io/created-by: kepler-operator
   app.kubernetes.io/instance: kepler
   app.kubernetes.io/managed-by: kustomize
   app.kubernetes.io/name: kepler
   app.kubernetes.io/part-of: kepler-operator
 managedFields:
   - apiVersion: kepler.system.sustainable.computing.io/v1alpha1
     fieldsType: FieldsV1
     fieldsV1:
       'f:metadata':
         'f:labels':
           .: {}
           'f:app.kubernetes.io/created-by': {}
           'f:app.kubernetes.io/instance': {}
           'f:app.kubernetes.io/managed-by': {}
           'f:app.kubernetes.io/name': {}
           'f:app.kubernetes.io/part-of': {}
       'f:spec':
         .: {}
         'f:collector':
           .: {}
           'f:collectorPort': {}
           'f:image': {}
     manager: Mozilla
     operation: Update
     time: '2023-05-30T18:04:03Z'
   - apiVersion: kepler.system.sustainable.computing.io/v1alpha1
     fieldsType: FieldsV1
     fieldsV1:
       'f:status':
         .: {}
         'f:conditions':
           .: {}
           'f:lastTransitionTime': {}
           'f:message': {}
           'f:reason': {}
           'f:status': {}
           'f:type': {}
     manager: manager
     operation: Update
     subresource: status
     time: '2023-05-30T18:04:05Z'
 name: kepler
 namespace: openshift-operators
 resourceVersion: '10230'
 uid: 396ce277-db6c-4800-b87d-e8e278c6b68b
spec:
 collector:
   collectorPort: 9103
   image: 'quay.io/sustainable_computing_io/kepler:release-0.4'
status:
 conditions:
   lastTransitionTime: '2023-05-30T18:04:03Z'
   message: Reconcile complete
   reason: ReconcileComplete
   status: 'True'
   type: Reconciled

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@rhamilto rhamilto deleted the OCPBUGS-14149 branch June 1, 2023 12:24
@husky-parul
Copy link

@rhamilto is there a way to test the merged changes. For e.g. could ask cluster-bot to launch a cluster by sourcing from a branch but I am not sure if there is a way to do it for opeshift/console?

@rhamilto
Copy link
Member Author

rhamilto commented Jun 1, 2023

/cherry-pick release-4.13

@openshift-cherrypick-robot

@rhamilto: new pull request created: #12875

In response to this:

/cherry-pick release-4.13

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@rhamilto
Copy link
Member Author

rhamilto commented Jun 1, 2023

@rhamilto is there a way to test the merged changes. For e.g. could ask cluster-bot to launch a cluster by sourcing from a branch but I am not sure if there is a way to do it for opeshift/console?

Since this fix has merged, cluster bot should automatically include it in any default clusters it creates.

@husky-parul
Copy link

husky-parul commented Jun 1, 2023

I've just launched a cluster but I still the error

OpenShift version: 4.14.0-0.nightly-2023-05-31-080250
Kubernetes version: v1.27.2+15f19ea

image

@rhamilto
Copy link
Member Author

rhamilto commented Jun 1, 2023

I've just launched a cluster but I still the error

OpenShift version: 4.14.0-0.nightly-2023-05-31-080250
Kubernetes version: v1.27.2+15f19ea

I am guessing the fix is not available in the latest build available to clusterbot. I am not sure on the timing of such.

@rhamilto
Copy link
Member Author

rhamilto commented Jun 1, 2023

You can optionally build and run console locally by following https://github.com/openshift/console#quickstart.

@husky-parul
Copy link

Thanks I will TAL

@spadgett
Copy link
Member

spadgett commented Jun 1, 2023

OpenShift version: 4.14.0-0.nightly-2023-05-31-080250
Kubernetes version: v1.27.2+15f19ea

The fix isn't in a nightly yet. You can see the nightly change logs here: https://openshift-release.apps.ci.l2s4.p1.openshiftapps.com/#4.14.0-0.nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/olm Related to OLM jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants