fakek8s

package
v4.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeK8s

type FakeK8s struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

FakeK8s is a mock K8s API server. It can serve both list and watch requests.

func NewFakeK8s

func NewFakeK8s() *FakeK8s

NewFakeK8s makes a new FakeK8s

func (*FakeK8s) Close

func (f *FakeK8s) Close()

Close stops the server and all watchers

func (*FakeK8s) CreateOrReplaceResource

func (f *FakeK8s) CreateOrReplaceResource(obj runtime.Object)

CreateOrReplaceResource can be used by unit tests. It will generate a watch event.

func (*FakeK8s) DeleteResource

func (f *FakeK8s) DeleteResource(obj runtime.Object) bool

DeleteResource deletes a resource and sends a watch event if actually deleted.

func (*FakeK8s) DeleteResourceByName

func (f *FakeK8s) DeleteResourceByName(resKind string, namespace string, name string) bool

DeleteResourceByName removes a resource from the fake api server. It will generate a watch event for the deletion if the resource existed.

func (*FakeK8s) SetInitialList

func (f *FakeK8s) SetInitialList(l []runtime.Object)

SetInitialList adds resources to the server state that are served when doing list requests. l can be a list of any of the supported resource types.

func (*FakeK8s) Start

func (f *FakeK8s) Start()

Start creates the server and starts it

func (*FakeK8s) URL

func (f *FakeK8s) URL() string

URL is the of the mock server to point your objects under test to

Jump to

Keyboard shortcuts

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