fake

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package fake provides fake Kuberntes clients for testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*fakek8s.Clientset
	*fakedynamic.FakeDynamicClient
}

Client provides structured and dynamic fake clients

func New

func New(sObjs []runtime.Object, unsObjs []runtime.Object) *Client

New returns a new fake Kubernetes client populated with runtime objects

func (*Client) Patch

func (cl *Client) Patch(gvr schema.GroupVersionResource, objNamespace string, objName string, jsonBytes []byte) (*unstructured.Unstructured, error)

Patch applies a patch for a resource. Important: fake clients should not be used for server-side apply or strategic-merge patches. https://github.com/kubernetes/kubernetes/pull/78630#issuecomment-500424163

Hence, we are mocking the Patch call in this fake client so that, instead of server-side apply as in the real client, we perform of merge patch instead.

Jump to

Keyboard shortcuts

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