tpr

package
v0.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2017 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServiceBrokerResource = metav1.APIResource{
	Name:       ServiceBrokerKind.TPRName(),
	Namespaced: true,
}

ServiceBrokerResource represents the API resource for the service broker third party resource

View Source
var ServiceClassResource = metav1.APIResource{
	Name:       ServiceClassKind.TPRName(),
	Namespaced: true,
}

ServiceClassResource represents the API resource for the service class third party resource

View Source
var ServiceInstanceCredentialResource = metav1.APIResource{
	Name:       ServiceInstanceCredentialKind.TPRName(),
	Namespaced: true,
}

ServiceInstanceCredentialResource represents the API resource for the service

instance credential third party resource
View Source
var ServiceInstanceResource = metav1.APIResource{
	Name:       ServiceInstanceKind.TPRName(),
	Namespaced: true,
}

ServiceInstanceResource represents the API resource for the service instance third party resource

Functions

func FromUnstructured

func FromUnstructured(in runtime.Unstructured, out runtime.Object) error

FromUnstructured converts o, a Kubernetes Third Party Resource type, into a *runtime.Unstructured and writes it to object. Returns a non-nil error is there were any issues with the conversion

func GetResourceClient

func GetResourceClient(cl *dynamic.Client, kind Kind, namespace string) (*dynamic.ResourceClient, error)

GetResourceClient returns the *dynamic.ResourceClient for a given resource type

func InstallTypes

InstallTypes installs all third party resource types to the cluster

func NewStorage

func NewStorage(opts Options) (storage.Interface, factory.DestroyFunc)

NewStorage creates a new TPR-based storage.Interface implementation

func ToUnstructured

func ToUnstructured(in runtime.Object) (*runtime.Unstructured, error)

ToUnstructured converts in (which should be a Service Catalog third party object type) into a runtime.Unstructured for use in writing to Kubernetes

Types

type ErrTPRInstall

type ErrTPRInstall struct {
	// contains filtered or unexported fields
}

ErrTPRInstall is returned when we fail to install TPR

func (ErrTPRInstall) Error

func (e ErrTPRInstall) Error() string

type Keyer

type Keyer struct {
	DefaultNamespace string
	ResourceName     string
	Separator        string
}

Keyer is a containing struct for

func (Keyer) Key

func (k Keyer) Key(ctx request.Context, name string) (string, error)

Key is a (k8s.io/kubernetes/pkg/registry/generic/registry).Store compatible function to get the key to be passed to a third party resource based storage Interface.

It is meant to be passed to a Store's KeyRoot field, so that a TPR based storage interface can parse the namespace and name from fields that it is later given

func (Keyer) KeyRoot

func (k Keyer) KeyRoot(ctx request.Context) string

KeyRoot is a (k8s.io/kubernetes/pkg/registry/generic/registry).Store compatible function to get the key root to be passed to a third party resource based storage Interface.

It is meant to be passed to a Store's KeyRootFunc field, so that a TPR based storage interface can parse the namespace and name from fields that it is later given.

The returned string will never be empty is k.DefaultNamespace is not empty

func (Keyer) NamespaceAndNameFromKey

func (k Keyer) NamespaceAndNameFromKey(key string) (string, string, error)

NamespaceAndNameFromKey returns the namespace (or an empty string if there wasn't one) and name for a given etcd-style key. This function is intended to be used in a TPR based storage.Interface that uses k.KeyRoot and k.Key to construct its etcd keys.

The first return value is the namespace, and may be empty if the key represents a namespace-less resource. The second return value is the name and will not be empty if the error is nil. The error will be non-nil if the key was malformed, in which case all other return values will be empty strings.

type Kind

type Kind string

Kind represents the kind of a third party resource. This type implements fmt.Stringer

const (
	// ServiceBrokerKind is the name of a Service Broker resource, a Kubernetes third party resource.
	ServiceBrokerKind Kind = "ServiceBroker"

	// ServiceBrokerListKind is the name of a list of Service Broker resources
	ServiceBrokerListKind Kind = "ServiceBrokerList"

	// ServiceInstanceCredentialKind is the name of a Service Instance
	// Credential resource, a Kubernetes third party resource.
	ServiceInstanceCredentialKind Kind = "ServiceInstanceCredential"

	// ServiceInstanceCredentialListKind is the name for lists of Service
	// Instance Credentials
	ServiceInstanceCredentialListKind Kind = "ServiceInstanceCredentialList"

	// ServiceClassKind is the name of a Service Class resource, a Kubernetes third party resource.
	ServiceClassKind Kind = "ServiceClass"

	// ServiceClassListKind is the name of a list of service class resources
	ServiceClassListKind Kind = "ServiceClassList"

	// ServiceInstanceKind is the name of a Service Instance resource, a Kubernetes third party resource.
	ServiceInstanceKind Kind = "ServiceInstance"

	// ServiceInstanceListKind is the name of a list of service instance resources
	ServiceInstanceListKind Kind = "ServiceInstanceList"
)

func (Kind) String

func (k Kind) String() string

String is the fmt.Stringer interface implementation

func (Kind) TPRName

func (k Kind) TPRName() string

TPRName returns the lowercase name, suitable for creating third party resources of this kind

func (Kind) URLName

func (k Kind) URLName() string

URLName returns the URL-worthy name this TPR kind. Examples:

	Kind("ServiceBroker").URLName() == "servicebrokers"
	Kind("ServiceClass").URLName() == "serviceclasses"
	Kind("ServiceInstance").URLName() == "serviceinstances"
     Kind("ServiceInstanceCredntial").URLName() == "serviceinstancecredentials"

Note that this function is incomplete - it is only guaranteed to properly pluralize our 4 resource types ("ServiceBroker", "ServiceClass", "ServiceInstance", "ServiceInstanceCredential")

type Options

type Options struct {
	HasNamespace     bool
	RESTOptions      generic.RESTOptions
	DefaultNamespace string
	RESTClient       restclient.Interface
	SingularKind     Kind
	// NewSingularFunc is a function that returns a new object of the appropriate type,
	// with the namespace (first param) and name (second param) pre-filled
	NewSingularFunc func(string, string) runtime.Object
	ListKind        Kind
	// NewListFunc is a function that returns a new, empty list object of the appropriate
	// type. The list object should hold elements that are returned by NewSingularFunc
	NewListFunc     func() runtime.Object
	CheckObjectFunc func(runtime.Object) error
	DestroyFunc     func()
	Keyer           Keyer
	HardDelete      bool
}

Options is the set of options to create a new TPR storage interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL