k8s

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: Apache-2.0 Imports: 14 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()

func SecurityContextFromPrivileged added in v1.3.0

func SecurityContextFromPrivileged(privileged bool) v1.SecurityContext

SecurityContextFromPrivileged create api.SecurityContext by privileged.

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) Apply added in v1.3.0

func (*FakeSecret) Create

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

Create is the interface definition.

func (*FakeSecret) Delete

Delete is the interface definition.

func (*FakeSecret) DeleteCollection added in v1.2.0

DeleteCollection is the interface definition.

func (*FakeSecret) Get

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

Get is the interface definition.

func (*FakeSecret) List

List is the interface definition.

func (*FakeSecret) Patch added in v1.2.0

Patch is the interface definition.

func (*FakeSecret) Update

func (f *FakeSecret) Update(_ context.Context, secret *v1.Secret, _ 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