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

remove check for GUID regEx from plan externalid#1038

Closed
emaildanwilson wants to merge 1 commit into
kubernetes-retired:masterfrom
emaildanwilson:removePlanIDGUIDCheck
Closed

remove check for GUID regEx from plan externalid#1038
emaildanwilson wants to merge 1 commit into
kubernetes-retired:masterfrom
emaildanwilson:removePlanIDGUIDCheck

Conversation

@emaildanwilson
Copy link
Copy Markdown
Contributor

The hashicorp/cf-vault-service-broker appends the plan name onto the GUID for the External ID using a period as the separator. The existing regEx validation does not allow for periods. The Pivotal docs do not specify an exact format and simply state using a GUID is recommended.

This change removes the regEx check in the api for Plan[].ExternalID so that any other brokers not following a strict GUID format will still work for k8s.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 14, 2017
@duglin
Copy link
Copy Markdown
Contributor

duglin commented Jul 14, 2017

will this check to make sure its a non-empty string?

@emaildanwilson
Copy link
Copy Markdown
Contributor Author

@duglin yes, there is a test case for that I needed to fix. It looked like there was a copy/paste error on it from the previous test case so it wasn't working. https://github.com/kubernetes-incubator/service-catalog/pull/1038/files#diff-ab3c2e82db881a2a48465940cbe38df7R124

@duglin
Copy link
Copy Markdown
Contributor

duglin commented Jul 14, 2017

great - thanks!! will review later today

valid: true,
},
{
name: "invalid serviceClass - missing plan guid",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how weird, it looks like the test name didn't match what was going on.

}

for _, msg := range validateExternalID(plan.ExternalID) {
allErrs = append(allErrs, field.Invalid(fldPath.Child("externalID"), plan.ExternalID, msg))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the presence check is above on line 110.

Copy link
Copy Markdown
Contributor

@MHBauer MHBauer 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 MHBauer added the LGTM1 label Jul 14, 2017
@duglin
Copy link
Copy Markdown
Contributor

duglin commented Jul 14, 2017

can you change invalid serviceClass - missing guid to ... - missing id ?

serviceClass: func() *servicecatalog.ServiceClass {
s := validServiceClass()
s.Plans[0].ExternalID = "40d-0983-1b89-★"
s.Plans[0].ExternalID = ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isn't this a dup of the test on line 85?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no, plan id vs class id

s := validServiceClass()
s.ExternalID = ""
s.Plans[0].ExternalID = ""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah - ok - thanks

@duglin
Copy link
Copy Markdown
Contributor

duglin commented Jul 14, 2017

couple of minor comments, otherwise it looks good.

@emaildanwilson emaildanwilson force-pushed the removePlanIDGUIDCheck branch from 46f5809 to 8a347f2 Compare July 14, 2017 21:54
@emaildanwilson emaildanwilson force-pushed the removePlanIDGUIDCheck branch from 8a347f2 to 8ec4ade Compare July 14, 2017 21:55
@emaildanwilson
Copy link
Copy Markdown
Contributor Author

@duglin Test references to guid have been switched to id for Plans[].ExternalID.

@pmorie
Copy link
Copy Markdown
Contributor

pmorie commented Jul 18, 2017

My concern about removing the regex is that we might need to tighten it in the future, which isn't backward-compatible. I'd strongly prefer to just allow the period until we can get clarity on cloudfoundry/servicebroker#118

@duglin
Copy link
Copy Markdown
Contributor

duglin commented Jul 18, 2017

that would be breaking change in the spec which means v3 - which would break lots of other things too

@duglin
Copy link
Copy Markdown
Contributor

duglin commented Jul 18, 2017

I think being spec compliant is more important right now

@pmorie
Copy link
Copy Markdown
Contributor

pmorie commented Jul 20, 2017

Adding do-not-merge based on discussion in the July 20, 2017 meeting to relax the regex to allow periods and seek clarity on aspects of the OSB spec.

@duglin
Copy link
Copy Markdown
Contributor

duglin commented Jul 25, 2017

Issue in OSB API: cloudfoundry/servicebroker#273
Related issue: #802

Been thinking about this and there are two uses of this ID that we need to think about:

1 - as the "name" that is exposed to a user.
2 - as the kube "name" for the service and plan

No matter what happens with cloudfoundry/servicebroker#273 I think that it would really be a mistake to expose this ID to the user as the way for them to specify which service/plan they want. The UX will just be too painful. So we really need to find a way to let people use the OSB API "name" field instead when specifying the service/plan. A proposal for how we might do this is here: #802 (comment)

Even if we do hide these IDs from the user, using them as the "name" on the kube resource is still problematic because the allowable chars for a kube "name" is restricted to "lower case alphanumeric characters, -, and .". If OSB API does manage to restrict these fields such that kube can use them then we're fine. But, I have my doubts the spec can do that, so I think we may need to do some kind mapping like outlined in #802 (comment).

@pmorie
Copy link
Copy Markdown
Contributor

pmorie commented Jan 4, 2018

Should we close this?

@nilebox
Copy link
Copy Markdown
Contributor

nilebox commented Feb 19, 2018

Closing as suggested by @pmorie and no comments since January.

@nilebox nilebox closed this Feb 19, 2018
@duglin
Copy link
Copy Markdown
Contributor

duglin commented Feb 19, 2018

looking at the status of the OSB API issue ( cloudfoundry/servicebroker#273 ) it appears that they decided they couldn't tighten the charset so I think this PR is still valid. Re-opening.

@duglin duglin reopened this Feb 19, 2018
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 19, 2018
@duglin
Copy link
Copy Markdown
Contributor

duglin commented Feb 19, 2018

@emaildanwilson want to rebase?

@MHBauer
Copy link
Copy Markdown
Contributor

MHBauer commented Apr 19, 2018

We don't store plans in the service class anymore. is this relevant at all? Does it need to be reapplied to serviceplans specifically?

@MHBauer MHBauer added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. awaiting-ci labels Jul 18, 2018
@carolynvs
Copy link
Copy Markdown
Contributor

I am closing this because it was fixed in #1849 to allow periods in plan names. Feel free to open a new PR if there's still more to do!

@carolynvs carolynvs closed this Aug 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

awaiting-ci cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants