Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Svcat bind params now supports --params-json #1889

Merged
merged 5 commits into from
Mar 30, 2018

Conversation

n3wscott
Copy link
Contributor

fixes #1871

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 29, 2018
@n3wscott n3wscott requested a review from carolynvs March 29, 2018 18:58
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 29, 2018
Copy link
Contributor

@jeremyrickard jeremyrickard left a comment

Choose a reason for hiding this comment

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

Yay!

Copy link
Contributor

@jeremyrickard jeremyrickard left a comment

Choose a reason for hiding this comment

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

LGTM

@MHBauer
Copy link
Contributor

MHBauer commented Mar 29, 2018

@jberkhahn any thoughts?

@n3wscott n3wscott added the svcat label Mar 29, 2018
Copy link
Contributor

@carolynvs carolynvs left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -97,7 +97,7 @@ func (c *provisonCmd) Validate(args []string) error {
if c.jsonParams != "" {
c.params, err = parameters.ParseVariableJSON(c.jsonParams)
if err != nil {
return fmt.Errorf("invalid --params value (%s)", err)
return fmt.Errorf("invalid --params-json value (%s)", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch!

@@ -137,7 +137,7 @@ func (sdk *SDK) Unbind(ns, instanceName string) ([]v1beta1.ServiceBinding, error
}

//Range over the deleted bindings to build a slice to return
deleted := []v1beta1.ServiceBinding{}
deleted := []v1beta1.ServiceBinding(nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel silly asking but what does this change do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

[]v1beta1.ServiceBinding{} is creating an empty slice with the literal initialized.

[]v1beta1.ServiceBinding(nil) creates with the explicate nil initializer.

TBH: goland tells me using the (nil) way is better than {}

Copy link
Contributor

Choose a reason for hiding this comment

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

I bow to the superior skills of Goland. Good to know what that means, thanks! 👍

Copy link
Contributor

@pmorie pmorie left a comment

Choose a reason for hiding this comment

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

LGTM

cmd.Flags().StringSliceVarP(&bindCmd.rawSecrets, "secret", "s", nil,
"Additional parameter, whose value is stored in a secret, to use when binding the instance, format: SECRET[KEY]")

cmd.Flags().StringVar(&bindCmd.jsonParams, "params-json", "",
Copy link
Contributor

Choose a reason for hiding this comment

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

I like it.

I would like a version of this that was --secret-params-json and let you put a json blob into a secret that was referenced.

Copy link
Contributor Author

@n3wscott n3wscott Mar 30, 2018

Choose a reason for hiding this comment

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

Would the result of that command create a new secret and then use the secret just like we currently do with --secret-name NAME ?

We would have to have some way to clean that secret up after the operation has finished. I think this sounds like a good idea and I am guessing most users would not understand that sending params via svcat exposes those to the other users of k8s.

update: Oh I needed to read better. We would be updating the contents of the secret with the blob, and we pass in the name of the secret.

Yeah! nice. made and issue: #1898

Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure I understand, the difference between --secret and this new flag would be that it would handle making the secret for you and setting the secret paramsfrom on the instance for you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@carolynvs I misunderstood the suggestion at first. I think @pmorie was suggesting the simpler case of supporting exactly what the current --secret does except provide the secret pairs as a json blob provided by --secret-json

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh! @pmorie can you weigh in when you get a chance? 😀

cmd.Flags().StringSliceVarP(&bindCmd.rawSecrets, "secret", "s", nil,
"Additional parameter, whose value is stored in a secret, to use when binding the instance, format: SECRET[KEY]")

cmd.Flags().StringVar(&bindCmd.jsonParams, "params-json", "",
"Additional parameters to use when binding the instance, provided as a JSON object. Cannot be combined with --param")
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have a message (fine to be in a follow up) warning people not to use this for secret information.

@pmorie pmorie added the LGTM2 label Mar 30, 2018
@n3wscott n3wscott merged commit f33209f into kubernetes-retired:master Mar 30, 2018
orthros added a commit to orthros/service-catalog that referenced this pull request Apr 4, 2018
* master:
  Support provisioning by external id (kubernetes-retired#1756)
  Add namespaced ServiceBroker API (kubernetes-retired#1881)
  Enable verbose logging in svcat (kubernetes-retired#1822)
  Adding ServicePlan (namespaced plans) API (kubernetes-retired#1894)
  Svcat bind params now supports --params-json (kubernetes-retired#1889)
  words discussing the automated builds (kubernetes-retired#1885)
  v0.1.12 release changes
  don't overwrite generated files before verifying (kubernetes-retired#1891)
  Update registry code from broker to clusterservicebroker (kubernetes-retired#1880)
  Credentials remapping (kubernetes-retired#1868)
  Rename/move existing "ServicePlan" things (kubernetes-retired#1883)
  Start orphan mitigation after receiving a  last operation status for async provisioning (kubernetes-retired#1886)
  Update of name in example ServiceClass (kubernetes-retired#1878)
  Cluster-id configmap (kubernetes-retired#1658)
  Add namespaced ServiceClass API (kubernetes-retired#1859)
  Fix common validations regression (kubernetes-retired#1882)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. LGTM1 LGTM2 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. svcat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[svcat] Bind command should accept a JSON string as parameters
6 participants