diff --git a/contrib/pkg/brokerapi/openservicebroker/open_service_broker_client_test.go b/contrib/pkg/brokerapi/openservicebroker/open_service_broker_client_test.go index fb7c4b281f38..3e5661a8a41a 100644 --- a/contrib/pkg/brokerapi/openservicebroker/open_service_broker_client_test.go +++ b/contrib/pkg/brokerapi/openservicebroker/open_service_broker_client_test.go @@ -43,7 +43,9 @@ func setup() (*util.FakeServiceBrokerServer, *servicecatalog.ClusterServiceBroke url := fbs.Start() fakeClusterServiceBroker := &servicecatalog.ClusterServiceBroker{ Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: url, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: url, + }, }, } diff --git a/pkg/apis/servicecatalog/types.go b/pkg/apis/servicecatalog/types.go index f4b8956a51b1..29eb572534e4 100644 --- a/pkg/apis/servicecatalog/types.go +++ b/pkg/apis/servicecatalog/types.go @@ -46,15 +46,11 @@ type ClusterServiceBrokerList struct { Items []ClusterServiceBroker } -// ClusterServiceBrokerSpec represents a description of a Broker. -type ClusterServiceBrokerSpec struct { - // URL is the address used to communicate with the ClusterServiceBroker. +// CommonServiceBrokerSpec represents a description of a Broker. +type CommonServiceBrokerSpec struct { + // URL is the address used to communicate with the ServiceBroker. URL string - // AuthInfo contains the data that the service catalog should use to authenticate - // with the Service Broker. - AuthInfo *ServiceBrokerAuthInfo - // InsecureSkipTLSVerify disables TLS certificate verification when communicating with this Broker. // This is strongly discouraged. You should use the CABundle instead. // +optional @@ -65,7 +61,7 @@ type ClusterServiceBrokerSpec struct { CABundle []byte // RelistBehavior specifies the type of relist behavior the catalog should - // exhibit when relisting ClusterServiceClasses available from a broker. + // exhibit when relisting ServiceClasses available from a broker. RelistBehavior ServiceBrokerRelistBehavior // RelistDuration is the frequency by which a controller will relist the @@ -83,6 +79,15 @@ type ClusterServiceBrokerSpec struct { RelistRequests int64 } +// ClusterServiceBrokerSpec represents a description of a Broker. +type ClusterServiceBrokerSpec struct { + CommonServiceBrokerSpec + + // AuthInfo contains the data that the service catalog should use to authenticate + // with the Service Broker. + AuthInfo *ClusterServiceBrokerAuthInfo +} + // ServiceBrokerRelistBehavior represents a type of broker relist behavior. type ServiceBrokerRelistBehavior string @@ -96,22 +101,24 @@ const ( ServiceBrokerRelistBehaviorManual ServiceBrokerRelistBehavior = "Manual" ) -// ServiceBrokerAuthInfo is a union type that contains information on one of the authentication methods -// the the service catalog and brokers may support, according to the OpenServiceBroker API -// specification (https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md). -type ServiceBrokerAuthInfo struct { - // Basic provides configuration for basic authentication. - Basic *BasicAuthConfig - // BearerTokenAuthConfig provides configuration to send an opaque value as a bearer token. +// ClusterServiceBrokerAuthInfo is a union type that contains information on +// one of the authentication methods the the service catalog and brokers may +// support, according to the OpenServiceBroker API specification +// (https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md). +type ClusterServiceBrokerAuthInfo struct { + // ClusterBasicAuthConfig provides configuration for basic authentication. + Basic *ClusterBasicAuthConfig + // ClusterBearerTokenAuthConfig provides configuration to send an opaque value as a bearer token. // The value is referenced from the 'token' field of the given secret. This value should only // contain the token value and not the `Bearer` scheme. - Bearer *BearerTokenAuthConfig + Bearer *ClusterBearerTokenAuthConfig } -// BasicAuthConfig provides config for the basic authentication. -type BasicAuthConfig struct { +// ClusterBasicAuthConfig provides config for the basic authentication of +// cluster scoped brokers. +type ClusterBasicAuthConfig struct { // SecretRef is a reference to a Secret containing information the - // catalog should use to authenticate to this ServiceBroker. + // catalog should use to authenticate to this ClusterServiceBroker. // // Required at least one of the fields: // - Secret.Data["username"] - username used for authentication @@ -119,10 +126,11 @@ type BasicAuthConfig struct { SecretRef *ObjectReference } -// BearerTokenAuthConfig provides config for the bearer token authentication. -type BearerTokenAuthConfig struct { +// ClusterBearerTokenAuthConfig provides config for the bearer token +// authentication of cluster scoped brokers. +type ClusterBearerTokenAuthConfig struct { // SecretRef is a reference to a Secret containing information the - // catalog should use to authenticate to this ServiceBroker. + // catalog should use to authenticate to this ClusterServiceBroker. // // Required field: // - Secret.Data["token"] - bearer token for authentication diff --git a/pkg/apis/servicecatalog/v1beta1/types.go b/pkg/apis/servicecatalog/v1beta1/types.go index ddbb091b2965..bb8006d56c11 100644 --- a/pkg/apis/servicecatalog/v1beta1/types.go +++ b/pkg/apis/servicecatalog/v1beta1/types.go @@ -55,15 +55,11 @@ type ClusterServiceBrokerList struct { Items []ClusterServiceBroker `json:"items"` } -// ClusterServiceBrokerSpec represents a description of a Broker. -type ClusterServiceBrokerSpec struct { - // URL is the address used to communicate with the ClusterServiceBroker. +// CommonServiceBrokerSpec represents a description of a Broker. +type CommonServiceBrokerSpec struct { + // URL is the address used to communicate with the ServiceBroker. URL string `json:"url"` - // AuthInfo contains the data that the service catalog should use to authenticate - // with the ClusterServiceBroker. - AuthInfo *ServiceBrokerAuthInfo `json:"authInfo,omitempty"` - // InsecureSkipTLSVerify disables TLS certificate verification when communicating with this Broker. // This is strongly discouraged. You should use the CABundle instead. // +optional @@ -74,7 +70,7 @@ type ClusterServiceBrokerSpec struct { CABundle []byte `json:"caBundle,omitempty"` // RelistBehavior specifies the type of relist behavior the catalog should - // exhibit when relisting ClusterServiceClasses available from a broker. + // exhibit when relisting ServiceClasses available from a broker. // +optional RelistBehavior ServiceBrokerRelistBehavior `json:"relistBehavior"` @@ -94,6 +90,15 @@ type ClusterServiceBrokerSpec struct { RelistRequests int64 `json:"relistRequests"` } +// ClusterServiceBrokerSpec represents a description of a Broker. +type ClusterServiceBrokerSpec struct { + CommonServiceBrokerSpec `json:",inline"` + + // AuthInfo contains the data that the service catalog should use to authenticate + // with the ClusterServiceBroker. + AuthInfo *ClusterServiceBrokerAuthInfo `json:"authInfo,omitempty"` +} + // ServiceBrokerRelistBehavior represents a type of broker relist behavior. type ServiceBrokerRelistBehavior string @@ -107,20 +112,22 @@ const ( ServiceBrokerRelistBehaviorManual ServiceBrokerRelistBehavior = "Manual" ) -// ServiceBrokerAuthInfo is a union type that contains information on one of the authentication methods -// the the service catalog and brokers may support, according to the OpenServiceBroker API -// specification (https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md). -type ServiceBrokerAuthInfo struct { - // Basic provides configuration for basic authentication. - Basic *BasicAuthConfig `json:"basic,omitempty"` - // BearerTokenAuthConfig provides configuration to send an opaque value as a bearer token. +// ClusterServiceBrokerAuthInfo is a union type that contains information on +// one of the authentication methods the the service catalog and brokers may +// support, according to the OpenServiceBroker API specification +// (https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md). +type ClusterServiceBrokerAuthInfo struct { + // ClusterBasicAuthConfigprovides configuration for basic authentication. + Basic *ClusterBasicAuthConfig `json:"basic,omitempty"` + // ClusterBearerTokenAuthConfig provides configuration to send an opaque value as a bearer token. // The value is referenced from the 'token' field of the given secret. This value should only // contain the token value and not the `Bearer` scheme. - Bearer *BearerTokenAuthConfig `json:"bearer,omitempty"` + Bearer *ClusterBearerTokenAuthConfig `json:"bearer,omitempty"` } -// BasicAuthConfig provides config for the basic authentication. -type BasicAuthConfig struct { +// ClusterBasicAuthConfig provides config for the basic authentication of +// cluster scoped brokers. +type ClusterBasicAuthConfig struct { // SecretRef is a reference to a Secret containing information the // catalog should use to authenticate to this ServiceBroker. // @@ -130,8 +137,9 @@ type BasicAuthConfig struct { SecretRef *ObjectReference `json:"secretRef,omitempty"` } -// BearerTokenAuthConfig provides config for the bearer token authentication. -type BearerTokenAuthConfig struct { +// ClusterBearerTokenAuthConfig provides config for the bearer token +// authentication of cluster scoped brokers. +type ClusterBearerTokenAuthConfig struct { // SecretRef is a reference to a Secret containing information the // catalog should use to authenticate to this ServiceBroker. // diff --git a/pkg/apis/servicecatalog/v1beta1/zz_generated.conversion.go b/pkg/apis/servicecatalog/v1beta1/zz_generated.conversion.go index 03d8381fa275..690349821ada 100644 --- a/pkg/apis/servicecatalog/v1beta1/zz_generated.conversion.go +++ b/pkg/apis/servicecatalog/v1beta1/zz_generated.conversion.go @@ -36,14 +36,16 @@ func init() { // Public to allow building arbitrary schemes. func RegisterConversions(scheme *runtime.Scheme) error { return scheme.AddGeneratedConversionFuncs( - Convert_v1beta1_BasicAuthConfig_To_servicecatalog_BasicAuthConfig, - Convert_servicecatalog_BasicAuthConfig_To_v1beta1_BasicAuthConfig, - Convert_v1beta1_BearerTokenAuthConfig_To_servicecatalog_BearerTokenAuthConfig, - Convert_servicecatalog_BearerTokenAuthConfig_To_v1beta1_BearerTokenAuthConfig, + Convert_v1beta1_ClusterBasicAuthConfig_To_servicecatalog_ClusterBasicAuthConfig, + Convert_servicecatalog_ClusterBasicAuthConfig_To_v1beta1_ClusterBasicAuthConfig, + Convert_v1beta1_ClusterBearerTokenAuthConfig_To_servicecatalog_ClusterBearerTokenAuthConfig, + Convert_servicecatalog_ClusterBearerTokenAuthConfig_To_v1beta1_ClusterBearerTokenAuthConfig, Convert_v1beta1_ClusterObjectReference_To_servicecatalog_ClusterObjectReference, Convert_servicecatalog_ClusterObjectReference_To_v1beta1_ClusterObjectReference, Convert_v1beta1_ClusterServiceBroker_To_servicecatalog_ClusterServiceBroker, Convert_servicecatalog_ClusterServiceBroker_To_v1beta1_ClusterServiceBroker, + Convert_v1beta1_ClusterServiceBrokerAuthInfo_To_servicecatalog_ClusterServiceBrokerAuthInfo, + Convert_servicecatalog_ClusterServiceBrokerAuthInfo_To_v1beta1_ClusterServiceBrokerAuthInfo, Convert_v1beta1_ClusterServiceBrokerList_To_servicecatalog_ClusterServiceBrokerList, Convert_servicecatalog_ClusterServiceBrokerList_To_v1beta1_ClusterServiceBrokerList, Convert_v1beta1_ClusterServiceBrokerSpec_To_servicecatalog_ClusterServiceBrokerSpec, @@ -66,6 +68,8 @@ func RegisterConversions(scheme *runtime.Scheme) error { Convert_servicecatalog_ClusterServicePlanSpec_To_v1beta1_ClusterServicePlanSpec, Convert_v1beta1_ClusterServicePlanStatus_To_servicecatalog_ClusterServicePlanStatus, Convert_servicecatalog_ClusterServicePlanStatus_To_v1beta1_ClusterServicePlanStatus, + Convert_v1beta1_CommonServiceBrokerSpec_To_servicecatalog_CommonServiceBrokerSpec, + Convert_servicecatalog_CommonServiceBrokerSpec_To_v1beta1_CommonServiceBrokerSpec, Convert_v1beta1_CommonServiceClassSpec_To_servicecatalog_CommonServiceClassSpec, Convert_servicecatalog_CommonServiceClassSpec_To_v1beta1_CommonServiceClassSpec, Convert_v1beta1_LocalObjectReference_To_servicecatalog_LocalObjectReference, @@ -90,8 +94,6 @@ func RegisterConversions(scheme *runtime.Scheme) error { Convert_servicecatalog_ServiceBindingSpec_To_v1beta1_ServiceBindingSpec, Convert_v1beta1_ServiceBindingStatus_To_servicecatalog_ServiceBindingStatus, Convert_servicecatalog_ServiceBindingStatus_To_v1beta1_ServiceBindingStatus, - Convert_v1beta1_ServiceBrokerAuthInfo_To_servicecatalog_ServiceBrokerAuthInfo, - Convert_servicecatalog_ServiceBrokerAuthInfo_To_v1beta1_ServiceBrokerAuthInfo, Convert_v1beta1_ServiceBrokerCondition_To_servicecatalog_ServiceBrokerCondition, Convert_servicecatalog_ServiceBrokerCondition_To_v1beta1_ServiceBrokerCondition, Convert_v1beta1_ServiceInstance_To_servicecatalog_ServiceInstance, @@ -113,44 +115,44 @@ func RegisterConversions(scheme *runtime.Scheme) error { ) } -func autoConvert_v1beta1_BasicAuthConfig_To_servicecatalog_BasicAuthConfig(in *BasicAuthConfig, out *servicecatalog.BasicAuthConfig, s conversion.Scope) error { +func autoConvert_v1beta1_ClusterBasicAuthConfig_To_servicecatalog_ClusterBasicAuthConfig(in *ClusterBasicAuthConfig, out *servicecatalog.ClusterBasicAuthConfig, s conversion.Scope) error { out.SecretRef = (*servicecatalog.ObjectReference)(unsafe.Pointer(in.SecretRef)) return nil } -// Convert_v1beta1_BasicAuthConfig_To_servicecatalog_BasicAuthConfig is an autogenerated conversion function. -func Convert_v1beta1_BasicAuthConfig_To_servicecatalog_BasicAuthConfig(in *BasicAuthConfig, out *servicecatalog.BasicAuthConfig, s conversion.Scope) error { - return autoConvert_v1beta1_BasicAuthConfig_To_servicecatalog_BasicAuthConfig(in, out, s) +// Convert_v1beta1_ClusterBasicAuthConfig_To_servicecatalog_ClusterBasicAuthConfig is an autogenerated conversion function. +func Convert_v1beta1_ClusterBasicAuthConfig_To_servicecatalog_ClusterBasicAuthConfig(in *ClusterBasicAuthConfig, out *servicecatalog.ClusterBasicAuthConfig, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterBasicAuthConfig_To_servicecatalog_ClusterBasicAuthConfig(in, out, s) } -func autoConvert_servicecatalog_BasicAuthConfig_To_v1beta1_BasicAuthConfig(in *servicecatalog.BasicAuthConfig, out *BasicAuthConfig, s conversion.Scope) error { +func autoConvert_servicecatalog_ClusterBasicAuthConfig_To_v1beta1_ClusterBasicAuthConfig(in *servicecatalog.ClusterBasicAuthConfig, out *ClusterBasicAuthConfig, s conversion.Scope) error { out.SecretRef = (*ObjectReference)(unsafe.Pointer(in.SecretRef)) return nil } -// Convert_servicecatalog_BasicAuthConfig_To_v1beta1_BasicAuthConfig is an autogenerated conversion function. -func Convert_servicecatalog_BasicAuthConfig_To_v1beta1_BasicAuthConfig(in *servicecatalog.BasicAuthConfig, out *BasicAuthConfig, s conversion.Scope) error { - return autoConvert_servicecatalog_BasicAuthConfig_To_v1beta1_BasicAuthConfig(in, out, s) +// Convert_servicecatalog_ClusterBasicAuthConfig_To_v1beta1_ClusterBasicAuthConfig is an autogenerated conversion function. +func Convert_servicecatalog_ClusterBasicAuthConfig_To_v1beta1_ClusterBasicAuthConfig(in *servicecatalog.ClusterBasicAuthConfig, out *ClusterBasicAuthConfig, s conversion.Scope) error { + return autoConvert_servicecatalog_ClusterBasicAuthConfig_To_v1beta1_ClusterBasicAuthConfig(in, out, s) } -func autoConvert_v1beta1_BearerTokenAuthConfig_To_servicecatalog_BearerTokenAuthConfig(in *BearerTokenAuthConfig, out *servicecatalog.BearerTokenAuthConfig, s conversion.Scope) error { +func autoConvert_v1beta1_ClusterBearerTokenAuthConfig_To_servicecatalog_ClusterBearerTokenAuthConfig(in *ClusterBearerTokenAuthConfig, out *servicecatalog.ClusterBearerTokenAuthConfig, s conversion.Scope) error { out.SecretRef = (*servicecatalog.ObjectReference)(unsafe.Pointer(in.SecretRef)) return nil } -// Convert_v1beta1_BearerTokenAuthConfig_To_servicecatalog_BearerTokenAuthConfig is an autogenerated conversion function. -func Convert_v1beta1_BearerTokenAuthConfig_To_servicecatalog_BearerTokenAuthConfig(in *BearerTokenAuthConfig, out *servicecatalog.BearerTokenAuthConfig, s conversion.Scope) error { - return autoConvert_v1beta1_BearerTokenAuthConfig_To_servicecatalog_BearerTokenAuthConfig(in, out, s) +// Convert_v1beta1_ClusterBearerTokenAuthConfig_To_servicecatalog_ClusterBearerTokenAuthConfig is an autogenerated conversion function. +func Convert_v1beta1_ClusterBearerTokenAuthConfig_To_servicecatalog_ClusterBearerTokenAuthConfig(in *ClusterBearerTokenAuthConfig, out *servicecatalog.ClusterBearerTokenAuthConfig, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterBearerTokenAuthConfig_To_servicecatalog_ClusterBearerTokenAuthConfig(in, out, s) } -func autoConvert_servicecatalog_BearerTokenAuthConfig_To_v1beta1_BearerTokenAuthConfig(in *servicecatalog.BearerTokenAuthConfig, out *BearerTokenAuthConfig, s conversion.Scope) error { +func autoConvert_servicecatalog_ClusterBearerTokenAuthConfig_To_v1beta1_ClusterBearerTokenAuthConfig(in *servicecatalog.ClusterBearerTokenAuthConfig, out *ClusterBearerTokenAuthConfig, s conversion.Scope) error { out.SecretRef = (*ObjectReference)(unsafe.Pointer(in.SecretRef)) return nil } -// Convert_servicecatalog_BearerTokenAuthConfig_To_v1beta1_BearerTokenAuthConfig is an autogenerated conversion function. -func Convert_servicecatalog_BearerTokenAuthConfig_To_v1beta1_BearerTokenAuthConfig(in *servicecatalog.BearerTokenAuthConfig, out *BearerTokenAuthConfig, s conversion.Scope) error { - return autoConvert_servicecatalog_BearerTokenAuthConfig_To_v1beta1_BearerTokenAuthConfig(in, out, s) +// Convert_servicecatalog_ClusterBearerTokenAuthConfig_To_v1beta1_ClusterBearerTokenAuthConfig is an autogenerated conversion function. +func Convert_servicecatalog_ClusterBearerTokenAuthConfig_To_v1beta1_ClusterBearerTokenAuthConfig(in *servicecatalog.ClusterBearerTokenAuthConfig, out *ClusterBearerTokenAuthConfig, s conversion.Scope) error { + return autoConvert_servicecatalog_ClusterBearerTokenAuthConfig_To_v1beta1_ClusterBearerTokenAuthConfig(in, out, s) } func autoConvert_v1beta1_ClusterObjectReference_To_servicecatalog_ClusterObjectReference(in *ClusterObjectReference, out *servicecatalog.ClusterObjectReference, s conversion.Scope) error { @@ -205,6 +207,28 @@ func Convert_servicecatalog_ClusterServiceBroker_To_v1beta1_ClusterServiceBroker return autoConvert_servicecatalog_ClusterServiceBroker_To_v1beta1_ClusterServiceBroker(in, out, s) } +func autoConvert_v1beta1_ClusterServiceBrokerAuthInfo_To_servicecatalog_ClusterServiceBrokerAuthInfo(in *ClusterServiceBrokerAuthInfo, out *servicecatalog.ClusterServiceBrokerAuthInfo, s conversion.Scope) error { + out.Basic = (*servicecatalog.ClusterBasicAuthConfig)(unsafe.Pointer(in.Basic)) + out.Bearer = (*servicecatalog.ClusterBearerTokenAuthConfig)(unsafe.Pointer(in.Bearer)) + return nil +} + +// Convert_v1beta1_ClusterServiceBrokerAuthInfo_To_servicecatalog_ClusterServiceBrokerAuthInfo is an autogenerated conversion function. +func Convert_v1beta1_ClusterServiceBrokerAuthInfo_To_servicecatalog_ClusterServiceBrokerAuthInfo(in *ClusterServiceBrokerAuthInfo, out *servicecatalog.ClusterServiceBrokerAuthInfo, s conversion.Scope) error { + return autoConvert_v1beta1_ClusterServiceBrokerAuthInfo_To_servicecatalog_ClusterServiceBrokerAuthInfo(in, out, s) +} + +func autoConvert_servicecatalog_ClusterServiceBrokerAuthInfo_To_v1beta1_ClusterServiceBrokerAuthInfo(in *servicecatalog.ClusterServiceBrokerAuthInfo, out *ClusterServiceBrokerAuthInfo, s conversion.Scope) error { + out.Basic = (*ClusterBasicAuthConfig)(unsafe.Pointer(in.Basic)) + out.Bearer = (*ClusterBearerTokenAuthConfig)(unsafe.Pointer(in.Bearer)) + return nil +} + +// Convert_servicecatalog_ClusterServiceBrokerAuthInfo_To_v1beta1_ClusterServiceBrokerAuthInfo is an autogenerated conversion function. +func Convert_servicecatalog_ClusterServiceBrokerAuthInfo_To_v1beta1_ClusterServiceBrokerAuthInfo(in *servicecatalog.ClusterServiceBrokerAuthInfo, out *ClusterServiceBrokerAuthInfo, s conversion.Scope) error { + return autoConvert_servicecatalog_ClusterServiceBrokerAuthInfo_To_v1beta1_ClusterServiceBrokerAuthInfo(in, out, s) +} + func autoConvert_v1beta1_ClusterServiceBrokerList_To_servicecatalog_ClusterServiceBrokerList(in *ClusterServiceBrokerList, out *servicecatalog.ClusterServiceBrokerList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]servicecatalog.ClusterServiceBroker)(unsafe.Pointer(&in.Items)) @@ -228,13 +252,10 @@ func Convert_servicecatalog_ClusterServiceBrokerList_To_v1beta1_ClusterServiceBr } func autoConvert_v1beta1_ClusterServiceBrokerSpec_To_servicecatalog_ClusterServiceBrokerSpec(in *ClusterServiceBrokerSpec, out *servicecatalog.ClusterServiceBrokerSpec, s conversion.Scope) error { - out.URL = in.URL - out.AuthInfo = (*servicecatalog.ServiceBrokerAuthInfo)(unsafe.Pointer(in.AuthInfo)) - out.InsecureSkipTLSVerify = in.InsecureSkipTLSVerify - out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) - out.RelistBehavior = servicecatalog.ServiceBrokerRelistBehavior(in.RelistBehavior) - out.RelistDuration = (*v1.Duration)(unsafe.Pointer(in.RelistDuration)) - out.RelistRequests = in.RelistRequests + if err := Convert_v1beta1_CommonServiceBrokerSpec_To_servicecatalog_CommonServiceBrokerSpec(&in.CommonServiceBrokerSpec, &out.CommonServiceBrokerSpec, s); err != nil { + return err + } + out.AuthInfo = (*servicecatalog.ClusterServiceBrokerAuthInfo)(unsafe.Pointer(in.AuthInfo)) return nil } @@ -244,13 +265,10 @@ func Convert_v1beta1_ClusterServiceBrokerSpec_To_servicecatalog_ClusterServiceBr } func autoConvert_servicecatalog_ClusterServiceBrokerSpec_To_v1beta1_ClusterServiceBrokerSpec(in *servicecatalog.ClusterServiceBrokerSpec, out *ClusterServiceBrokerSpec, s conversion.Scope) error { - out.URL = in.URL - out.AuthInfo = (*ServiceBrokerAuthInfo)(unsafe.Pointer(in.AuthInfo)) - out.InsecureSkipTLSVerify = in.InsecureSkipTLSVerify - out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) - out.RelistBehavior = ServiceBrokerRelistBehavior(in.RelistBehavior) - out.RelistDuration = (*v1.Duration)(unsafe.Pointer(in.RelistDuration)) - out.RelistRequests = in.RelistRequests + if err := Convert_servicecatalog_CommonServiceBrokerSpec_To_v1beta1_CommonServiceBrokerSpec(&in.CommonServiceBrokerSpec, &out.CommonServiceBrokerSpec, s); err != nil { + return err + } + out.AuthInfo = (*ClusterServiceBrokerAuthInfo)(unsafe.Pointer(in.AuthInfo)) return nil } @@ -491,6 +509,36 @@ func Convert_servicecatalog_ClusterServicePlanStatus_To_v1beta1_ClusterServicePl return autoConvert_servicecatalog_ClusterServicePlanStatus_To_v1beta1_ClusterServicePlanStatus(in, out, s) } +func autoConvert_v1beta1_CommonServiceBrokerSpec_To_servicecatalog_CommonServiceBrokerSpec(in *CommonServiceBrokerSpec, out *servicecatalog.CommonServiceBrokerSpec, s conversion.Scope) error { + out.URL = in.URL + out.InsecureSkipTLSVerify = in.InsecureSkipTLSVerify + out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) + out.RelistBehavior = servicecatalog.ServiceBrokerRelistBehavior(in.RelistBehavior) + out.RelistDuration = (*v1.Duration)(unsafe.Pointer(in.RelistDuration)) + out.RelistRequests = in.RelistRequests + return nil +} + +// Convert_v1beta1_CommonServiceBrokerSpec_To_servicecatalog_CommonServiceBrokerSpec is an autogenerated conversion function. +func Convert_v1beta1_CommonServiceBrokerSpec_To_servicecatalog_CommonServiceBrokerSpec(in *CommonServiceBrokerSpec, out *servicecatalog.CommonServiceBrokerSpec, s conversion.Scope) error { + return autoConvert_v1beta1_CommonServiceBrokerSpec_To_servicecatalog_CommonServiceBrokerSpec(in, out, s) +} + +func autoConvert_servicecatalog_CommonServiceBrokerSpec_To_v1beta1_CommonServiceBrokerSpec(in *servicecatalog.CommonServiceBrokerSpec, out *CommonServiceBrokerSpec, s conversion.Scope) error { + out.URL = in.URL + out.InsecureSkipTLSVerify = in.InsecureSkipTLSVerify + out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) + out.RelistBehavior = ServiceBrokerRelistBehavior(in.RelistBehavior) + out.RelistDuration = (*v1.Duration)(unsafe.Pointer(in.RelistDuration)) + out.RelistRequests = in.RelistRequests + return nil +} + +// Convert_servicecatalog_CommonServiceBrokerSpec_To_v1beta1_CommonServiceBrokerSpec is an autogenerated conversion function. +func Convert_servicecatalog_CommonServiceBrokerSpec_To_v1beta1_CommonServiceBrokerSpec(in *servicecatalog.CommonServiceBrokerSpec, out *CommonServiceBrokerSpec, s conversion.Scope) error { + return autoConvert_servicecatalog_CommonServiceBrokerSpec_To_v1beta1_CommonServiceBrokerSpec(in, out, s) +} + func autoConvert_v1beta1_CommonServiceClassSpec_To_servicecatalog_CommonServiceClassSpec(in *CommonServiceClassSpec, out *servicecatalog.CommonServiceClassSpec, s conversion.Scope) error { out.ExternalName = in.ExternalName out.ExternalID = in.ExternalID @@ -815,28 +863,6 @@ func Convert_servicecatalog_ServiceBindingStatus_To_v1beta1_ServiceBindingStatus return autoConvert_servicecatalog_ServiceBindingStatus_To_v1beta1_ServiceBindingStatus(in, out, s) } -func autoConvert_v1beta1_ServiceBrokerAuthInfo_To_servicecatalog_ServiceBrokerAuthInfo(in *ServiceBrokerAuthInfo, out *servicecatalog.ServiceBrokerAuthInfo, s conversion.Scope) error { - out.Basic = (*servicecatalog.BasicAuthConfig)(unsafe.Pointer(in.Basic)) - out.Bearer = (*servicecatalog.BearerTokenAuthConfig)(unsafe.Pointer(in.Bearer)) - return nil -} - -// Convert_v1beta1_ServiceBrokerAuthInfo_To_servicecatalog_ServiceBrokerAuthInfo is an autogenerated conversion function. -func Convert_v1beta1_ServiceBrokerAuthInfo_To_servicecatalog_ServiceBrokerAuthInfo(in *ServiceBrokerAuthInfo, out *servicecatalog.ServiceBrokerAuthInfo, s conversion.Scope) error { - return autoConvert_v1beta1_ServiceBrokerAuthInfo_To_servicecatalog_ServiceBrokerAuthInfo(in, out, s) -} - -func autoConvert_servicecatalog_ServiceBrokerAuthInfo_To_v1beta1_ServiceBrokerAuthInfo(in *servicecatalog.ServiceBrokerAuthInfo, out *ServiceBrokerAuthInfo, s conversion.Scope) error { - out.Basic = (*BasicAuthConfig)(unsafe.Pointer(in.Basic)) - out.Bearer = (*BearerTokenAuthConfig)(unsafe.Pointer(in.Bearer)) - return nil -} - -// Convert_servicecatalog_ServiceBrokerAuthInfo_To_v1beta1_ServiceBrokerAuthInfo is an autogenerated conversion function. -func Convert_servicecatalog_ServiceBrokerAuthInfo_To_v1beta1_ServiceBrokerAuthInfo(in *servicecatalog.ServiceBrokerAuthInfo, out *ServiceBrokerAuthInfo, s conversion.Scope) error { - return autoConvert_servicecatalog_ServiceBrokerAuthInfo_To_v1beta1_ServiceBrokerAuthInfo(in, out, s) -} - func autoConvert_v1beta1_ServiceBrokerCondition_To_servicecatalog_ServiceBrokerCondition(in *ServiceBrokerCondition, out *servicecatalog.ServiceBrokerCondition, s conversion.Scope) error { out.Type = servicecatalog.ServiceBrokerConditionType(in.Type) out.Status = servicecatalog.ConditionStatus(in.Status) diff --git a/pkg/apis/servicecatalog/v1beta1/zz_generated.deepcopy.go b/pkg/apis/servicecatalog/v1beta1/zz_generated.deepcopy.go index 040ea54e390f..e73c55816a6a 100644 --- a/pkg/apis/servicecatalog/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/servicecatalog/v1beta1/zz_generated.deepcopy.go @@ -26,7 +26,7 @@ import ( ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BasicAuthConfig) DeepCopyInto(out *BasicAuthConfig) { +func (in *ClusterBasicAuthConfig) DeepCopyInto(out *ClusterBasicAuthConfig) { *out = *in if in.SecretRef != nil { in, out := &in.SecretRef, &out.SecretRef @@ -40,18 +40,18 @@ func (in *BasicAuthConfig) DeepCopyInto(out *BasicAuthConfig) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicAuthConfig. -func (in *BasicAuthConfig) DeepCopy() *BasicAuthConfig { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterBasicAuthConfig. +func (in *ClusterBasicAuthConfig) DeepCopy() *ClusterBasicAuthConfig { if in == nil { return nil } - out := new(BasicAuthConfig) + out := new(ClusterBasicAuthConfig) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BearerTokenAuthConfig) DeepCopyInto(out *BearerTokenAuthConfig) { +func (in *ClusterBearerTokenAuthConfig) DeepCopyInto(out *ClusterBearerTokenAuthConfig) { *out = *in if in.SecretRef != nil { in, out := &in.SecretRef, &out.SecretRef @@ -65,12 +65,12 @@ func (in *BearerTokenAuthConfig) DeepCopyInto(out *BearerTokenAuthConfig) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BearerTokenAuthConfig. -func (in *BearerTokenAuthConfig) DeepCopy() *BearerTokenAuthConfig { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterBearerTokenAuthConfig. +func (in *ClusterBearerTokenAuthConfig) DeepCopy() *ClusterBearerTokenAuthConfig { if in == nil { return nil } - out := new(BearerTokenAuthConfig) + out := new(ClusterBearerTokenAuthConfig) in.DeepCopyInto(out) return out } @@ -120,6 +120,40 @@ func (in *ClusterServiceBroker) DeepCopyObject() runtime.Object { } } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceBrokerAuthInfo) DeepCopyInto(out *ClusterServiceBrokerAuthInfo) { + *out = *in + if in.Basic != nil { + in, out := &in.Basic, &out.Basic + if *in == nil { + *out = nil + } else { + *out = new(ClusterBasicAuthConfig) + (*in).DeepCopyInto(*out) + } + } + if in.Bearer != nil { + in, out := &in.Bearer, &out.Bearer + if *in == nil { + *out = nil + } else { + *out = new(ClusterBearerTokenAuthConfig) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceBrokerAuthInfo. +func (in *ClusterServiceBrokerAuthInfo) DeepCopy() *ClusterServiceBrokerAuthInfo { + if in == nil { + return nil + } + out := new(ClusterServiceBrokerAuthInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterServiceBrokerList) DeepCopyInto(out *ClusterServiceBrokerList) { *out = *in @@ -157,29 +191,16 @@ func (in *ClusterServiceBrokerList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterServiceBrokerSpec) DeepCopyInto(out *ClusterServiceBrokerSpec) { *out = *in + in.CommonServiceBrokerSpec.DeepCopyInto(&out.CommonServiceBrokerSpec) if in.AuthInfo != nil { in, out := &in.AuthInfo, &out.AuthInfo if *in == nil { *out = nil } else { - *out = new(ServiceBrokerAuthInfo) + *out = new(ClusterServiceBrokerAuthInfo) (*in).DeepCopyInto(*out) } } - if in.CABundle != nil { - in, out := &in.CABundle, &out.CABundle - *out = make([]byte, len(*in)) - copy(*out, *in) - } - if in.RelistDuration != nil { - in, out := &in.RelistDuration, &out.RelistDuration - if *in == nil { - *out = nil - } else { - *out = new(v1.Duration) - **out = **in - } - } return } @@ -427,6 +448,36 @@ func (in *ClusterServicePlanStatus) DeepCopy() *ClusterServicePlanStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonServiceBrokerSpec) DeepCopyInto(out *CommonServiceBrokerSpec) { + *out = *in + if in.CABundle != nil { + in, out := &in.CABundle, &out.CABundle + *out = make([]byte, len(*in)) + copy(*out, *in) + } + if in.RelistDuration != nil { + in, out := &in.RelistDuration, &out.RelistDuration + if *in == nil { + *out = nil + } else { + *out = new(v1.Duration) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonServiceBrokerSpec. +func (in *CommonServiceBrokerSpec) DeepCopy() *CommonServiceBrokerSpec { + if in == nil { + return nil + } + out := new(CommonServiceBrokerSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CommonServiceClassSpec) DeepCopyInto(out *CommonServiceClassSpec) { *out = *in @@ -766,40 +817,6 @@ func (in *ServiceBindingStatus) DeepCopy() *ServiceBindingStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceBrokerAuthInfo) DeepCopyInto(out *ServiceBrokerAuthInfo) { - *out = *in - if in.Basic != nil { - in, out := &in.Basic, &out.Basic - if *in == nil { - *out = nil - } else { - *out = new(BasicAuthConfig) - (*in).DeepCopyInto(*out) - } - } - if in.Bearer != nil { - in, out := &in.Bearer, &out.Bearer - if *in == nil { - *out = nil - } else { - *out = new(BearerTokenAuthConfig) - (*in).DeepCopyInto(*out) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBrokerAuthInfo. -func (in *ServiceBrokerAuthInfo) DeepCopy() *ServiceBrokerAuthInfo { - if in == nil { - return nil - } - out := new(ServiceBrokerAuthInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServiceBrokerCondition) DeepCopyInto(out *ServiceBrokerCondition) { *out = *in diff --git a/pkg/apis/servicecatalog/validation/broker_test.go b/pkg/apis/servicecatalog/validation/broker_test.go index fb4707af2591..23a1239e8761 100644 --- a/pkg/apis/servicecatalog/validation/broker_test.go +++ b/pkg/apis/servicecatalog/validation/broker_test.go @@ -40,9 +40,11 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, }, valid: true, @@ -54,17 +56,19 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{ - Basic: &servicecatalog.BasicAuthConfig{ + AuthInfo: &servicecatalog.ClusterServiceBrokerAuthInfo{ + Basic: &servicecatalog.ClusterBasicAuthConfig{ SecretRef: &servicecatalog.ObjectReference{ Namespace: "test-ns", Name: "test-secret", }, }, }, - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + URL: "http://example.com", + }, }, }, valid: true, @@ -76,17 +80,19 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{ - Bearer: &servicecatalog.BearerTokenAuthConfig{ + AuthInfo: &servicecatalog.ClusterServiceBrokerAuthInfo{ + Bearer: &servicecatalog.ClusterBearerTokenAuthConfig{ SecretRef: &servicecatalog.ObjectReference{ Namespace: "test-ns", Name: "test-secret", }, }, }, - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, }, valid: true, @@ -99,9 +105,11 @@ func TestValidateClusterServiceBroker(t *testing.T) { Namespace: "oops", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, }, valid: false, @@ -113,16 +121,18 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{ - Basic: &servicecatalog.BasicAuthConfig{ + AuthInfo: &servicecatalog.ClusterServiceBrokerAuthInfo{ + Basic: &servicecatalog.ClusterBasicAuthConfig{ SecretRef: &servicecatalog.ObjectReference{ Name: "test-secret", }, }, }, - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, }, valid: false, @@ -134,16 +144,18 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{ - Basic: &servicecatalog.BasicAuthConfig{ + AuthInfo: &servicecatalog.ClusterServiceBrokerAuthInfo{ + Basic: &servicecatalog.ClusterBasicAuthConfig{ SecretRef: &servicecatalog.ObjectReference{ Namespace: "test-ns", }, }, }, - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, }, valid: false, @@ -155,16 +167,18 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{ - Bearer: &servicecatalog.BearerTokenAuthConfig{ + AuthInfo: &servicecatalog.ClusterServiceBrokerAuthInfo{ + Bearer: &servicecatalog.ClusterBearerTokenAuthConfig{ SecretRef: &servicecatalog.ObjectReference{ Name: "test-secret", }, }, }, - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, }, valid: false, @@ -176,16 +190,18 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{ - Bearer: &servicecatalog.BearerTokenAuthConfig{ + AuthInfo: &servicecatalog.ClusterServiceBrokerAuthInfo{ + Bearer: &servicecatalog.ClusterBearerTokenAuthConfig{ SecretRef: &servicecatalog.ObjectReference{ Namespace: "test-ns", }, }, }, - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, }, valid: false, @@ -197,11 +213,13 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - InsecureSkipTLSVerify: true, - CABundle: []byte("fake CABundle"), - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + InsecureSkipTLSVerify: true, + CABundle: []byte("fake CABundle"), + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, }, valid: false, @@ -213,10 +231,12 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - InsecureSkipTLSVerify: true, - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + InsecureSkipTLSVerify: true, + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, }, valid: true, @@ -228,10 +248,12 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - CABundle: []byte("fake CABundle"), - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + CABundle: []byte("fake CABundle"), + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, }, valid: true, @@ -243,9 +265,11 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorManual, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorManual, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, }, valid: false, @@ -257,9 +281,11 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorManual, - RelistDuration: nil, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorManual, + RelistDuration: nil, + }, }, }, valid: true, @@ -271,9 +297,11 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: nil, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: nil, + }, }, }, valid: false, @@ -285,8 +313,10 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: "Junk", + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: "Junk", + }, }, }, valid: false, @@ -298,8 +328,10 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: "", + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: "", + }, }, }, valid: false, @@ -311,10 +343,12 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, - RelistRequests: -1, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + RelistRequests: -1, + }, }, }, valid: false, @@ -326,9 +360,11 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: -15 * time.Minute}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: -15 * time.Minute}, + }, }, }, valid: false, @@ -358,10 +394,12 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, - RelistRequests: 1, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + RelistRequests: 1, + }, }, }, oldBroker: &servicecatalog.ClusterServiceBroker{ @@ -369,10 +407,12 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, - RelistRequests: 1, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + RelistRequests: 1, + }, }, }, valid: true, @@ -384,10 +424,12 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, - RelistRequests: 2, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + RelistRequests: 2, + }, }, }, oldBroker: &servicecatalog.ClusterServiceBroker{ @@ -395,10 +437,12 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, - RelistRequests: 1, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + RelistRequests: 1, + }, }, }, valid: true, @@ -410,10 +454,12 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, - RelistRequests: 1, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + RelistRequests: 1, + }, }, }, oldBroker: &servicecatalog.ClusterServiceBroker{ @@ -421,10 +467,12 @@ func TestValidateClusterServiceBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, - RelistRequests: 2, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: servicecatalog.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + RelistRequests: 2, + }, }, }, valid: false, diff --git a/pkg/apis/servicecatalog/zz_generated.deepcopy.go b/pkg/apis/servicecatalog/zz_generated.deepcopy.go index 22e258aba017..33edb641f9d0 100644 --- a/pkg/apis/servicecatalog/zz_generated.deepcopy.go +++ b/pkg/apis/servicecatalog/zz_generated.deepcopy.go @@ -26,7 +26,7 @@ import ( ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BasicAuthConfig) DeepCopyInto(out *BasicAuthConfig) { +func (in *ClusterBasicAuthConfig) DeepCopyInto(out *ClusterBasicAuthConfig) { *out = *in if in.SecretRef != nil { in, out := &in.SecretRef, &out.SecretRef @@ -40,18 +40,18 @@ func (in *BasicAuthConfig) DeepCopyInto(out *BasicAuthConfig) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicAuthConfig. -func (in *BasicAuthConfig) DeepCopy() *BasicAuthConfig { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterBasicAuthConfig. +func (in *ClusterBasicAuthConfig) DeepCopy() *ClusterBasicAuthConfig { if in == nil { return nil } - out := new(BasicAuthConfig) + out := new(ClusterBasicAuthConfig) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BearerTokenAuthConfig) DeepCopyInto(out *BearerTokenAuthConfig) { +func (in *ClusterBearerTokenAuthConfig) DeepCopyInto(out *ClusterBearerTokenAuthConfig) { *out = *in if in.SecretRef != nil { in, out := &in.SecretRef, &out.SecretRef @@ -65,12 +65,12 @@ func (in *BearerTokenAuthConfig) DeepCopyInto(out *BearerTokenAuthConfig) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BearerTokenAuthConfig. -func (in *BearerTokenAuthConfig) DeepCopy() *BearerTokenAuthConfig { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterBearerTokenAuthConfig. +func (in *ClusterBearerTokenAuthConfig) DeepCopy() *ClusterBearerTokenAuthConfig { if in == nil { return nil } - out := new(BearerTokenAuthConfig) + out := new(ClusterBearerTokenAuthConfig) in.DeepCopyInto(out) return out } @@ -120,6 +120,40 @@ func (in *ClusterServiceBroker) DeepCopyObject() runtime.Object { } } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterServiceBrokerAuthInfo) DeepCopyInto(out *ClusterServiceBrokerAuthInfo) { + *out = *in + if in.Basic != nil { + in, out := &in.Basic, &out.Basic + if *in == nil { + *out = nil + } else { + *out = new(ClusterBasicAuthConfig) + (*in).DeepCopyInto(*out) + } + } + if in.Bearer != nil { + in, out := &in.Bearer, &out.Bearer + if *in == nil { + *out = nil + } else { + *out = new(ClusterBearerTokenAuthConfig) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterServiceBrokerAuthInfo. +func (in *ClusterServiceBrokerAuthInfo) DeepCopy() *ClusterServiceBrokerAuthInfo { + if in == nil { + return nil + } + out := new(ClusterServiceBrokerAuthInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterServiceBrokerList) DeepCopyInto(out *ClusterServiceBrokerList) { *out = *in @@ -157,29 +191,16 @@ func (in *ClusterServiceBrokerList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterServiceBrokerSpec) DeepCopyInto(out *ClusterServiceBrokerSpec) { *out = *in + in.CommonServiceBrokerSpec.DeepCopyInto(&out.CommonServiceBrokerSpec) if in.AuthInfo != nil { in, out := &in.AuthInfo, &out.AuthInfo if *in == nil { *out = nil } else { - *out = new(ServiceBrokerAuthInfo) + *out = new(ClusterServiceBrokerAuthInfo) (*in).DeepCopyInto(*out) } } - if in.CABundle != nil { - in, out := &in.CABundle, &out.CABundle - *out = make([]byte, len(*in)) - copy(*out, *in) - } - if in.RelistDuration != nil { - in, out := &in.RelistDuration, &out.RelistDuration - if *in == nil { - *out = nil - } else { - *out = new(v1.Duration) - **out = **in - } - } return } @@ -427,6 +448,36 @@ func (in *ClusterServicePlanStatus) DeepCopy() *ClusterServicePlanStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonServiceBrokerSpec) DeepCopyInto(out *CommonServiceBrokerSpec) { + *out = *in + if in.CABundle != nil { + in, out := &in.CABundle, &out.CABundle + *out = make([]byte, len(*in)) + copy(*out, *in) + } + if in.RelistDuration != nil { + in, out := &in.RelistDuration, &out.RelistDuration + if *in == nil { + *out = nil + } else { + *out = new(v1.Duration) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonServiceBrokerSpec. +func (in *CommonServiceBrokerSpec) DeepCopy() *CommonServiceBrokerSpec { + if in == nil { + return nil + } + out := new(CommonServiceBrokerSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CommonServiceClassSpec) DeepCopyInto(out *CommonServiceClassSpec) { *out = *in @@ -766,40 +817,6 @@ func (in *ServiceBindingStatus) DeepCopy() *ServiceBindingStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceBrokerAuthInfo) DeepCopyInto(out *ServiceBrokerAuthInfo) { - *out = *in - if in.Basic != nil { - in, out := &in.Basic, &out.Basic - if *in == nil { - *out = nil - } else { - *out = new(BasicAuthConfig) - (*in).DeepCopyInto(*out) - } - } - if in.Bearer != nil { - in, out := &in.Bearer, &out.Bearer - if *in == nil { - *out = nil - } else { - *out = new(BearerTokenAuthConfig) - (*in).DeepCopyInto(*out) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBrokerAuthInfo. -func (in *ServiceBrokerAuthInfo) DeepCopy() *ServiceBrokerAuthInfo { - if in == nil { - return nil - } - out := new(ServiceBrokerAuthInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServiceBrokerCondition) DeepCopyInto(out *ServiceBrokerCondition) { *out = *in diff --git a/pkg/controller/controller_broker_test.go b/pkg/controller/controller_broker_test.go index bc1d37166ec4..33d8e9b5e941 100644 --- a/pkg/controller/controller_broker_test.go +++ b/pkg/controller/controller_broker_test.go @@ -724,16 +724,16 @@ func TestReconcileClusterServiceBrokerZeroServices(t *testing.T) { } func TestReconcileClusterServiceBrokerWithAuth(t *testing.T) { - basicAuthInfo := &v1beta1.ServiceBrokerAuthInfo{ - Basic: &v1beta1.BasicAuthConfig{ + basicAuthInfo := &v1beta1.ClusterServiceBrokerAuthInfo{ + Basic: &v1beta1.ClusterBasicAuthConfig{ SecretRef: &v1beta1.ObjectReference{ Namespace: "test-ns", Name: "auth-secret", }, }, } - bearerAuthInfo := &v1beta1.ServiceBrokerAuthInfo{ - Bearer: &v1beta1.BearerTokenAuthConfig{ + bearerAuthInfo := &v1beta1.ClusterServiceBrokerAuthInfo{ + Bearer: &v1beta1.ClusterBearerTokenAuthConfig{ SecretRef: &v1beta1.ObjectReference{ Namespace: "test-ns", Name: "auth-secret", @@ -761,7 +761,7 @@ func TestReconcileClusterServiceBrokerWithAuth(t *testing.T) { // shouldSucceed: whether authentication should succeed cases := []struct { name string - authInfo *v1beta1.ServiceBrokerAuthInfo + authInfo *v1beta1.ClusterServiceBrokerAuthInfo secret *corev1.Secret shouldSucceed bool }{ @@ -811,7 +811,7 @@ func TestReconcileClusterServiceBrokerWithAuth(t *testing.T) { } } -func testReconcileClusterServiceBrokerWithAuth(t *testing.T, authInfo *v1beta1.ServiceBrokerAuthInfo, secret *corev1.Secret, shouldSucceed bool) { +func testReconcileClusterServiceBrokerWithAuth(t *testing.T, authInfo *v1beta1.ClusterServiceBrokerAuthInfo, secret *corev1.Secret, shouldSucceed bool) { fakeKubeClient, fakeCatalogClient, fakeClusterServiceBrokerClient, testController, _ := newTestController(t, fakeosb.FakeClientConfiguration{}) broker := getTestClusterServiceBrokerWithAuth(authInfo) diff --git a/pkg/controller/controller_instance_test.go b/pkg/controller/controller_instance_test.go index e284f8d13163..c1fc4fe0d2c2 100644 --- a/pkg/controller/controller_instance_test.go +++ b/pkg/controller/controller_instance_test.go @@ -184,8 +184,8 @@ func TestReconcileServiceInstanceWithAuthError(t *testing.T) { fakeKubeClient, fakeCatalogClient, fakeClusterServiceBrokerClient, testController, sharedInformers := newTestController(t, noFakeActions()) broker := getTestClusterServiceBroker() - broker.Spec.AuthInfo = &v1beta1.ServiceBrokerAuthInfo{ - Basic: &v1beta1.BasicAuthConfig{ + broker.Spec.AuthInfo = &v1beta1.ClusterServiceBrokerAuthInfo{ + Basic: &v1beta1.ClusterBasicAuthConfig{ SecretRef: &v1beta1.ObjectReference{ Namespace: "does_not_exist", Name: "auth-name", diff --git a/pkg/controller/controller_test.go b/pkg/controller/controller_test.go index 5cab692d82ca..9873cb87a65f 100644 --- a/pkg/controller/controller_test.go +++ b/pkg/controller/controller_test.go @@ -360,9 +360,11 @@ func getTestClusterServiceBroker() *v1beta1.ClusterServiceBroker { return &v1beta1.ClusterServiceBroker{ ObjectMeta: metav1.ObjectMeta{Name: testClusterServiceBrokerName}, Spec: v1beta1.ClusterServiceBrokerSpec{ - URL: "https://example.com", - RelistBehavior: v1beta1.ServiceBrokerRelistBehaviorDuration, - RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + CommonServiceBrokerSpec: v1beta1.CommonServiceBrokerSpec{ + URL: "https://example.com", + RelistBehavior: v1beta1.ServiceBrokerRelistBehaviorDuration, + RelistDuration: &metav1.Duration{Duration: 15 * time.Minute}, + }, }, } } @@ -394,7 +396,7 @@ func getTestClusterServiceBrokerWithStatusAndTime(status v1beta1.ConditionStatus return broker } -func getTestClusterServiceBrokerWithAuth(authInfo *v1beta1.ServiceBrokerAuthInfo) *v1beta1.ClusterServiceBroker { +func getTestClusterServiceBrokerWithAuth(authInfo *v1beta1.ClusterServiceBrokerAuthInfo) *v1beta1.ClusterServiceBroker { broker := getTestClusterServiceBroker() broker.Spec.AuthInfo = authInfo return broker diff --git a/pkg/openapi/openapi_generated.go b/pkg/openapi/openapi_generated.go index 38298b69b69b..fb66d884221c 100644 --- a/pkg/openapi/openapi_generated.go +++ b/pkg/openapi/openapi_generated.go @@ -29,10 +29,10 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.BasicAuthConfig": { + "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterBasicAuthConfig": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "BasicAuthConfig provides config for the basic authentication.", + Description: "ClusterBasicAuthConfig provides config for the basic authentication of cluster scoped brokers.", Properties: map[string]spec.Schema{ "secretRef": { SchemaProps: spec.SchemaProps{ @@ -46,10 +46,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Dependencies: []string{ "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ObjectReference"}, }, - "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.BearerTokenAuthConfig": { + "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterBearerTokenAuthConfig": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "BearerTokenAuthConfig provides config for the bearer token authentication.", + Description: "ClusterBearerTokenAuthConfig provides config for the bearer token authentication of cluster scoped brokers.", Properties: map[string]spec.Schema{ "secretRef": { SchemaProps: spec.SchemaProps{ @@ -128,6 +128,29 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Dependencies: []string{ "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterServiceBrokerSpec", "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterServiceBrokerStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, }, + "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterServiceBrokerAuthInfo": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterServiceBrokerAuthInfo is a union type that contains information on one of the authentication methods the the service catalog and brokers may support, according to the OpenServiceBroker API specification (https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md).", + Properties: map[string]spec.Schema{ + "basic": { + SchemaProps: spec.SchemaProps{ + Description: "ClusterBasicAuthConfigprovides configuration for basic authentication.", + Ref: ref("github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterBasicAuthConfig"), + }, + }, + "bearer": { + SchemaProps: spec.SchemaProps{ + Description: "ClusterBearerTokenAuthConfig provides configuration to send an opaque value as a bearer token. The value is referenced from the 'token' field of the given secret. This value should only contain the token value and not the `Bearer` scheme.", + Ref: ref("github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterBearerTokenAuthConfig"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterBasicAuthConfig", "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterBearerTokenAuthConfig"}, + }, "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterServiceBrokerList": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -178,17 +201,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Properties: map[string]spec.Schema{ "url": { SchemaProps: spec.SchemaProps{ - Description: "URL is the address used to communicate with the ClusterServiceBroker.", + Description: "URL is the address used to communicate with the ServiceBroker.", Type: []string{"string"}, Format: "", }, }, - "authInfo": { - SchemaProps: spec.SchemaProps{ - Description: "AuthInfo contains the data that the service catalog should use to authenticate with the ClusterServiceBroker.", - Ref: ref("github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ServiceBrokerAuthInfo"), - }, - }, "insecureSkipTLSVerify": { SchemaProps: spec.SchemaProps{ Description: "InsecureSkipTLSVerify disables TLS certificate verification when communicating with this Broker. This is strongly discouraged. You should use the CABundle instead.", @@ -205,7 +222,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "relistBehavior": { SchemaProps: spec.SchemaProps{ - Description: "RelistBehavior specifies the type of relist behavior the catalog should exhibit when relisting ClusterServiceClasses available from a broker.", + Description: "RelistBehavior specifies the type of relist behavior the catalog should exhibit when relisting ServiceClasses available from a broker.", Type: []string{"string"}, Format: "", }, @@ -223,12 +240,18 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Format: "int64", }, }, + "authInfo": { + SchemaProps: spec.SchemaProps{ + Description: "AuthInfo contains the data that the service catalog should use to authenticate with the ClusterServiceBroker.", + Ref: ref("github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterServiceBrokerAuthInfo"), + }, + }, }, Required: []string{"url"}, }, }, Dependencies: []string{ - "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ServiceBrokerAuthInfo", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterServiceBrokerAuthInfo", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, }, "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ClusterServiceBrokerStatus": { Schema: spec.Schema{ @@ -670,6 +693,59 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, Dependencies: []string{}, }, + "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.CommonServiceBrokerSpec": { + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "CommonServiceBrokerSpec represents a description of a Broker.", + Properties: map[string]spec.Schema{ + "url": { + SchemaProps: spec.SchemaProps{ + Description: "URL is the address used to communicate with the ServiceBroker.", + Type: []string{"string"}, + Format: "", + }, + }, + "insecureSkipTLSVerify": { + SchemaProps: spec.SchemaProps{ + Description: "InsecureSkipTLSVerify disables TLS certificate verification when communicating with this Broker. This is strongly discouraged. You should use the CABundle instead.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "caBundle": { + SchemaProps: spec.SchemaProps{ + Description: "CABundle is a PEM encoded CA bundle which will be used to validate a Broker's serving certificate.", + Type: []string{"string"}, + Format: "byte", + }, + }, + "relistBehavior": { + SchemaProps: spec.SchemaProps{ + Description: "RelistBehavior specifies the type of relist behavior the catalog should exhibit when relisting ServiceClasses available from a broker.", + Type: []string{"string"}, + Format: "", + }, + }, + "relistDuration": { + SchemaProps: spec.SchemaProps{ + Description: "RelistDuration is the frequency by which a controller will relist the broker when the RelistBehavior is set to ServiceBrokerRelistBehaviorDuration. Users are cautioned against configuring low values for the RelistDuration, as this can easily overload the controller manager in an environment with many brokers. The actual interval is intrinsically governed by the configured resync interval of the controller, which acts as a minimum bound. For example, with a resync interval of 5m and a RelistDuration of 2m, relists will occur at the resync interval of 5m.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "relistRequests": { + SchemaProps: spec.SchemaProps{ + Description: "RelistRequests is a strictly increasing, non-negative integer counter that can be manually incremented by a user to manually trigger a relist.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + }, + Required: []string{"url"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + }, "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.CommonServiceClassSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1187,29 +1263,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Dependencies: []string{ "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ServiceBindingCondition", "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ServiceBindingPropertiesState", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, }, - "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ServiceBrokerAuthInfo": { - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ServiceBrokerAuthInfo is a union type that contains information on one of the authentication methods the the service catalog and brokers may support, according to the OpenServiceBroker API specification (https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md).", - Properties: map[string]spec.Schema{ - "basic": { - SchemaProps: spec.SchemaProps{ - Description: "Basic provides configuration for basic authentication.", - Ref: ref("github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.BasicAuthConfig"), - }, - }, - "bearer": { - SchemaProps: spec.SchemaProps{ - Description: "BearerTokenAuthConfig provides configuration to send an opaque value as a bearer token. The value is referenced from the 'token' field of the given secret. This value should only contain the token value and not the `Bearer` scheme.", - Ref: ref("github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.BearerTokenAuthConfig"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.BasicAuthConfig", "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.BearerTokenAuthConfig"}, - }, "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ServiceBrokerCondition": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ diff --git a/pkg/registry/servicecatalog/broker/strategy_test.go b/pkg/registry/servicecatalog/broker/strategy_test.go index 10f55fa2f4bf..00b47f7e93dd 100644 --- a/pkg/registry/servicecatalog/broker/strategy_test.go +++ b/pkg/registry/servicecatalog/broker/strategy_test.go @@ -29,7 +29,9 @@ func brokerWithOldSpec() *sc.ClusterServiceBroker { Generation: 1, }, Spec: sc.ClusterServiceBrokerSpec{ - URL: "https://kubernetes.default.svc:443/brokers/template.k8s.io", + CommonServiceBrokerSpec: sc.CommonServiceBrokerSpec{ + URL: "https://kubernetes.default.svc:443/brokers/template.k8s.io", + }, }, Status: sc.ClusterServiceBrokerStatus{ Conditions: []sc.ServiceBrokerCondition{ @@ -70,7 +72,9 @@ func TestBroker(t *testing.T) { // Create a broker or brokers broker := &sc.ClusterServiceBroker{ Spec: sc.ClusterServiceBrokerSpec{ - URL: "abcd", + CommonServiceBrokerSpec: sc.CommonServiceBrokerSpec{ + URL: "abcd", + }, }, Status: sc.ClusterServiceBrokerStatus{ Conditions: nil, diff --git a/plugin/pkg/admission/broker/authsarcheck/admission_test.go b/plugin/pkg/admission/broker/authsarcheck/admission_test.go index 5f63f1f99d04..87cee748278c 100644 --- a/plugin/pkg/admission/broker/authsarcheck/admission_test.go +++ b/plugin/pkg/admission/broker/authsarcheck/admission_test.go @@ -89,8 +89,10 @@ func TestAdmissionBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: "Manual", + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: "Manual", + }, }, }, userInfo: &user.DefaultInfo{ @@ -106,16 +108,18 @@ func TestAdmissionBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: "Manual", - AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{ - Basic: &servicecatalog.BasicAuthConfig{ + AuthInfo: &servicecatalog.ClusterServiceBrokerAuthInfo{ + Basic: &servicecatalog.ClusterBasicAuthConfig{ SecretRef: &servicecatalog.ObjectReference{ Namespace: "test-ns", Name: "test-secret", }, }, }, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: "Manual", + }, }, }, userInfo: &user.DefaultInfo{ @@ -131,16 +135,18 @@ func TestAdmissionBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: "Manual", - AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{ - Bearer: &servicecatalog.BearerTokenAuthConfig{ + AuthInfo: &servicecatalog.ClusterServiceBrokerAuthInfo{ + Bearer: &servicecatalog.ClusterBearerTokenAuthConfig{ SecretRef: &servicecatalog.ObjectReference{ Namespace: "test-ns", Name: "test-secret", }, }, }, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: "Manual", + }, }, }, userInfo: &user.DefaultInfo{ @@ -156,16 +162,18 @@ func TestAdmissionBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: "Manual", - AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{ - Bearer: &servicecatalog.BearerTokenAuthConfig{ + AuthInfo: &servicecatalog.ClusterServiceBrokerAuthInfo{ + Bearer: &servicecatalog.ClusterBearerTokenAuthConfig{ SecretRef: &servicecatalog.ObjectReference{ Namespace: "test-ns", Name: "test-secret", }, }, }, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: "Manual", + }, }, }, userInfo: &user.DefaultInfo{ @@ -181,9 +189,11 @@ func TestAdmissionBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: "Manual", - AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{}, + AuthInfo: &servicecatalog.ClusterServiceBrokerAuthInfo{}, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: "Manual", + }, }, }, userInfo: &user.DefaultInfo{ @@ -199,16 +209,18 @@ func TestAdmissionBroker(t *testing.T) { Name: "test-broker", }, Spec: servicecatalog.ClusterServiceBrokerSpec{ - URL: "http://example.com", - RelistBehavior: "Manual", - AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{ - Bearer: &servicecatalog.BearerTokenAuthConfig{ + AuthInfo: &servicecatalog.ClusterServiceBrokerAuthInfo{ + Bearer: &servicecatalog.ClusterBearerTokenAuthConfig{ SecretRef: &servicecatalog.ObjectReference{ Namespace: "", Name: "", }, }, }, + CommonServiceBrokerSpec: servicecatalog.CommonServiceBrokerSpec{ + URL: "http://example.com", + RelistBehavior: "Manual", + }, }, }, userInfo: &user.DefaultInfo{ diff --git a/test/e2e/broker.go b/test/e2e/broker.go index ad7968d201a4..9099119a5a83 100644 --- a/test/e2e/broker.go +++ b/test/e2e/broker.go @@ -32,7 +32,9 @@ func newTestBroker(name, url string) *v1beta1.ClusterServiceBroker { Name: name, }, Spec: v1beta1.ClusterServiceBrokerSpec{ - URL: url, + CommonServiceBrokerSpec: v1beta1.CommonServiceBrokerSpec{ + URL: url, + }, }, } } diff --git a/test/e2e/walkthrough.go b/test/e2e/walkthrough.go index 0cc18758ab0e..ef2d79779a27 100644 --- a/test/e2e/walkthrough.go +++ b/test/e2e/walkthrough.go @@ -108,7 +108,9 @@ var _ = framework.ServiceCatalogDescribe("walkthrough", func() { Name: brokerName, }, Spec: v1beta1.ClusterServiceBrokerSpec{ - URL: url, + CommonServiceBrokerSpec: v1beta1.CommonServiceBrokerSpec{ + URL: url, + }, }, } broker, err := f.ServiceCatalogClientSet.ServicecatalogV1beta1().ClusterServiceBrokers().Create(broker) diff --git a/test/integration/clientset_test.go b/test/integration/clientset_test.go index ae1a4289c6de..7027d013ab6a 100644 --- a/test/integration/clientset_test.go +++ b/test/integration/clientset_test.go @@ -230,7 +230,9 @@ func testBrokerClient(sType server.StorageType, client servicecatalogclient.Inte broker := &v1beta1.ClusterServiceBroker{ ObjectMeta: metav1.ObjectMeta{Name: name}, Spec: v1beta1.ClusterServiceBrokerSpec{ - URL: "https://example.com", + CommonServiceBrokerSpec: v1beta1.CommonServiceBrokerSpec{ + URL: "https://example.com", + }, }, } @@ -285,8 +287,8 @@ func testBrokerClient(sType server.StorageType, client servicecatalogclient.Inte Name: "test-name", } - brokerServer.Spec.AuthInfo = &v1beta1.ServiceBrokerAuthInfo{ - Basic: &v1beta1.BasicAuthConfig{ + brokerServer.Spec.AuthInfo = &v1beta1.ClusterServiceBrokerAuthInfo{ + Basic: &v1beta1.ClusterBasicAuthConfig{ SecretRef: authSecret, }, } diff --git a/test/integration/controller_instance_test.go b/test/integration/controller_instance_test.go index 7d82a270f104..649a0f32eb4d 100644 --- a/test/integration/controller_instance_test.go +++ b/test/integration/controller_instance_test.go @@ -201,8 +201,8 @@ func TestCreateServiceInstanceWithAuthError(t *testing.T) { t: t, broker: func() *v1beta1.ClusterServiceBroker { b := getTestBroker() - b.Spec.AuthInfo = &v1beta1.ServiceBrokerAuthInfo{ - Basic: &v1beta1.BasicAuthConfig{ + b.Spec.AuthInfo = &v1beta1.ClusterServiceBrokerAuthInfo{ + Basic: &v1beta1.ClusterBasicAuthConfig{ SecretRef: &v1beta1.ObjectReference{ Namespace: testNamespace, Name: "secret-name", diff --git a/test/integration/controller_test.go b/test/integration/controller_test.go index dcc69b38d00c..b01f361b7400 100644 --- a/test/integration/controller_test.go +++ b/test/integration/controller_test.go @@ -876,7 +876,9 @@ func getTestBroker() *v1beta1.ClusterServiceBroker { return &v1beta1.ClusterServiceBroker{ ObjectMeta: metav1.ObjectMeta{Name: testClusterServiceBrokerName}, Spec: v1beta1.ClusterServiceBrokerSpec{ - URL: testBrokerURL, + CommonServiceBrokerSpec: v1beta1.CommonServiceBrokerSpec{ + URL: testBrokerURL, + }, }, } }