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

[DOCS] Document the use of environment variables that may be too sensitive to be kept in YAML #115

Open
omerbensaadon opened this issue Oct 16, 2020 · 6 comments
Labels
core broker documentation Improvements or additions to documentation help wanted The team has de-prioritized this and could use your help!

Comments

@omerbensaadon
Copy link
Contributor

A possible workaround: It appears that the client run-examples command accepts some parameters:

$ cloud-service-broker client run-examples --help
Run all examples generated by the use command through a
        provision/bind/unbind/deprovision cycle.

        Exits with a 0 if all examples were successful, 1 otherwise.

Usage:
  cloud-service-broker client run-examples [flags]

Flags:
      --example-name string   only run examples matching this name
      --filename string       json file that contains list of CompleteServiceExamples
  -h, --help                  help for run-examples
  -j, --jobs int              number of parallel client examples to run concurrently (default 1)
      --service-name string   name of the service to run tests for

Global Flags:
      --config string   Configuration file to be read

I suspect I can supply the test parameters using the --filename parameter, although there's no documentation about this option or what a CompleteServiceExamples might be. (I am guessing it is expecting a YAML block that corresponds to the examples block in the service YAML; will report back.)

This needs documentation!

Originally posted by @mogul in https://github.com/pivotal/cloud-service-broker/issue_comments/708887286

@mogul
Copy link
Contributor

mogul commented Oct 16, 2020

In the absence of these docs I'm trying to figure out how to use run-examples with --filename and haven't been successful...

My examples.json file looks like:

[
    {
       "name": "Operator in local k8s",
       "description": "Provision a SolrCloud operator in a local k8s",
       "service_name": "solr-operator",
       "service_id": "f145c5aa-4cee-4570-8a95-9a65f0d8d9da",
       "plan_id": "1779d7d5-874a-4352-b9c4-877be1f0745b",
       "provision_params": {
          "namespace": "default",
          "server": "https://kubernetes.docker.internal:6443",
          "cluster_ca_certificate": "YOUR_CERT",
          "token": "YOUR_TOKEN",
          "ingress_base_domain": "ing.local.domain"
       },
       "bind_params": {}
    },
    {
       "name": "Cloud in local k8s",
       "description": "Provision a SolrCloud instance in a local k8s",
       "service_name": "solr-cloud",
       "service_id": "b9013a91-9ce8-4c18-8035-a135a8cd6ff9",
       "plan_id": "e35e9675-413f-4f42-83de-ad5003357e77",
       "provision_params": {
          "namespace": "default",
          "server": "https://kubernetes.docker.internal:6443",
          "cluster_ca_certificate": "YOUR_CERT",
          "token": "YOUR_TOKEN",
          "ingress_base_domain": "ing.local.domain",
          "cloud_name": "example"
       },
       "bind_params": {}
    }
 ]

When I execute the command cloud-service-broker client run-examples --filename examples.json I get:

2020/10/16 17:05:24 Running Example: /Operator in local k8s
2020/10/16 17:05:24 cloud-service-broker client provision --instanceid "ex708449921-" --planid "1779d7d5-874a-4352-b9c4-877be1f0745b" --serviceid "" --params "[REDACTED]"
2020/10/16 17:05:24 cloud-service-broker client bind --instanceid "ex708449921-" --planid "1779d7d5-874a-4352-b9c4-877be1f0745b" --serviceid "" --bindingid "ex708449921" --params "{}"
2020/10/16 17:05:24 cloud-service-broker client unbind --instanceid "ex708449921-" --planid "1779d7d5-874a-4352-b9c4-877be1f0745b" --serviceid "" --bindingid "ex708449921"
2020/10/16 17:05:24 cloud-service-broker client deprovision --instanceid "ex708449921-" --planid "1779d7d5-874a-4352-b9c4-877be1f0745b" --serviceid ""
2020/10/16 17:05:24 Provisioning /Operator in local k8s
2020/10/16 17:05:24 PUT http://user:pass@broker:80/v2/service_instances/ex708449921-?accepts_incomplete=true -> 400, "{\"description\":\"service_id missing\"}\n"
2020/10/16 17:05:24 Cleaning up the environment
2020/10/16 17:05:24 Unbinding /Operator in local k8s
2020/10/16 17:05:24 DELETE http://user:pass@broker:80/v2/service_instances/ex708449921-/service_bindings/ex708449921?service_id=&plan_id=1779d7d5-874a-4352-b9c4-877be1f0745b -> 400, "{\"description\":\"service_id missing\"}\n"
2020/10/16 17:05:24 Deprovisioning /Operator in local k8s
2020/10/16 17:05:24 DELETE http://user:pass@broker:80/v2/service_instances/ex708449921-?accepts_incomplete=true&service_id=&plan_id=1779d7d5-874a-4352-b9c4-877be1f0745b -> 400, "{\"description\":\"service_id missing\"}\n"
2020/10/16 17:05:24 Error executing examples from file: Unexpected response code 400
make: *** [test] Error 1

You can see it's generating --serviceid "" in the output above. This is after I tried adding both service_name: and service_id: to the examples.json file; it seems to be ignoring those.

I haven't looked at the broker code yet to figure out what the broker is expecting. Any ideas?

mogul added a commit to GSA-TTS/datagov-brokerpak-solr that referenced this issue Oct 16, 2020
See cloudfoundry/cloud-service-broker#108 (comment)

This isn't working just yet...! See comments here:
cloudfoundry/cloud-service-broker#115 (comment)

In the meantime, there's an (in-progress) workaround in `make test-eden`.
mogul added a commit to GSA-TTS/datagov-brokerpak-solr that referenced this issue Oct 19, 2020
See cloudfoundry/cloud-service-broker#108 (comment)

This isn't working just yet...! See comments here:
cloudfoundry/cloud-service-broker#115 (comment)

In the meantime, there's an (in-progress) workaround in `make test-eden`.
@mogul
Copy link
Contributor

mogul commented Oct 19, 2020

I haven't looked at the broker code yet to figure out what the broker is expecting.

Here's a clue, from a file that's no longer in the repository:
https://github.com/pivotal/cloud-service-broker/blob/efb72c7f76e58a099e547476ce47acd9a60a951b/pkg/client/complete-service-examples-testfile.json#L8-L9

The JSON annotations here should result in those values also being populated from service_id and service_name but clearly that's not working... More digging needed!

@erniebilling
Copy link
Contributor

This isn't really what the examples section of the brokerpak were built for. To test situations that require sensitive information (especially that will be unique to your environment) we suggest using the cloud-service-broker client provision and cloud-service-broker client bind commands with the --params option to pass in unique/sensitive data.

@mogul
Copy link
Contributor

mogul commented Nov 5, 2020

We inspected the source and finally figured out what the JSON for the --filename parameter should look like. Here's an example:
https://github.com/GSA/datagov-brokerpak/blob/solr-cloud/examples.json-template

@erniebilling
Copy link
Contributor

Did this solve your problem @mogul ?

@mogul
Copy link
Contributor

mogul commented Nov 12, 2020

Yes it did! I do suggest documenting it.

mogul added a commit to GSA-TTS/datagov-brokerpak-solr that referenced this issue Nov 18, 2020
See cloudfoundry/cloud-service-broker#108 (comment)

This isn't working just yet...! See comments here:
cloudfoundry/cloud-service-broker#115 (comment)

In the meantime, there's an (in-progress) workaround in `make test-eden`.
@pivotal-marcela-campo pivotal-marcela-campo added the help wanted The team has de-prioritized this and could use your help! label May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core broker documentation Improvements or additions to documentation help wanted The team has de-prioritized this and could use your help!
Projects
Bug + Feature Tracking
  
Awaiting Prioritizarion
Status: Waiting for Changes | Open for Contributions
Development

No branches or pull requests

4 participants