Skip to content

Add bindable resources endpoint #877

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

Conversation

piotrmiskiewicz
Copy link
Member

Description

Changes proposed in this pull request:

  • add bindableResources endpoint which returns all resources for all usage kinds in given environemnt
  • bump k8s client-go version 1.11.3

@piotrmiskiewicz piotrmiskiewicz force-pushed the resources-for-all-usagekind branch from d188919 to af5d46e Compare September 24, 2018 07:06
@piotrmiskiewicz piotrmiskiewicz added WIP area/service-management Issues or PRs related to service management kind/feature Categorizes issue or PR as related to a new feature. labels Sep 24, 2018
@piotrmiskiewicz piotrmiskiewicz force-pushed the resources-for-all-usagekind branch 2 times, most recently from 4d2e1d3 to 98df9c3 Compare September 24, 2018 09:01
@mszostok mszostok self-assigned this Sep 24, 2018
Copy link
Contributor

@mszostok mszostok left a comment

Choose a reason for hiding this comment

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

LGTM, I've tested it on goher cluster and it works like a charm :)

NOTE: IMO we need to inform guys from UI that entry will be returned even if the resources field is empty.
e.g.

{
  "data": {
    "bindableResources": [
      {
        "kind": "function",
        "resources": []
      },
      {
        "kind": "deployment",
        "resources": [
          {
            "name": "api-controller",
            "namespace": "kyma-system"
          },
}

so on the UI probably they should not display this entry

func (rsv *bindableResourcesResolver) ListBindableResources(ctx context.Context, environment string) ([]gqlschema.BindableResourcesOutputItem, error) {
res, err := rsv.lister.ListResources(environment)
if err != nil {
glog.Error(errors.Wrapf(err, "while listing %s for %s `%s` in environment `%s`", pretty.BindableResources, pretty.UsageKind, environment))
Copy link
Contributor

Choose a reason for hiding this comment

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

to much %s

)

func TestBindableResourcesResolver_ListBindableResources(t *testing.T) {
svc := automock.NewBindableResourcesLister()
Copy link
Contributor

Choose a reason for hiding this comment

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

missing // GIVEN

dynamicClient usageKindDynamicOperations
client v1alpha12.ServicecatalogV1alpha1Interface
informer cache.SharedIndexInformer
resourceInterface dynamic.Interface
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe more like dynamicCli

results := make([]gqlschema.BindableResourcesOutputItem, 0)
usageKinds := svc.informer.GetStore().List()
for _, item := range usageKinds {
uk := item.(*v1alpha1.UsageKind)
Copy link
Contributor

Choose a reason for hiding this comment

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

let's add checking the UK casting
uk, ok := item.(*v1alpha1.UsageKind)
thanks to that it will be more robust

@mszostok mszostok removed their assignment Sep 24, 2018
@piotrmiskiewicz piotrmiskiewicz force-pushed the resources-for-all-usagekind branch from 98df9c3 to a5e523f Compare September 25, 2018 10:52
@piotrmiskiewicz piotrmiskiewicz force-pushed the resources-for-all-usagekind branch from a5e523f to 7969186 Compare September 25, 2018 11:00
@piotrmiskiewicz piotrmiskiewicz merged commit 1034c10 into kyma-project:master Sep 26, 2018
@piotrmiskiewicz piotrmiskiewicz deleted the resources-for-all-usagekind branch July 22, 2019 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/service-management Issues or PRs related to service management kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants