Skip to content

add ExtPodKind type - #3021

Merged
openshift-merge-robot merged 1 commit into
openshift:masterfrom
sahil143:pod-types
Oct 24, 2019
Merged

add ExtPodKind type#3021
openshift-merge-robot merged 1 commit into
openshift:masterfrom
sahil143:pod-types

Conversation

@sahil143

Copy link
Copy Markdown
Contributor

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 18, 2019
@openshift-ci-robot openshift-ci-robot added component/core Related to console core functionality component/dev-console Related to dev-console component/shared Related to console-shared labels Oct 18, 2019
@sahil143

Copy link
Copy Markdown
Contributor Author

/cc @christianvogt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These selectors are valid for deployment configs. They just aren't type Selector.

See my change in #3017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Newer resources like ReplicaSet use the new format of selector described by type Selector. Older resources use a generic name/value map.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We'll eventually have a DeploymentConfigKind with

selector: MatchLabels;

and a ReplicaSetKind with

selector: Selector;

which is why I'd rather not overload what the Selector types means.

I'd like to phase out K8sResourceKind in the long run in favor of specific type declarations. For unknown types, we can have a more restrictive type like UnknownK8sResource that only allows the common properties we always expect like object metadata.

The project is large enough that I think we'd really benefit from better type checking. We've caught bugs already as we've tightened down the types we have.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@spadgett Yes, I agree with your comments, these selectors are valid just not type Selector. I removed these because they are mock data and selector is not being used in the tests specifically.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But they're required for deployment configs. When we add a DeploymentConfigKind type, we're going to have to add these back. It's better to leave these as-is and go with the change in #3017.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is existing code, but I dislike that this method returns something claiming to be a pod that's not. The replication controller spec and status have completely different properties than pod spec and status. At this point, I'd almost rather admit this is something completely made up and call it any. It's not a K8sResourceKind.

Can we revisit how we're handling this? It would be better to avoid creating imaginary types. I have a feeling this is going to lead to bugs down the road.

How are these ExtPodKind resources used? What scenario are we handling here and below, and how is it displayed in the UI?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We use these to show status on Pod Donuts in topology view. Here Autoscaled is used to show Autoscaled to 0 on pod donut for knative deployments similarly getIdledStatus is also used to show Idled status on the pod donuts.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What happens in the details pages for these resources? Does this only work in the topology view?

It seems like this logic should be in the pod donut, not here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To be fair @sahil143 did mention originally that it was going to be a larger change to fix the type issue. I suggested that a quick solution might be to extend the type and return the pod phases back to their original. At the time I thought these types were blocking your work on improving the types. Only later did I see you were able to get around it.

If we're ok with the slower turn around time (ie possibly past 4.3 feature freeze) then your suggestion makes sense to move the logic to the donut itself where it can interpret multiple values to create the visualization instead of relying on made up data to fit the poor needs of the donut.

@sahil143 sahil143 Oct 21, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@spadgett Yes, These are also being used in the details page for resources as there is pod donut in Overview for both admin and topology view.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, I don't mean to harp on this point :) As long as this works in other contexts like the details pages and admin console workloads tab, I'm good with the short term change.

@christianvogt

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 23, 2019
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 23, 2019
@christianvogt

Copy link
Copy Markdown
Contributor

/retest

@christianvogt

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 24, 2019
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, 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-merge-robot
openshift-merge-robot merged commit 3c848ba into openshift:master Oct 24, 2019
@spadgett spadgett added this to the v4.3 milestone Oct 24, 2019
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/core Related to console core functionality component/dev-console Related to dev-console component/shared Related to console-shared 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.

5 participants