fake

package
v0.0.0-...-bb7034b Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

+k8s:deepcopy-gen=package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientImpl

type ClientImpl struct {
	CustomResourceImpl     *CustomResourceImpl
	CustomResourceListImpl *CustomResourceListImpl
	Error                  string
}

ClientImpl is a fake implementation of crd.Client

func (*ClientImpl) Create

func (c *ClientImpl) Create(cr crd.CustomResource) (e error)

Create creates the supplied CRD.

func (*ClientImpl) Delete

func (c *ClientImpl) Delete(namespace string, name string) (e error)

Delete deletes the CRD from the Kubernetes API server.

func (*ClientImpl) Get

func (c *ClientImpl) Get(namespace string, name string) (result runtime.Object, e error)

Get retrieves the CRD from the Kubernetes API server.

func (*ClientImpl) List

func (c *ClientImpl) List(namespace string, labels map[string]string) (result runtime.Object, e error)

func (*ClientImpl) RESTClient

func (c *ClientImpl) RESTClient() rest.Interface

returns a fake RESTClient. TODO Not used in unit tests, returns nil

func (*ClientImpl) Update

func (c *ClientImpl) Update(cr crd.CustomResource) (result runtime.Object, e error)

Update updates the CRD on the Kubernetes API server.

func (*ClientImpl) Validate

func (c *ClientImpl) Validate(cr crd.CustomResource) (e error)

Validate validates a custom resource against a json schema. Returns nil if object adheres to the schema.

type CustomResourceImpl

type CustomResourceImpl struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata"`
	SpecState         states.State `json:"spec"`
	StatusState       states.State `json:"status,omitempty"`
}

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object CustomResourceImpl implements crd.CustomResource

func (*CustomResourceImpl) GetSpecState

func (c *CustomResourceImpl) GetSpecState() states.State

GetSpecState returns spec.state

func (*CustomResourceImpl) GetStatusState

func (c *CustomResourceImpl) GetStatusState() states.State

GetStatusState returns spec.status

func (*CustomResourceImpl) JSON

func (c *CustomResourceImpl) JSON() (string, error)

JSON returns json representation

func (*CustomResourceImpl) Name

func (c *CustomResourceImpl) Name() string

Name returns objectMeta.Name

func (*CustomResourceImpl) Namespace

func (c *CustomResourceImpl) Namespace() string

Namespace returns objectMeta.Namespace

func (*CustomResourceImpl) SetStatusStateWithMessage

func (c *CustomResourceImpl) SetStatusStateWithMessage(state states.State, message string)

SetStatusStateWithMessage TBD store message

type CustomResourceListImpl

type CustomResourceListImpl struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:",inline"`
	Items           []CustomResourceImpl `json:"items"`
}

CustomResourceListImpl implements crd.CustomResource for the List method +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*CustomResourceListImpl) GetItems

func (c *CustomResourceListImpl) GetItems() []runtime.Object

Jump to

Keyboard shortcuts

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