Skip to content

Commit

Permalink
Stop using corev1.ObjectReference and corev1.LocalObjectReference (#1417
Browse files Browse the repository at this point in the history
)

* Fix lint errors

* Stop using corev1.ObjectReference and corev1.LocalObjectReference
  • Loading branch information
nilebox authored and Ville Aikas committed Oct 18, 2017
1 parent fcf9480 commit 7852917
Show file tree
Hide file tree
Showing 28 changed files with 498 additions and 234 deletions.
38 changes: 30 additions & 8 deletions pkg/apis/servicecatalog/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package servicecatalog

import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
Expand Down Expand Up @@ -105,7 +104,7 @@ type ServiceBrokerAuthInfo struct {
// DEPRECATED: use `Basic` field for configuring basic authentication instead.
// BasicAuthSecret is a reference to a Secret containing auth information the
// catalog should use to authenticate to this ServiceBroker using basic auth.
BasicAuthSecret *v1.ObjectReference
BasicAuthSecret *ObjectReference
}

// BasicAuthConfig provides config for the basic authentication.
Expand All @@ -116,7 +115,7 @@ type BasicAuthConfig struct {
// Required at least one of the fields:
// - Secret.Data["username"] - username used for authentication
// - Secret.Data["password"] - password or token needed for authentication
SecretRef *v1.ObjectReference
SecretRef *ObjectReference
}

// BearerTokenAuthConfig provides config for the bearer token authentication.
Expand All @@ -126,7 +125,7 @@ type BearerTokenAuthConfig struct {
//
// Required field:
// - Secret.Data["token"] - bearer token for authentication
SecretRef *v1.ObjectReference
SecretRef *ObjectReference
}

