testutil

package
v0.0.0-...-9331f55 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

Package testutil implements helper utilities used in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKubeconfigSecret

func CreateKubeconfigSecret(cfg *rest.Config, clusterName, namespace string, crClient client.Client) error

CreateKubeconfigSecret create a secret with kubeconfig token for the cluster provided by client

func CreateResources

func CreateResources(f *os.File, cfg *rest.Config, dynamicClient dynamic.Interface) error

CreateResources using unstructured objects from a yaml/json file provided by decoder

func DeleteNamespace

func DeleteNamespace(ctx context.Context, clientset *kubernetes.Clientset, namespace string) error

DeleteNamespace finalizes and deletes a namespace given its name

func DeleteResources

func DeleteResources(f *os.File, cfg *rest.Config, dynamicClient dynamic.Interface, waitForDeletion bool) error

DeleteResources using unstructured objects from a yaml/json file provided by decoder.

func EnsureResources

func EnsureResources(f *os.File, cfg *rest.Config, dynamicClient dynamic.Interface) error

EnsureResources verifies that resources exist, creating it if necessary

func GetExternalCRDPaths

func GetExternalCRDPaths(externalDeps map[string][]string) ([]string, error)

GetExternalCRDPaths gets paths for external CRDs by introspecting versions of the go dependencies

func SetupWebhookCertificates

func SetupWebhookCertificates(ctx context.Context, k8sClient client.Client, k8sConfig *rest.Config, certDetails *WebhookCertificatesDetails) error

Types

type FakeDiscovery

type FakeDiscovery struct {
	FakeDiscovery discovery.DiscoveryInterface
	Resources     []*metav1.APIResourceList
	APIGroups     *metav1.APIGroupList
}

FakeDiscovery customize the behavior of fake client-go FakeDiscovery.ServerPreferredResources to return a customized APIResourceList. The client-go FakeDiscovery.ServerPreferredResources is hardcoded to return nil. https://github.com/kubernetes/client-go/blob/master/discovery/fake/discovery.go#L85

func (FakeDiscovery) OpenAPISchema

func (c FakeDiscovery) OpenAPISchema() (*openapiv2.Document, error)

func (FakeDiscovery) OpenAPIV3

func (c FakeDiscovery) OpenAPIV3() openapi.Client

func (FakeDiscovery) RESTClient

func (c FakeDiscovery) RESTClient() rest.Interface

func (FakeDiscovery) ServerGroups

func (c FakeDiscovery) ServerGroups() (*metav1.APIGroupList, error)

func (FakeDiscovery) ServerGroupsAndResources

func (c FakeDiscovery) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error)

func (FakeDiscovery) ServerPreferredNamespacedResources

func (c FakeDiscovery) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error)

func (FakeDiscovery) ServerPreferredResources

func (c FakeDiscovery) ServerPreferredResources() ([]*metav1.APIResourceList, error)

func (FakeDiscovery) ServerResourcesForGroupVersion

func (c FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error)

func (FakeDiscovery) ServerVersion

func (c FakeDiscovery) ServerVersion() (*version.Info, error)

type FakeGVRHelper

type FakeGVRHelper struct {
	DiscoveryClient discovery.DiscoveryInterface
}

func (*FakeGVRHelper) GetDiscoveryClient

func (f *FakeGVRHelper) GetDiscoveryClient() discovery.DiscoveryInterface

func (*FakeGVRHelper) GetGVR

type WebhookCertificatesDetails

type WebhookCertificatesDetails struct {
	CertPath           string
	KeyPath            string
	WebhookScrtName    string
	AddonNamespace     string
	WebhookServiceName string
	LabelSelector      labels.Selector
}

Jump to

Keyboard shortcuts

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