k8sutil

package
v0.34.0-rc1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

k8sutil contains test utilities for kubernetes.

Index

Constants

View Source
const FakeConfigMapTemplate = `` /* 180-byte string literal not displayed */

FakeConfigMapTemplate is the template for fake config map.

View Source
const FakeDeploymentTemplate = `` /* 365-byte string literal not displayed */

FakeDeploymentTemplate is the template for fake deployment.

View Source
const FakeSecretTemplate = `
apiVersion: v1
kind: Secret
metadata:
  name: %s
type: Opaque
stringData:
  username: admin
  password: password
`

FakeSecretTemplate is the template for fake secret.

View Source
const FakeServiceAccountTemplate = `` /* 141-byte string literal not displayed */

FakeServiceAccountTemplate is the template for fake service account.

View Source
const FakeServiceTemplate = `` /* 176-byte string literal not displayed */

FakeServiceTemplate is the template for fake service.

View Source
const YAMLSeparator = "\n---\n"

YAMLSeparator is the separator for fake YAML.

Variables

This section is empty.

Functions

func NewFakeKubeClient

func NewFakeKubeClient(scheme *runtime.Scheme, initObjs ...client.Object) client.WithWatch

NewFakeKubeClient create new fake kube dynamic client with the given scheme and initial objects.

func PrependPatchReactor

func PrependPatchReactor(f *k8sfake.Clientset, resource string, objFunc func(clienttesting.PatchAction) runtime.Object)

PrependPatchReactor prepends patch reactor to fake client. This is workaround because clientset fake doesn't support patch verb. https://github.com/kubernetes/client-go/issues/1184

Types

type DiscoveryClient

type DiscoveryClient struct {
	Groups    *metav1.APIGroupList
	Resources []*metav1.APIResourceList
	APIGroup  []*metav1.APIGroup
}

func (*DiscoveryClient) ServerGroups

func (d *DiscoveryClient) ServerGroups() (*metav1.APIGroupList, error)

ServerGroups returns a list of API groups supported by the server.

func (*DiscoveryClient) ServerGroupsAndResources

func (d *DiscoveryClient) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error)

ServerGroupsAndResources returns a list of API groups and resources associated with the discovery client.

func (*DiscoveryClient) ServerPreferredNamespacedResources

func (d *DiscoveryClient) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error)

This function returns a slice of API resource lists.

func (*DiscoveryClient) ServerPreferredResources

func (d *DiscoveryClient) ServerPreferredResources() ([]*metav1.APIResourceList, error)

This function returns a slice of API resource lists.

func (*DiscoveryClient) ServerResourcesForGroupVersion

func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error)

ServerResourcesForGroupVersion returns nil for the API resource list.

Jump to

Keyboard shortcuts

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