const (
Expand Down Expand Up @@ -367,7 +366,7 @@ type ClusterServicePlanSpec struct {

// ClusterServiceClassRef is a reference to the service class that
// owns this plan.
ClusterServiceClassRef v1.LocalObjectReference
ClusterServiceClassRef ClusterObjectReference
}

// ClusterServicePlanStatus represents status information about a
Expand Down Expand Up @@ -448,11 +447,11 @@ type ServiceInstanceSpec struct {
// ClusterServiceClassRef is a reference to the ClusterServiceClass
// that the user selected.
// This is set by the controller based on ExternalClusterServiceClassName
ClusterServiceClassRef *v1.ObjectReference
ClusterServiceClassRef *ClusterObjectReference
// ClusterServicePlanRef is a reference to the ClusterServicePlan
// that the user selected.
// This is set by the controller based on ExternalClusterServicePlanName
ClusterServicePlanRef *v1.ObjectReference
ClusterServicePlanRef *ClusterObjectReference

// Parameters is a set of the parameters to be passed to the underlying
// broker. The inline YAML/JSON payload to be translated into equivalent
Expand Down Expand Up @@ -643,7 +642,7 @@ type ServiceBindingSpec struct {
// ServiceInstanceRef is the reference to the Instance this ServiceBinding is to.
//
// Immutable.
ServiceInstanceRef v1.LocalObjectReference
ServiceInstanceRef LocalObjectReference

// Parameters is a set of the parameters to be passed to the underlying
// broker. The inline YAML/JSON payload to be translated into equivalent
Expand Down Expand Up @@ -797,3 +796,26 @@ type SecretKeyReference struct {
// The key of the secret to select from. Must be a valid secret key.
Key string
}

// ObjectReference contains enough information to let you locate the
// referenced object.
type ObjectReference struct {
// Namespace of the referent.
Namespace string
// Name of the referent.
Name string
}

// LocalObjectReference contains enough information to let you locate the
// referenced object inside the same namespace.
type LocalObjectReference struct {
// Name of the referent.
Name string
}

// ClusterObjectReference contains enough information to let you locate the
// cluster-scoped referenced object.
type ClusterObjectReference struct {
// Name of the referent.
Name string
}
38 changes: 30 additions & 8 deletions pkg/apis/servicecatalog/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package v1beta1

import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
Expand Down Expand Up @@ -105,7 +104,7 @@ type ServiceBrokerAuthInfo struct {
// DEPRECATED: use `Basic` field for configuring basic authentication instead.
// BasicAuthSecret is a reference to a Secret containing auth information the
// catalog should use to authenticate to this ServiceBroker using basic auth.
BasicAuthSecret *v1.ObjectReference `json:"basicAuthSecret,omitempty"`
BasicAuthSecret *ObjectReference `json:"basicAuthSecret,omitempty"`
}

// BasicAuthConfig provides config for the basic authentication.
Expand All @@ -116,7 +115,7 @@ type BasicAuthConfig struct {
// Required at least one of the fields:
// - Secret.Data["username"] - username used for authentication
// - Secret.Data["password"] - password or token needed for authentication
SecretRef *v1.ObjectReference `json:"secretRef,omitempty"`
SecretRef *ObjectReference `json:"secretRef,omitempty"`
}

// BearerTokenAuthConfig provides config for the bearer token authentication.
Expand All @@ -126,7 +125,7 @@ type BearerTokenAuthConfig struct {
//
// Required field:
// - Secret.Data["token"] - bearer token for authentication
SecretRef *v1.ObjectReference `json:"secretRef,omitempty"`
SecretRef *ObjectReference `json:"secretRef,omitempty"`
}

const (
Expand Down Expand Up @@ -372,7 +371,7 @@ type ClusterServicePlanSpec struct {

// ClusterServiceClassRef is a reference to the service class that
// owns this plan.
ClusterServiceClassRef v1.LocalObjectReference `json:"clusterServiceClassRef"`
ClusterServiceClassRef ClusterObjectReference `json:"clusterServiceClassRef"`
}

// ClusterServicePlanStatus represents status information about a
Expand Down Expand Up @@ -468,12 +467,12 @@ type ServiceInstanceSpec struct {
// that the user selected.
// This is set by the controller based on
// ExternalClusterServiceClassName
ClusterServiceClassRef *v1.ObjectReference `json:"clusterServiceClassRef,omitempty"`
ClusterServiceClassRef *ClusterObjectReference `json:"clusterServiceClassRef,omitempty"`
// ClusterServicePlanRef is a reference to the ClusterServicePlan
// that the user selected.
// This is set by the controller based on
// ExternalClusterServicePlanName
ClusterServicePlanRef *v1.ObjectReference `json:"clusterServicePlanRef,omitempty"`
ClusterServicePlanRef *ClusterObjectReference `json:"clusterServicePlanRef,omitempty"`

// Parameters is a set of the parameters to be passed to the underlying
// broker. The inline YAML/JSON payload to be translated into equivalent
Expand Down Expand Up @@ -664,7 +663,7 @@ type ServiceBindingSpec struct {
// ServiceInstanceRef is the reference to the Instance this ServiceBinding is to.
//
// Immutable.
ServiceInstanceRef v1.LocalObjectReference `json:"instanceRef"`
ServiceInstanceRef LocalObjectReference `json:"instanceRef"`

// Parameters is a set of the parameters to be passed to the underlying
// broker. The inline YAML/JSON payload to be translated into equivalent
Expand Down Expand Up @@ -818,3 +817,26 @@ type SecretKeyReference struct {
// The key of the secret to select from. Must be a valid secret key.
Key string `json:"key"`
}

// ObjectReference contains enough information to let you locate the
// referenced object.
type ObjectReference struct {
// Namespace of the referent.
Namespace string `json:"namespace,omitempty"`
// Name of the referent.
Name string `json:"name,omitempty"`
}

// LocalObjectReference contains enough information to let you locate the
// referenced object inside the same namespace.
type LocalObjectReference struct {
// Name of the referent.
Name string `json:"name,omitempty"`
}

// ClusterObjectReference contains enough information to let you locate the
// cluster-scoped referenced object.
type ClusterObjectReference struct {
// Name of the referent.
Name string `json:"name,omitempty"`
}
Loading

0 comments on commit 7852917

Please sign in to comment.