Skip to content

Commit dff470f

Browse files
Doug Davispmorie
Doug Davis
authored andcommitted
Move "External" around in some resource names/properties (#1354)
* move "External" to the middle of the property name Signed-off-by: Doug Davis <[email protected]> * generated files Signed-off-by: Doug Davis <[email protected]>
1 parent 0885edb commit dff470f

27 files changed

+211
-211
lines changed

contrib/examples/apiserver/instance.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ metadata:
44
name: test-instance
55
namespace: test-ns
66
spec:
7-
externalClusterServiceClassName: test-serviceclass
8-
externalClusterServicePlanName: example-plan-1
7+
clusterServiceClassExternalName: test-serviceclass
8+
clusterServicePlanExternalName: example-plan-1

contrib/examples/walkthrough/ups-instance-default-sp.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ metadata:
44
name: ups-instance-default
55
namespace: test-ns
66
spec:
7-
externalClusterServiceClassName: user-provided-service
7+
clusterServiceClassExternalName: user-provided-service
88
parameters:
99
credentials:
1010
name: root

contrib/examples/walkthrough/ups-instance.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ metadata:
44
name: ups-instance
55
namespace: test-ns
66
spec:
7-
externalClusterServiceClassName: user-provided-service
8-
externalClusterServicePlanName: default
7+
clusterServiceClassExternalName: user-provided-service
8+
clusterServicePlanExternalName: default
99
parameters:
1010
credentials:
1111
param-1: value-1

docs/walkthrough-1.6.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ metadata:
201201
uid: 07ecf19d-a781-11e7-8b18-0242ac110005
202202
spec:
203203
externalID: 7f2c176a-ae67-4b5e-a826-58591d85a1d7
204-
externalClusterServiceClassName: user-provided-service
205-
externalClusterServicePlanName: default
204+
clusterServiceClassExternalName: user-provided-service
205+
clusterServicePlanExternalName: default
206206
parameters:
207207
credentials:
208208
param-1: value-1
@@ -216,7 +216,7 @@ status:
216216
status: "True"
217217
type: Ready
218218
externalProperties:
219-
externalClusterServicePlanName: default
219+
clusterServicePlanExternalName: default
220220
parameterChecksum: e65c764db8429f9afef45f1e8f71bcbf9fdbe9a13306b86fd5dcc3c5d11e5dd3
221221
parameters:
222222
credentials:

docs/walkthrough-1.7.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ metadata:
189189
uid: 07ecf19d-a781-11e7-8b18-0242ac110005
190190
spec:
191191
externalID: 7f2c176a-ae67-4b5e-a826-58591d85a1d7
192-
externalClusterServiceClassName: user-provided-service
193-
externalClusterServicePlanName: default
192+
clusterServiceClassExternalName: user-provided-service
193+
clusterServicePlanExternalName: default
194194
parameters:
195195
credentials:
196196
param-1: value-1
@@ -204,7 +204,7 @@ status:
204204
status: "True"
205205
type: Ready
206206
externalProperties:
207-
externalClusterServicePlanName: default
207+
clusterServicePlanExternalName: default
208208
parameterChecksum: e65c764db8429f9afef45f1e8f71bcbf9fdbe9a13306b86fd5dcc3c5d11e5dd3
209209
parameters:
210210
credentials:

pkg/apis/servicecatalog/types.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -411,20 +411,20 @@ type ServiceInstance struct {
411411
// specify the desired Class/Plan, this structure specifies the
412412
// allowed ways to specify the intent.
413413
type PlanReference struct {
414-
// ExternalClusterServiceClassName is the human-readable name of the
414+
// ClusterServiceClassExternalName is the human-readable name of the
415415
// service as reported by the broker. Note that if the broker changes
416416
// the name of the ClusterServiceClass, it will not be reflected here,
417417
// and to see the current name of the ClusterServiceClass, you should
418418
// follow the ClusterServiceClassRef below.
419419
//
420420
// Immutable.
421-
ExternalClusterServiceClassName string
422-
// ExternalClusterServicePlanName is the human-readable name of the plan
421+
ClusterServiceClassExternalName string
422+
// ClusterServicePlanExternalName is the human-readable name of the plan
423423
// as reported by the broker. Note that if the broker changes the name
424424
// of the ClusterServicePlan, it will not be reflected here, and to see
425425
// the current name of the ClusterServicePlan, you should follow the
426426
// ClusterServicePlanRef below.
427-
ExternalClusterServicePlanName string
427+
ClusterServicePlanExternalName string
428428

429429
// ClusterServiceClassName is the kubernetes name of the
430430
// ClusterServiceClass.
@@ -441,11 +441,11 @@ type ServiceInstanceSpec struct {
441441

442442
// ClusterServiceClassRef is a reference to the ClusterServiceClass
443443
// that the user selected.
444-
// This is set by the controller based on ExternalClusterServiceClassName
444+
// This is set by the controller based on ClusterServiceClassExternalName
445445
ClusterServiceClassRef *ClusterObjectReference
446446
// ClusterServicePlanRef is a reference to the ClusterServicePlan
447447
// that the user selected.
448-
// This is set by the controller based on ExternalClusterServicePlanName
448+
// This is set by the controller based on ClusterServicePlanExternalName
449449
ClusterServicePlanRef *ClusterObjectReference
450450

451451
// Parameters is a set of the parameters to be passed to the underlying
@@ -588,10 +588,10 @@ const (
588588
// ServiceInstancePropertiesState is the state of a ServiceInstance that
589589
// the ServiceBroker knows about.
590590
type ServiceInstancePropertiesState struct {
591-
// ExternalClusterServicePlanName is the name of the plan that the broker knows this
591+
// ClusterServicePlanExternalName is the name of the plan that the broker knows this
592592
// ServiceInstance to be on. This is the human readable plan name from the
593593
// OSB API.
594-
ExternalClusterServicePlanName string
594+
ClusterServicePlanExternalName string
595595

596596
// Parameters is a blob of the parameters and their values that the broker
597597
// knows about for this ServiceInstance. If a parameter was sourced from

pkg/apis/servicecatalog/v1beta1/types.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -423,26 +423,26 @@ type ServiceInstance struct {
423423
// allowed ways to specify the intent.
424424
//
425425
// Currently supported ways:
426-
// - ExternalClusterServiceClassName and ExternalClusterServicePlanName
426+
// - ClusterServiceClassExternalName and ClusterServicePlanExternalName
427427
// - ClusterServiceClassName and ClusterServicePlanName
428428
//
429429
// For both of these ways, if a ClusterServiceClass only has one plan
430430
// then leaving the *ServicePlanName is optional.
431431
type PlanReference struct {
432-
// ExternalClusterServiceClassName is the human-readable name of the
432+
// ClusterServiceClassExternalName is the human-readable name of the
433433
// service as reported by the broker. Note that if the broker changes
434434
// the name of the ClusterServiceClass, it will not be reflected here,
435435
// and to see the current name of the ClusterServiceClass, you should
436436
// follow the ClusterServiceClassRef below.
437437
//
438438
// Immutable.
439-
ExternalClusterServiceClassName string `json:"externalClusterServiceClassName,omitempty"`
440-
// ExternalClusterServicePlanName is the human-readable name of the plan
439+
ClusterServiceClassExternalName string `json:"clusterServiceClassExternalName,omitempty"`
440+
// ClusterServicePlanExternalName is the human-readable name of the plan
441441
// as reported by the broker. Note that if the broker changes the name
442442
// of the ClusterServicePlan, it will not be reflected here, and to see
443443
// the current name of the ClusterServicePlan, you should follow the
444444
// ClusterServicePlanRef below.
445-
ExternalClusterServicePlanName string `json:"externalClusterServicePlanName,omitempty"`
445+
ClusterServicePlanExternalName string `json:"clusterServicePlanExternalName,omitempty"`
446446

447447
// ClusterServiceClassName is the kubernetes name of the
448448
// ClusterServiceClass.
@@ -461,12 +461,12 @@ type ServiceInstanceSpec struct {
461461
// ClusterServiceClassRef is a reference to the ClusterServiceClass
462462
// that the user selected.
463463
// This is set by the controller based on
464-
// ExternalClusterServiceClassName
464+
// ClusterServiceClassExternalName
465465
ClusterServiceClassRef *ClusterObjectReference `json:"clusterServiceClassRef,omitempty"`
466466
// ClusterServicePlanRef is a reference to the ClusterServicePlan
467467
// that the user selected.
468468
// This is set by the controller based on
469-
// ExternalClusterServicePlanName
469+
// ClusterServicePlanExternalName
470470
ClusterServicePlanRef *ClusterObjectReference `json:"clusterServicePlanRef,omitempty"`
471471

472472
// Parameters is a set of the parameters to be passed to the underlying
@@ -609,10 +609,10 @@ const (
609609
// ServiceInstancePropertiesState is the state of a ServiceInstance that
610610
// the ClusterServiceBroker knows about.
611611
type ServiceInstancePropertiesState struct {
612-
// ExternalClusterServicePlanName is the name of the plan that the
612+
// ClusterServicePlanExternalName is the name of the plan that the
613613
// broker knows this ServiceInstance to be on. This is the human
614614
// readable plan name from the OSB API.
615-
ExternalClusterServicePlanName string `json:"externalClusterServicePlanName"`
615+
ClusterServicePlanExternalName string `json:"clusterServicePlanExternalName"`
616616

617617
// Parameters is a blob of the parameters and their values that the broker
618618
// knows about for this ServiceInstance. If a parameter was sourced from

pkg/apis/servicecatalog/v1beta1/zz_generated.conversion.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ func Convert_servicecatalog_ParametersFromSource_To_v1beta1_ParametersFromSource
570570
}
571571

572572
func autoConvert_v1beta1_PlanReference_To_servicecatalog_PlanReference(in *PlanReference, out *servicecatalog.PlanReference, s conversion.Scope) error {
573-
out.ExternalClusterServiceClassName = in.ExternalClusterServiceClassName
574-
out.ExternalClusterServicePlanName = in.ExternalClusterServicePlanName
573+
out.ClusterServiceClassExternalName = in.ClusterServiceClassExternalName
574+
out.ClusterServicePlanExternalName = in.ClusterServicePlanExternalName
575575
out.ClusterServiceClassName = in.ClusterServiceClassName
576576
out.ClusterServicePlanName = in.ClusterServicePlanName
577577
return nil
@@ -583,8 +583,8 @@ func Convert_v1beta1_PlanReference_To_servicecatalog_PlanReference(in *PlanRefer
583583
}
584584

585585
func autoConvert_servicecatalog_PlanReference_To_v1beta1_PlanReference(in *servicecatalog.PlanReference, out *PlanReference, s conversion.Scope) error {
586-
out.ExternalClusterServiceClassName = in.ExternalClusterServiceClassName
587-
out.ExternalClusterServicePlanName = in.ExternalClusterServicePlanName
586+
out.ClusterServiceClassExternalName = in.ClusterServiceClassExternalName
587+
out.ClusterServicePlanExternalName = in.ClusterServicePlanExternalName
588588
out.ClusterServiceClassName = in.ClusterServiceClassName
589589
out.ClusterServicePlanName = in.ClusterServicePlanName
590590
return nil
@@ -922,7 +922,7 @@ func Convert_servicecatalog_ServiceInstanceList_To_v1beta1_ServiceInstanceList(i
922922
}
923923

924924
func autoConvert_v1beta1_ServiceInstancePropertiesState_To_servicecatalog_ServiceInstancePropertiesState(in *ServiceInstancePropertiesState, out *servicecatalog.ServiceInstancePropertiesState, s conversion.Scope) error {
925-
out.ExternalClusterServicePlanName = in.ExternalClusterServicePlanName
925+
out.ClusterServicePlanExternalName = in.ClusterServicePlanExternalName
926926
out.Parameters = (*runtime.RawExtension)(unsafe.Pointer(in.Parameters))
927927
out.ParametersChecksum = in.ParametersChecksum
928928
out.UserInfo = (*servicecatalog.UserInfo)(unsafe.Pointer(in.UserInfo))
@@ -935,7 +935,7 @@ func Convert_v1beta1_ServiceInstancePropertiesState_To_servicecatalog_ServiceIns
935935
}
936936

937937
func autoConvert_servicecatalog_ServiceInstancePropertiesState_To_v1beta1_ServiceInstancePropertiesState(in *servicecatalog.ServiceInstancePropertiesState, out *ServiceInstancePropertiesState, s conversion.Scope) error {
938-
out.ExternalClusterServicePlanName = in.ExternalClusterServicePlanName
938+
out.ClusterServicePlanExternalName = in.ClusterServicePlanExternalName
939939
out.Parameters = (*runtime.RawExtension)(unsafe.Pointer(in.Parameters))
940940
out.ParametersChecksum = in.ParametersChecksum
941941
out.UserInfo = (*UserInfo)(unsafe.Pointer(in.UserInfo))

pkg/apis/servicecatalog/validation/instance.go

+16-16
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ func internalValidateServiceInstanceUpdateAllowed(new *sc.ServiceInstance, old *
230230
if old.Generation != new.Generation && old.Status.ReconciledGeneration != old.Generation {
231231
errors = append(errors, field.Forbidden(field.NewPath("spec"), "Another update for this service instance is in progress"))
232232
}
233-
if old.Spec.ExternalClusterServicePlanName != new.Spec.ExternalClusterServicePlanName && new.Spec.ClusterServicePlanRef != nil {
234-
errors = append(errors, field.Forbidden(field.NewPath("spec").Child("clusterServicePlanRef"), "clusterServicePlanRef must not be present when externalServicePlanName is being changed"))
233+
if old.Spec.ClusterServicePlanExternalName != new.Spec.ClusterServicePlanExternalName && new.Spec.ClusterServicePlanRef != nil {
234+
errors = append(errors, field.Forbidden(field.NewPath("spec").Child("clusterServicePlanRef"), "clusterServicePlanRef must not be present when servicePlanExternalName is being changed"))
235235
}
236236
return errors
237237
}
@@ -246,7 +246,7 @@ func ValidateServiceInstanceUpdate(new *sc.ServiceInstance, old *sc.ServiceInsta
246246
allErrs = append(allErrs, internalValidateServiceInstanceUpdateAllowed(new, old)...)
247247
allErrs = append(allErrs, internalValidateServiceInstance(new, false)...)
248248

249-
allErrs = append(allErrs, apivalidation.ValidateImmutableField(new.Spec.ExternalClusterServiceClassName, old.Spec.ExternalClusterServiceClassName, specFieldPath.Child("externalClusterServiceClassName"))...)
249+
allErrs = append(allErrs, apivalidation.ValidateImmutableField(new.Spec.ClusterServiceClassExternalName, old.Spec.ClusterServiceClassExternalName, specFieldPath.Child("clusterServiceClassExternalName"))...)
250250
allErrs = append(allErrs, apivalidation.ValidateImmutableField(new.Spec.ExternalID, old.Spec.ExternalID, specFieldPath.Child("externalID"))...)
251251

252252
if new.Spec.UpdateRequests < old.Spec.UpdateRequests {
@@ -305,34 +305,34 @@ func validatePlanReference(p *sc.PlanReference, fldPath *field.Path) field.Error
305305
allErrs := field.ErrorList{}
306306

307307
// Just to make reading of the conditionals in the code easier.
308-
externalClassSet := p.ExternalClusterServiceClassName != ""
309-
externalPlanSet := p.ExternalClusterServicePlanName != ""
308+
externalClassSet := p.ClusterServiceClassExternalName != ""
309+
externalPlanSet := p.ClusterServicePlanExternalName != ""
310310
k8sClassSet := p.ClusterServiceClassName != ""
311311
k8sPlanSet := p.ClusterServicePlanName != ""
312312

313313
// Can't specify both External and k8s name but must specify one.
314314
if externalClassSet == k8sClassSet {
315-
allErrs = append(allErrs, field.Required(fldPath.Child("externalClusterServiceClassName"), "exactly one of externalClusterServiceClassName or clusterServiceClassName required"))
316-
allErrs = append(allErrs, field.Required(fldPath.Child("clusterServiceClassName"), "exactly one of externalClusterServiceClassName or clusterServiceClassName required"))
315+
allErrs = append(allErrs, field.Required(fldPath.Child("clusterServiceClassExternalName"), "exactly one of clusterServiceClassExternalName or clusterServiceClassName required"))
316+
allErrs = append(allErrs, field.Required(fldPath.Child("clusterServiceClassName"), "exactly one of clusterServiceClassExternalName or clusterServiceClassName required"))
317317
}
318318
// Can't specify both External and k8s name but must specify one.
319319
if externalPlanSet == k8sPlanSet {
320-
allErrs = append(allErrs, field.Required(fldPath.Child("externalClusterServicePlanName"), "exactly one of externalClusterServicePlanName or clusterServicePlanName required"))
321-
allErrs = append(allErrs, field.Required(fldPath.Child("clusterServicePlanName"), "exactly one of externalClusterServicePlanName or clusterServicePlanName required"))
320+
allErrs = append(allErrs, field.Required(fldPath.Child("clusterServicePlanExternalName"), "exactly one of clusterServicePlanExternalName or clusterServicePlanName required"))
321+
allErrs = append(allErrs, field.Required(fldPath.Child("clusterServicePlanName"), "exactly one of clusterServicePlanExternalName or clusterServicePlanName required"))
322322
}
323323

324324
if externalClassSet {
325-
for _, msg := range validateServiceClassName(p.ExternalClusterServiceClassName, false /* prefix */) {
326-
allErrs = append(allErrs, field.Invalid(fldPath.Child("externalClusterServiceClassName"), p.ExternalClusterServiceClassName, msg))
325+
for _, msg := range validateServiceClassName(p.ClusterServiceClassExternalName, false /* prefix */) {
326+
allErrs = append(allErrs, field.Invalid(fldPath.Child("clusterServiceClassExternalName"), p.ClusterServiceClassExternalName, msg))
327327
}
328328

329-
// If ExternalClusterServiceClassName given, must use ExternalClusterServicePlanName
329+
// If ClusterServiceClassExternalName given, must use ClusterServicePlanExternalName
330330
if !externalPlanSet {
331-
allErrs = append(allErrs, field.Required(fldPath.Child("externalClusterServicePlanName"), "must specify externalClusterServicePlanName with externalClusterServiceClassName"))
331+
allErrs = append(allErrs, field.Required(fldPath.Child("clusterServicePlanExternalName"), "must specify clusterServicePlanExternalName with clusterServiceClassExternalName"))
332332
}
333333

334-
for _, msg := range validateServicePlanName(p.ExternalClusterServicePlanName, false /* prefix */) {
335-
allErrs = append(allErrs, field.Invalid(fldPath.Child("externalClusterServicePlanName"), p.ClusterServicePlanName, msg))
334+
for _, msg := range validateServicePlanName(p.ClusterServicePlanExternalName, false /* prefix */) {
335+
allErrs = append(allErrs, field.Invalid(fldPath.Child("clusterServicePlanExternalName"), p.ClusterServicePlanName, msg))
336336
}
337337
}
338338
if k8sClassSet {
@@ -355,7 +355,7 @@ func validatePlanReferenceUpdate(pOld *sc.PlanReference, pNew *sc.PlanReference,
355355
allErrs := field.ErrorList{}
356356
allErrs = append(allErrs, validatePlanReference(pOld, fldPath)...)
357357
allErrs = append(allErrs, validatePlanReference(pNew, fldPath)...)
358-
allErrs = append(allErrs, apivalidation.ValidateImmutableField(pNew.ExternalClusterServiceClassName, pOld.ExternalClusterServiceClassName, field.NewPath("spec").Child("externalClusterServiceClassName"))...)
358+
allErrs = append(allErrs, apivalidation.ValidateImmutableField(pNew.ClusterServiceClassExternalName, pOld.ClusterServiceClassExternalName, field.NewPath("spec").Child("clusterServiceClassExternalName"))...)
359359
allErrs = append(allErrs, apivalidation.ValidateImmutableField(pNew.ClusterServiceClassName, pOld.ClusterServiceClassName, field.NewPath("spec").Child("clusterServiceClassName"))...)
360360
return allErrs
361361
}

0 commit comments

Comments
 (0)