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-13808: Console SDK components should be using GroupVersionKin… #12946

Merged
merged 1 commit into from Jul 14, 2023

Conversation

tvu20
Copy link
Contributor

@tvu20 tvu20 commented Jun 27, 2023

…d object

Fixes https://issues.redhat.com/browse/OCPBUGS-13808

Components in Console Dynamic Plugin SDK use new K8sGroupVersionKind object. Reference string still supported for backwards compatibility.

@openshift-ci-robot openshift-ci-robot added 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 Jun 27, 2023
@openshift-ci-robot
Copy link
Contributor

@tvu20: This pull request references Jira Issue OCPBUGS-13808, 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:

…d object

Fixes https://issues.redhat.com/browse/OCPBUGS-13808

Components in Console Dynamic Plugin SDK use new K8sGroupVersionKind object. Reference string still supported for backwards compatibility.

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/core Related to console core functionality component/sdk Related to console-plugin-sdk labels Jun 27, 2023
@tvu20
Copy link
Contributor Author

tvu20 commented Jun 27, 2023

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 27, 2023
@openshift-ci-robot
Copy link
Contributor

@tvu20: This pull request references Jira Issue OCPBUGS-13808, 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 openshift-ci bot requested a review from yapei June 27, 2023 14:47
@tvu20
Copy link
Contributor Author

tvu20 commented Jun 27, 2023

/retest

1 similar comment
@tvu20
Copy link
Contributor Author

tvu20 commented Jun 28, 2023

/retest

@jhadvig
Copy link
Member

jhadvig commented Jul 12, 2023

The code looks good 👍
Could you please also update the api docs for ListPageCreate component?

@tvu20
Copy link
Contributor Author

tvu20 commented Jul 12, 2023

/retest

1 similar comment
@tvu20
Copy link
Contributor Author

tvu20 commented Jul 12, 2023

/retest

…d object

Fixes https://issues.redhat.com/browse/OCPBUGS-13808

Components in Console Dynamic Plugin SDK use new `K8sGroupVersionKind` object. Reference string still supported for backwards compatibility.
@tvu20
Copy link
Contributor Author

tvu20 commented Jul 12, 2023

/retest

Copy link
Member

@jhadvig jhadvig left a comment

Choose a reason for hiding this comment

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

Nice job @tvu20 👍
/lgtm
/approve

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

openshift-ci bot commented Jul 13, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhadvig, tvu20

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

/retest-required

Remaining retests: 0 against base HEAD 07f4183 and 2 for PR HEAD b8778ca in total

@openshift-merge-robot openshift-merge-robot merged commit 200b9ec into openshift:master Jul 14, 2023
5 of 6 checks passed
@openshift-ci-robot
Copy link
Contributor

@tvu20: Jira Issue OCPBUGS-13808: All pull requests linked via external trackers have merged:

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

In response to this:

…d object

Fixes https://issues.redhat.com/browse/OCPBUGS-13808

Components in Console Dynamic Plugin SDK use new K8sGroupVersionKind object. Reference string still supported for backwards compatibility.

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.

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

Sorry to comment on a merged PR, but there is an issue with the implementation.

Comment on lines +100 to +102
const kind = typeof groupVersionKind !== 'string' ? groupVersionKind.kind : groupVersionKind;

const [k8sModel] = useK8sModel(kind);
Copy link
Member

Choose a reason for hiding this comment

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

This is incorrect, we need to be passing the API group and version as well to useK8sModel. We need to disambiguate between the same kind in different groups as well as different API versions.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like useK8sModel already takes a groupVersionKind, so maybe we don't need to change the code here.

https://github.com/openshift/console/blob/master/frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/hooks/useK8sModel.ts#L25

If so, it can still be useK8sModel(groupVersionKind) as before

@@ -691,7 +691,7 @@ const exampleList: React.FC<MyProps> = () => {

| Parameter Name | Description |
| -------------- | ----------- |
| `groupVersionKind` | the resource group/version/kind to represent |
| `groupVersionKind` | group, version, kind of k8s resource {@link K8sGroupVersionKind} is preferred alternatively can pass reference for group, version, kind which is deprecated i.e `group~version~kind` {@link K8sResourceKindReference}. |
Copy link
Member

Choose a reason for hiding this comment

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

We should document how to handle core resource like pod without a group as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Sam, I'm not sure what handle core resource like pod without a group is referring to. Can you give me an example of how to document this?

@@ -111,8 +113,8 @@ const ListPageCreate: React.FC<ListPageCreateProps> = ({
: `/k8s/cluster/${k8sModel.plural}/~new`;
if (k8sModel.crd) {
to = usedNamespace
? `/k8s/ns/${usedNamespace || 'default'}/${groupVersionKind}/~new`
: `/k8s/cluster/${groupVersionKind}/~new`;
? `/k8s/ns/${usedNamespace || 'default'}/${kind}/~new`
Copy link
Member

Choose a reason for hiding this comment

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

We want to make sure we're using the "reference" string here which is ~ delimited for resources in an API group.

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/sdk Related to console-plugin-sdk 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

5 participants