Skip to content

Conversation

@atiratree
Copy link
Member

@atiratree atiratree commented Jul 9, 2019

used by kubevirt and newly metal3 (#1967)

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 9, 2019
@spadgett spadgett added this to the v4.2 milestone Jul 9, 2019
@atiratree
Copy link
Member Author

/test e2e-aws-console-olm
/test e2e-aws

Copy link
Member

Choose a reason for hiding this comment

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

It's not clear to me how this is used, but it's not unique across types. Is there a reason to avoid simply using the UID?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 on favoring UID over a composite ID that may not be unique.

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like an unaddressed comment, unless I'm missing something.

Copy link
Member Author

Choose a reason for hiding this comment

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

added the UID selector by default

@atiratree atiratree force-pushed the lookupUtils branch 2 times, most recently from 74b4b3c to d849f27 Compare July 9, 2019 19:58
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 9, 2019
@atiratree
Copy link
Member Author

/test e2e-aws

Copy link
Contributor

Choose a reason for hiding this comment

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

If there's just one file, why not simply put code here instead of adding another utils.ts file?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the need for more utils will come as time goes on, so I think it is better to start folder for that in the beginning.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, fair enough.

Copy link
Contributor

Choose a reason for hiding this comment

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

getLookupID fits the signature of KeyResolver, we could use it here.

Also, do we really need to go overboard with generics here?

Can't we just have K8sEntityMap working with <A extends K8sResourceKind> directly? (i.e. do we need to work with objects that aren't structurally compatible with K8sResourceKind?)

Copy link
Member Author

Choose a reason for hiding this comment

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

getLookupID fits the signature of KeyResolver, we could use it here.

I tried, but failed - we need the generic type A for entity and make it compatible with createLookup

Also, do we really need to go overboard with generics here?

I think it is quite useful to have the exact type returned of entity the lookup was created for (especial once we get in #1813)

Can't we just have K8sEntityMap working with directly? (i.e. do we need to work with objects that aren't structurally compatible with K8sResourceKind?)

we have many other use cases of inner lists which are not structurally compatible with K8sResourceKind, e.g. https://github.com/openshift/console/blob/master/frontend/packages/kubevirt-plugin/src/components/vm-disks/vm-disks.tsx#L63

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, thanks for clarification.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 on favoring UID over a composite ID that may not be unique.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like an unaddressed comment, unless I'm missing something.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, thanks for clarification.

@atiratree atiratree force-pushed the lookupUtils branch 2 times, most recently from c16b78e to 338a5fd Compare July 15, 2019 19:02
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to also change signature of these selectors to be compatible with the lookup generics

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, that's what I meant by being careful with TS generics, since it might force us to add generic type signatures to all code related to e.g. createLookup stuff.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, that's what I meant by being careful with TS generics, since it might force us to add generic type signatures to all code related to e.g. createLookup stuff.

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 15, 2019
@vojtechszocs
Copy link
Contributor

LGTM - I hope this also addresses Sam's comment #1966 (comment).

@vojtechszocs
Copy link
Contributor

@suomiy When dealing with TS generics, it's always a good idea to think about generic type param fallbacks, for example:

type Foo<T> = (obj: T) => string;
// when using Foo, you *always* need to provide type param T
type Bar<T = any> = Foo<T>;
// when using Bar, you *may* provide type param T to narrow down the signature

@vojtechszocs
Copy link
Contributor

/approve cancel

Needs Sam's look.

@openshift-ci-robot openshift-ci-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 15, 2019
@vojtechszocs
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 15, 2019
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 15, 2019
@atiratree
Copy link
Member Author

@suomiy When dealing with TS generics, it's always a good idea to think about generic type param fallbacks, for example:

type Foo<T> = (obj: T) => string;
// when using Foo, you *always* need to provide type param T
type Bar<T = any> = Foo<T>;
// when using Bar, you *may* provide type param T to narrow down the signature

thanks, added the K8sResourceKind as a fallback

@atiratree
Copy link
Member Author

/test e2e-aws-console
/test e2e-aws-console-olm

@atiratree
Copy link
Member Author

/test e2e-aws-console

@vojtechszocs
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 16, 2019
@openshift-ci-robot openshift-ci-robot removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 17, 2019
@rawagner
Copy link
Contributor

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rawagner, suomiy, vojtechszocs

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

@atiratree
Copy link
Member Author

/test e2e-aws

1 similar comment
@atiratree
Copy link
Member Author

/test e2e-aws

@atiratree
Copy link
Member Author

/retest

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-ci-robot
Copy link
Contributor

@suomiy: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-aws ae3845e link /test e2e-aws
ci/prow/e2e-aws-console-olm ae3845e link /test e2e-aws-console-olm
ci/prow/e2e-aws-console ae3845e link /test e2e-aws-console

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

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 ae3845e into openshift:master Jul 17, 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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants