Documentation ¶
Overview ¶
k8sutil contains test utilities for kubernetes.
Index ¶
- Constants
- func NewFakeKubeClient(scheme *runtime.Scheme, initObjs ...client.Object) client.WithWatch
- func PrependPatchReactor(f *k8sfake.Clientset, resource string, ...)
- type DiscoveryClient
- func (d *DiscoveryClient) ServerGroups() (*metav1.APIGroupList, error)
- func (d *DiscoveryClient) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error)
- func (d *DiscoveryClient) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error)
- func (d *DiscoveryClient) ServerPreferredResources() ([]*metav1.APIResourceList, error)
- func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error)
Constants ¶
const FakeConfigMapTemplate = `` /* 180-byte string literal not displayed */
FakeConfigMapTemplate is the template for fake config map.
const FakeDeploymentTemplate = `` /* 365-byte string literal not displayed */
FakeDeploymentTemplate is the template for fake deployment.
const FakeSecretTemplate = `
apiVersion: v1
kind: Secret
metadata:
name: %s
type: Opaque
stringData:
username: admin
password: password
`
FakeSecretTemplate is the template for fake secret.
const FakeServiceAccountTemplate = `` /* 141-byte string literal not displayed */
FakeServiceAccountTemplate is the template for fake service account.
const FakeServiceTemplate = `` /* 176-byte string literal not displayed */
FakeServiceTemplate is the template for fake service.
const YAMLSeparator = "\n---\n"
YAMLSeparator is the separator for fake YAML.
Variables ¶
This section is empty.
Functions ¶
func NewFakeKubeClient ¶
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.