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

[ServiceCatalog] Support $ref in JSON schema when creating service instances #362

Closed
arapulido opened this issue Jun 14, 2018 · 8 comments · Fixed by #373
Closed

[ServiceCatalog] Support $ref in JSON schema when creating service instances #362

arapulido opened this issue Jun 14, 2018 · 8 comments · Fixed by #373
Assignees
Labels
component/ui Issue related to kubeapps UI kind/bug An issue that reports a defect in an existing feature

Comments

@arapulido
Copy link
Contributor

I installed the GCP broker successfully and was able to browse the catalog, but when I tried to provision an instance of Cloud SQL - MySQL kubeapps only asked me for a name and then I got the following error:

Provision call failed: operation "projects/774136762833/operations/613f0c6f-6fd8-11e8-84d3-0a580a14020d/1528983987438762474" failed: generic::invalid_argument: Operation "operation-1528983987669-56e9a5373c808-85fbb4ea-f0547eb1" failed with : [{"code":"MANIFEST_EXPANSION_USER_ERROR","location":"/deployments/id2d9cfa0-1da6-49dc-a25a-02aed050eac4/manifests/manifest-1528983987754","message":"Manifest expansion encountered the following errors: Invalid properties for 'gcp-services/composite:cloud-sql-mysql-instance-f3622e2':\n'parameters' is a required property\n Resource: id2d9cfa0-1da6-49dc-a25a-02aed050eac4 Resource: config"}]
@arapulido
Copy link
Contributor Author

It looks like the plan has a Schema, but Kubeapps is not picking it up correctly.

This is the ClusterServicePlan yaml:

https://gist.github.com/arapulido/66c026043fbd88fe5e9b183afcc35288

@arapulido
Copy link
Contributor Author

arapulido commented Jun 14, 2018

Steps to deploy the GCP broker (I have only tried this on a GKE cluster)

  • Deploy the Service Catalog helm chart version v0.1.21 (prior versions have a bug with missing CA certs that prevents the GCP broker to work fine)
  • You need gcloud pointing to the project you want the GCP instances to be in
  • You need to add cluster-admin rights to your gcloud user:
    kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=$(gcloud config get-value account)
  • Download the sc tool (https://github.com/GoogleCloudPlatform/k8s-service-catalog/releases)
  • Run ./sc add-gcp-broker

@prydonius

@prydonius
Copy link
Contributor

Thanks @arapulido, I'll look into this. Do you have a screenshot of what you're seeing?

@arapulido
Copy link
Contributor Author

This is how it looks when you try to provision a mysql instance:

screen shot 2018-06-15 at 9 34 32 am

@arapulido
Copy link
Contributor Author

@prydonius I think the culprit is this: https://github.com/kubeapps/kubeapps/blob/master/dashboard/src/components/ProvisionButton/index.tsx#L57

In some cases (like Cloud SQL - MySQL) the description of the parameters is under schema.definitions and not directly under properties (https://gist.github.com/arapulido/66c026043fbd88fe5e9b183afcc35288#file-gistfile1-txt-L29).

We should check definitions as well

@prydonius
Copy link
Contributor

@arapulido good find, the actual issue looks like we're not properly supporting $ref, that schema you linked to doesn't have a properties object because it is referencing one of the definitions instead. We should parse the ref and find the definition, we'll also need to make sure react-jsonschema-form supports $ref and definitions also.

@arapulido arapulido changed the title [ServiceCatalog] GCP SQL instance provisioining failed [ServiceCatalog] Support $ref in JSON schema when creating service instances Jun 20, 2018
@prydonius prydonius self-assigned this Jun 21, 2018
@prydonius prydonius added kind/bug An issue that reports a defect in an existing feature component/ui Issue related to kubeapps UI labels Jun 21, 2018
@prydonius
Copy link
Contributor

I have modified the code so that the ServiceInstance name form is separate to the parameters prompt, which allows us to delegate the full schema from the API to the react-jsonschema-form component. This works and I'm now able to enter parameters for Cloud SQL.

screen shot 2018-06-21 at 16 44 55

However, once I hit provision now after entering the required parameter (Instance ID), I'm getting the following cryptic error.


Provision call failed: operation "projects/774136762833/operations/0a135197-75ab-11e8-b9ff-daf13f1b231d/1529624301754493680" failed: generic::invalid_argument: Operation "operation-1529624301928-56f2f6927fe40-c57545e1-62b01534" failed with : [{"code":"RESOURCE_ERROR","location":"/deployments/i191b77c7-7b59-4b5e-9561-26a51aae942d/resources/instance","message":"{\"ResourceType\":\"sqladmin.v1beta4.instance\",\"ResourceErrorCode\":\"400\",\"ResourceErrorMessage\":{\"code\":400,\"errors\":[{\"domain\":\"global\",\"message\":\"Invalid parameter: HostPort ()..\",\"reason\":\"invalid\"}],\"message\":\"Invalid parameter: HostPort ()..\",\"statusMessage\":\"Bad Request\",\"requestPath\":\"https://www.googleapis.com/sql/v1beta4/projects/bitnamigcetest2/instances\",\"httpMethod\":\"POST\"}}"}]
--

@prydonius
Copy link
Contributor

From what I can see in the docs (https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/insert), instance id and settings.tier are the only required attributes, so I'm not sure why this should be failing. Seems like a broker-specific issue though, so will file an issue upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/ui Issue related to kubeapps UI kind/bug An issue that reports a defect in an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants