Skip to content

Conversation

@sahil143
Copy link
Contributor

@sahil143 sahil143 commented Dec 2, 2019

ODC Bug: https://jira.coreos.com/browse/ODC-1412

This PR updates the logic to get the active replication controller.
Steps:

  1. Get all the RCs for a resource.
  2. Sort them based on the revision.
  3. Get the first RC(most recent) from the sorted list to add the alerts if it's failed or canceled
  4. filter out the RCs based on status.replicas or if an RC is in New, Pending, Running or Complete phase to determine active RCs.

using the logic from 3.11 code: https://github.com/openshift/origin-web-console/blob/enterprise-3.11/app/scripts/controllers/overview.js#L785-L831

fix recent Rc to not be failed/canceled

add warnings for latest RC

remove console

rmeove comments
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. component/shared Related to console-shared labels Dec 2, 2019
@sahil143
Copy link
Contributor Author

sahil143 commented Dec 2, 2019

/cc @christianvogt @spadgett

@sahil143 sahil143 changed the title update Active RC logic to not show Failed deployments Bug Bugzilla 1760828update Active RC logic to not show Failed deployments Dec 2, 2019
@sahil143 sahil143 changed the title Bug Bugzilla 1760828update Active RC logic to not show Failed deployments Bug 1760828:update Active RC logic to not show Failed deployments Dec 2, 2019
@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Dec 2, 2019
@openshift-ci-robot
Copy link
Contributor

@sahil143: This pull request references Bugzilla bug 1760828, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Bug 1760828:update Active RC logic to not show Failed deployments

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.

@sahil143 sahil143 changed the title Bug 1760828:update Active RC logic to not show Failed deployments Bug 1760828: update Active RC logic to not show Failed deployments Dec 2, 2019
@christianvogt
Copy link
Contributor

@spadgett Could you please have a look at this as you're much more familiar with the scenario.

@christianvogt
Copy link
Contributor

Seems to work in showing the correct data:
image

@openshift-ci-robot
Copy link
Contributor

@sahil143: This pull request references Bugzilla bug 1760828, which is valid.

Details

In response to this:

Bug 1760828: update Active RC logic to not show Failed deployments

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.

1 similar comment
@openshift-ci-robot
Copy link
Contributor

@sahil143: This pull request references Bugzilla bug 1760828, which is valid.

Details

In response to this:

Bug 1760828: update Active RC logic to not show Failed deployments

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.

};

const isReplicationControllerVisible = (resource: K8sResourceKind): boolean => {
return _.get(resource, ['status', 'replicas'], false) || deploymentIsInProgress(resource);
Copy link
Contributor

Choose a reason for hiding this comment

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

we could simply do

Suggested change
return _.get(resource, ['status', 'replicas'], false) || deploymentIsInProgress(resource);
return _.get(resource, ['status', 'replicas'], deploymentIsInProgress(resource));

Copy link
Member

Choose a reason for hiding this comment

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

The return type is lying here since it might return a number instead of a boolean.

Suggested change
return _.get(resource, ['status', 'replicas'], false) || deploymentIsInProgress(resource);
return !!_.get(resource, ['status', 'replicas']) || deploymentIsInProgress(resource);

Copy link
Member

Choose a reason for hiding this comment

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

Won't this return true for all previous "complete" deployments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in e0d1c43

};

const getDeploymentConfigName = (obj: K8sResourceKind): string => {
return getAnnotation(obj, DEPLOYMENT_CONFIG_NAME_ANNOTATION);
Copy link
Member

Choose a reason for hiding this comment

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

You should use metadata.ownerReferences instead of the annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in e0d1c43

DEPLOYMENT_PHASE.new,
DEPLOYMENT_PHASE.pending,
DEPLOYMENT_PHASE.running,
DEPLOYMENT_PHASE.complete,
Copy link
Member

Choose a reason for hiding this comment

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

Why is complete considered in progress?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we are looking for all phases except for failed or canceled and choose the first two from that filtered array i.e. current and previous. Seems like method name is misleading changed it to isDeploymentInProgressOrCompleted.

return notFailedOrCancelled && previous && previous.pods.length > 0;
};

const deploymentIsInProgress = (resource: K8sResourceKind): boolean => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const deploymentIsInProgress = (resource: K8sResourceKind): boolean => {
const isDeploymentInProgress = (resource: K8sResourceKind): boolean => {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in e0d1c43

};

const isReplicationControllerVisible = (resource: K8sResourceKind): boolean => {
return _.get(resource, ['status', 'replicas'], false) || deploymentIsInProgress(resource);
Copy link
Member

Choose a reason for hiding this comment

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

The return type is lying here since it might return a number instead of a boolean.

Suggested change
return _.get(resource, ['status', 'replicas'], false) || deploymentIsInProgress(resource);
return !!_.get(resource, ['status', 'replicas']) || deploymentIsInProgress(resource);

};

const isReplicationControllerVisible = (resource: K8sResourceKind): boolean => {
return _.get(resource, ['status', 'replicas'], false) || deploymentIsInProgress(resource);
Copy link
Member

Choose a reason for hiding this comment

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

Won't this return true for all previous "complete" deployments?

@karthikjeeyar
Copy link
Contributor

Verified locally, It works fine
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 17, 2019
@christianvogt
Copy link
Contributor

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, karthikjeeyar, sahil143

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

The pull request process is described here

Details 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 openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 19, 2019
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

15 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@spadgett
Copy link
Member

/hold
e2e-gcp-console is currently broken

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 21, 2019
@andrewballantyne
Copy link
Contributor

/kind bug

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 2, 2020
@spadgett
Copy link
Member

spadgett commented Jan 2, 2020

/hold cancel
/retest
#3847 has fixed the e2e tests

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 2, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

4 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 88da676 into openshift:master Jan 3, 2020
@openshift-ci-robot
Copy link
Contributor

@sahil143: All pull requests linked via external trackers have merged. Bugzilla bug 1760828 has been moved to the MODIFIED state.

Details

In response to this:

Bug 1760828: update Active RC logic to not show Failed deployments

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.

@spadgett spadgett added this to the v4.4 milestone Jan 3, 2020
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. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/shared Related to console-shared kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants