k8s

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ValidPullPolicies is the set of pull policies that this package considers valid
	ValidPullPolicies = map[v1.PullPolicy]struct{}{
		v1.PullAlways:       {},
		v1.PullIfNotPresent: {},
		v1.PullNever:        {},
	}
)

Functions

func NewInCluster added in v1.2.0

func NewInCluster() (*kubernetes.Clientset, error)

func PullPolicyFromString

func PullPolicyFromString(ppStr string) (v1.PullPolicy, error)

PullPolicyFromString converts a string into an api.PullPolicy. returns an error if the string does not match a pull policy in ValidPullPolicies()

Types

type ErrInvalidPullPolicy

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

ErrInvalidPullPolicy is the error returned when trying to convert an unknown string to an api.PullPolicy

func (ErrInvalidPullPolicy) Error

func (e ErrInvalidPullPolicy) Error() string

Error is the error interface implementation

type FakeSecret

type FakeSecret struct {
	FnGet    func(string) (*corev1.Secret, error)
	FnCreate func(*v1.Secret) (*corev1.Secret, error)
	FnUpdate func(*v1.Secret) (*corev1.Secret, error)
}

FakeSecret is a mock function that can be swapped in for (k8s.io/kubernetes/pkg/client/unversioned).SecretsInterface, so you can unit test your code.

func (*FakeSecret) Create

func (f *FakeSecret) Create(ctx context.Context, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error)

Create is the interface definition.

func (*FakeSecret) Delete

func (f *FakeSecret) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error

Delete is the interface definition.

func (*FakeSecret) DeleteCollection added in v1.2.0

func (f *FakeSecret) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error

DeleteCollection is the interface definition.

func (*FakeSecret) Get

func (f *FakeSecret) Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Secret, error)

Get is the interface definition.

func (*FakeSecret) List

func (f *FakeSecret) List(ctx context.Context, opts metav1.ListOptions) (*v1.SecretList, error)

List is the interface definition.

func (*FakeSecret) Patch added in v1.2.0

func (f *FakeSecret) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*v1.Secret, error)

Patch is the interface definition.

func (*FakeSecret) Update

func (f *FakeSecret) Update(ctx context.Context, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error)

Update is the interface definition.

func (*FakeSecret) Watch

Watch is the interface definition.

type FakeSecretsGetter added in v1.2.0

type FakeSecretsGetter struct {
	Fn func(string) typedcorev1.SecretInterface
}

func (*FakeSecretsGetter) Secrets added in v1.2.0

func (f *FakeSecretsGetter) Secrets(namespace string) typedcorev1.SecretInterface

Secrets is the interface definition.Secret

type NamespaceLister

type NamespaceLister interface {
	List(ctx context.Context, opts metav1.ListOptions) (*corev1.NamespaceList, error)
}

NamespaceLister is a (k8s.io/kubernetes/pkg/client/unversioned).NamespaceInterface compatible interface which only has the List function. It's used in places that only need List to make them easier to test and more easily swappable with other implementations (should the need arise).

Example usage:

var nsl NamespaceLister
nsl = kubeClient.Namespaces()

type PodWatcher

type PodWatcher struct {
	Store      StoreToPodLister
	Controller cache.Controller
}

PodWatcher is a struct which holds the return values of (k8s.io/kubernetes/pkg/controller/framework).NewIndexerInformer together.

func NewPodWatcher

func NewPodWatcher(c kubernetes.Clientset, ns string) *PodWatcher

NewPodWatcher creates a new BuildPodWatcher useful to list the pods using a cache which gets updated based on the watch func.

type StoreToPodLister added in v1.2.0

type StoreToPodLister struct {
	cache.Store
}

func (*StoreToPodLister) List added in v1.2.0

func (s *StoreToPodLister) List(selector labels.Selector) (pods []*v1.Pod, err error)

Jump to

Keyboard shortcuts

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