k8s

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: UPL-1.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AddPodConditionReady

func AddPodConditionReady(pod *corev1.Pod)

func CreateConfigMap

func CreateConfigMap(ctx context.Context, client client.Client, key types.NamespacedName, cm *corev1.ConfigMap) error

func CreateKubernetesService

func CreateKubernetesService(ctx context.Context, client client.Client, key types.NamespacedName, service *corev1.Service) error

func CreateNamespace

func CreateNamespace(ctx context.Context, client client.Client, key types.NamespacedName, ns *corev1.Namespace) error

func CreatePod

func CreatePod(ctx context.Context, client client.Client, key types.NamespacedName, pod *corev1.Pod) error

func DeleteNamespace

func DeleteNamespace(ctx context.Context, client client.Client, ns *corev1.Namespace) error

func DeletePodDisruptionBudget

func DeletePodDisruptionBudget(ctx context.Context, client client.Client, pdb *policyv1beta1.PodDisruptionBudget) error

func GetPod

func GetPod(ctx context.Context, client client.Client, key types.NamespacedName, pod *corev1.Pod) error

func IsValidMeshResource

func IsValidMeshResource(value string) bool

func NewConfigMap

func NewConfigMap(namespace string, name string, data map[string]string) *corev1.ConfigMap

func NewFakeCache

func NewFakeCache(t *testing.T) *meshMocks.MockCacheMapClient

func NewFakeK8sClient

func NewFakeK8sClient(scheme *runtime.Scheme) client.Client

func NewFakeK8sClientSet

func NewFakeK8sClientSet() kubernetes.Interface

func NewFakeMeshClient

func NewFakeMeshClient(t *testing.T) *meshMocks.MockServiceMeshClient

func NewFakeResolver

func NewFakeResolver(t *testing.T) *meshMocks.MockResolver

func NewKubernetesService

func NewKubernetesService(name string, namespace string) *corev1.Service

func NewNamespace

func NewNamespace(name string, labels map[string]string) *corev1.Namespace

func NewPodDisruptionBudget

func NewPodDisruptionBudget(name string, namespace string, minAvailable int32, target string) *policyv1beta1.PodDisruptionBudget

func NewPodWithLabels

func NewPodWithLabels(name string, namespace string, labels map[string]string) *corev1.Pod

func NewPodWithServiceMeshProxy

func NewPodWithServiceMeshProxy(name string, namespace string) *corev1.Pod

func NewPodWithoutServiceMeshProxy

func NewPodWithoutServiceMeshProxy(name string, namespace string) *corev1.Pod

func NewTestEnvK8sClient

func NewTestEnvK8sClient(cfg *rest.Config, scheme *runtime.Scheme) client.Client

func NewTestEnvK8sClientSet

func NewTestEnvK8sClientSet(cfg *rest.Config) kubernetes.Interface

func SetupTestEnv

func SetupTestEnv(testEnv *envtest.Environment) *rest.Config

func UpdateConfigMap

func UpdateConfigMap(ctx context.Context, client client.Client, cm *corev1.ConfigMap) error

func UpdateNamespace

func UpdateNamespace(ctx context.Context, client client.Client, ns *corev1.Namespace) error

func UpdatePod

func UpdatePod(ctx context.Context, client client.Client, pod *corev1.Pod) error

func UpdateProxyInjectionNamespaceLabel

func UpdateProxyInjectionNamespaceLabel(ctx context.Context, client client.Client, ns *corev1.Namespace, value string) error

func UpdateProxyInjectionPodLabel

func UpdateProxyInjectionPodLabel(ctx context.Context, client client.Client, pod *corev1.Pod, value string) error

func UpdateVDBRefPodAnnotation

func UpdateVDBRefPodAnnotation(ctx context.Context, client client.Client, pod *corev1.Pod, value string) error

Types

type K8sAPIs

type K8sAPIs interface {
	Get(ctx context.Context, key types.NamespacedName, obj client.Object) error
	Create(ctx context.Context, obj client.Object) error
	Update(ctx context.Context, oldObj client.Object, newObj client.Object) error
	Delete(ctx context.Context, obj client.Object) error
	WaitUntilDeleted(ctx context.Context, obj client.Object) error
}

K8sAPIs supports common k8s operations for each kind of resource. It will be added to the test framework to facilitate tests.

func NewDefaultK8sAPIs

func NewDefaultK8sAPIs(k8sClient client.Client) K8sAPIs

Jump to

Keyboard shortcuts

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