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

Bug 1830841: updates api-endpoint to fetch event sources and update default sources #5270

Merged

Conversation

invincibleJai
Copy link
Member

@invincibleJai invincibleJai commented May 4, 2020

Fixes:
https://issues.redhat.com/browse/ODC-3683
https://issues.redhat.com/browse/ODC-3775

Analysis / Root cause:
Currently fetching dynamic sources with making direct call to CRD with version v1beta based on label selector ducktype

Solution Description:
Update ApiEnd point to fetch CRDs for event sources (api using CRD version "v1") i.e api/console/knative-event-sources and return Default Sources in order

Screen shots / Gifs for design review:
May-04-2020 11-03-36

Screenshot 2020-05-04 at 11 04 46 AM

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels May 4, 2020
@openshift-ci-robot
Copy link
Contributor

@invincibleJai: This pull request references Bugzilla bug 1830841, 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.

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

In response to this:

Bug 1830841: updates api-endpoint to fetch event sources and update default sources

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 added the component/knative Related to knative-plugin label May 4, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 4, 2020
@invincibleJai invincibleJai force-pushed the fix-default-sources branch 2 times, most recently from bbd38a4 to 1b56df7 Compare May 5, 2020 15:18
@sahil143
Copy link
Contributor

sahil143 commented May 5, 2020

New API is working fine for both consoledeveloper(basic user) and kubeadmin when logged in using the cluster URL and on the localhost, API is throwing 403 forbidden error status for consoledeveloper user but works fine for kubeadmin.

Screenshot from 2020-05-05 23-17-12

@invincibleJai @abhi-kn

@abhi-kn
Copy link
Contributor

abhi-kn commented May 5, 2020

New API is working fine for both consoledeveloper(basic user) and kubeadmin when logged in using the cluster URL and on the localhost, API is throwing 403 forbidden error status for consoledeveloper user but works fine for kubeadmin.

Screenshot from 2020-05-05 23-17-12

@invincibleJai @abhi-kn

@sahil143 This is an expected behaviour. In off-cluster mode, user token will be used & hence user need to be authorised to verify this API. Whereas for in-cluster mode, service account is used & it has RBAC to authorise for unprivileged users. Ref - #4945

Comment on lines 64 to 79
const modelData = version
? {
apiGroup: group,
apiVersion: version,
kind,
plural,
id: singular,
label: singular,
labelPlural: plural,
abbr: kindToAbbr(kind),
namespaced: true,
crd: true,
color: knativeEventingColor.value,
}
: {};
return [...accumulator, modelData];
Copy link
Contributor

Choose a reason for hiding this comment

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

Its better to just push instead of spreading the array in these scenarios. Its much faster that spreading and does not create a whole new array again every time.

Suggested change
const modelData = version
? {
apiGroup: group,
apiVersion: version,
kind,
plural,
id: singular,
label: singular,
labelPlural: plural,
abbr: kindToAbbr(kind),
namespaced: true,
crd: true,
color: knativeEventingColor.value,
}
: {};
return [...accumulator, modelData];
if (version) {
accumulator.push({
apiGroup: group,
apiVersion: version,
kind,
plural,
id: singular,
label: singular,
labelPlural: plural,
abbr: kindToAbbr(kind),
namespaced: true,
crd: true,
color: knativeEventingColor.value,
});
}
return accumulator;

Copy link
Contributor

Choose a reason for hiding this comment

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

The older approach also has a problem where you would add empty objects to the accumulator when there is no version available. So your final array would look some thing like [model1, model2, {}, {}]

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Rohit. Sorry, I missed this in my review.

Copy link
Member Author

Choose a reason for hiding this comment

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

@rohitkrai03 @sahil143 updated PTAL

Copy link
Contributor

@sahil143 sahil143 left a comment

Choose a reason for hiding this comment

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

/lgtm

verified changes locally

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 6, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: invincibleJai, sahil143

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-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.

@invincibleJai
Copy link
Member Author

/retest

@openshift-merge-robot openshift-merge-robot merged commit 84fa90e into openshift:master May 6, 2020
@openshift-ci-robot
Copy link
Contributor

@invincibleJai: All pull requests linked via external trackers have merged: openshift/console#5270. Bugzilla bug 1830841 has been moved to the MODIFIED state.

In response to this:

Bug 1830841: updates api-endpoint to fetch event sources and update default sources

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
Copy link
Contributor

@invincibleJai: Bugzilla bug 1830841 is in an unrecognized state (MODIFIED) and will not be moved to the MODIFIED state.

In response to this:

Bug 1830841: updates api-endpoint to fetch event sources and update default sources

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.5 milestone May 11, 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/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/knative Related to knative-plugin 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