Documentation ¶
Index ¶
- Constants
- Variables
- func CreateZoneID(region, zone string) string
- func GetKey(obj interface{}, t *testing.T) string
- func GetZoneKey(node *v1.Node) string
- func GetZones(nodeHandler *FakeNodeHandler) []string
- func NewNode(name string) *v1.Node
- func NewPod(name, host string) *v1.Pod
- func Resource(resource string) schema.GroupResource
- type FakeLegacyHandler
- type FakeNodeHandler
- func (m *FakeNodeHandler) Core() v1core.CoreV1Interface
- func (m *FakeNodeHandler) CoreV1() v1core.CoreV1Interface
- func (m *FakeNodeHandler) Create(_ context.Context, node *v1.Node, _ metav1.CreateOptions) (*v1.Node, error)
- func (m *FakeNodeHandler) Delete(_ context.Context, id string, opt metav1.DeleteOptions) error
- func (m *FakeNodeHandler) DeleteCollection(_ context.Context, opt metav1.DeleteOptions, listOpts metav1.ListOptions) error
- func (m *FakeNodeHandler) Get(_ context.Context, name string, opts metav1.GetOptions) (*v1.Node, error)
- func (m *FakeNodeHandler) GetUpdatedNodesCopy() []*v1.Node
- func (m *FakeNodeHandler) List(_ context.Context, opts metav1.ListOptions) (*v1.NodeList, error)
- func (m *FakeNodeHandler) Patch(_ context.Context, name string, pt types.PatchType, data []byte, ...) (*v1.Node, error)
- func (m *FakeNodeHandler) PatchStatus(ctx context.Context, nodeName string, data []byte) (*v1.Node, error)
- func (m *FakeNodeHandler) Update(_ context.Context, node *v1.Node, _ metav1.UpdateOptions) (*v1.Node, error)
- func (m *FakeNodeHandler) UpdateStatus(_ context.Context, node *v1.Node, _ metav1.UpdateOptions) (*v1.Node, error)
- func (m *FakeNodeHandler) Watch(_ context.Context, opts metav1.ListOptions) (watch.Interface, error)
- type FakeRecorder
Constants ¶
const GroupName = ""
GroupName is the group name use in this package
Variables ¶
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
SchemeGroupVersion is group version used to register these objects
Functions ¶
func CreateZoneID ¶
CreateZoneID returns a single zoneID for a given region and zone.
func GetKey ¶
GetKey is a helper function used by controllers unit tests to get the key for a given kubernetes resource.
func GetZoneKey ¶
GetZoneKey is a helper function that builds a string identifier that is unique per failure-zone; it returns empty-string for no zone. Since there are currently two separate zone keys:
- "failure-domain.beta.kubernetes.io/zone"
- "topology.kubernetes.io/zone"
GetZoneKey will first check failure-domain.beta.kubernetes.io/zone and if not exists, will then check topology.kubernetes.io/zone
func GetZones ¶
func GetZones(nodeHandler *FakeNodeHandler) []string
GetZones returns list of zones for all Nodes stored in FakeNodeHandler
func Resource ¶
func Resource(resource string) schema.GroupResource
Resource takes an unqualified resource and returns a Group qualified GroupResource
Types ¶
type FakeLegacyHandler ¶
type FakeLegacyHandler struct { v1core.CoreV1Interface // contains filtered or unexported fields }
FakeLegacyHandler is a fake implementation of CoreV1Interface.
func (*FakeLegacyHandler) Nodes ¶
func (m *FakeLegacyHandler) Nodes() v1core.NodeInterface
Nodes return fake NodeInterfaces.
type FakeNodeHandler ¶
type FakeNodeHandler struct { *fake.Clientset // Input: Hooks determine if request is valid or not CreateHook func(*FakeNodeHandler, *v1.Node) bool Existing []*v1.Node // Output CreatedNodes []*v1.Node DeletedNodes []*v1.Node UpdatedNodes []*v1.Node UpdatedNodeStatuses []*v1.Node RequestCount int DeleteWaitChan chan struct{} PatchWaitChan chan struct{} // contains filtered or unexported fields }
FakeNodeHandler is a fake implementation of NodesInterface and NodeInterface. It allows test cases to have fine-grained control over mock behaviors. We also need PodsInterface and PodInterface to test list & delete pods, which is implemented in the embedded client.Fake field.
func (*FakeNodeHandler) Core ¶
func (m *FakeNodeHandler) Core() v1core.CoreV1Interface
Core returns fake CoreInterface.
func (*FakeNodeHandler) CoreV1 ¶
func (m *FakeNodeHandler) CoreV1() v1core.CoreV1Interface
CoreV1 returns fake CoreV1Interface
func (*FakeNodeHandler) Create ¶
func (m *FakeNodeHandler) Create(_ context.Context, node *v1.Node, _ metav1.CreateOptions) (*v1.Node, error)
Create adds a new Node to the fake store.
func (*FakeNodeHandler) Delete ¶
func (m *FakeNodeHandler) Delete(_ context.Context, id string, opt metav1.DeleteOptions) error
Delete deletes a Node from the fake store.
func (*FakeNodeHandler) DeleteCollection ¶
func (m *FakeNodeHandler) DeleteCollection(_ context.Context, opt metav1.DeleteOptions, listOpts metav1.ListOptions) error
DeleteCollection deletes a collection of Nodes from the fake store.
func (*FakeNodeHandler) Get ¶
func (m *FakeNodeHandler) Get(_ context.Context, name string, opts metav1.GetOptions) (*v1.Node, error)
Get returns a Node from the fake store.
func (*FakeNodeHandler) GetUpdatedNodesCopy ¶
func (m *FakeNodeHandler) GetUpdatedNodesCopy() []*v1.Node
GetUpdatedNodesCopy returns a slice of Nodes with updates applied.
func (*FakeNodeHandler) List ¶
func (m *FakeNodeHandler) List(_ context.Context, opts metav1.ListOptions) (*v1.NodeList, error)
List returns a list of Nodes from the fake store.
func (*FakeNodeHandler) Patch ¶
func (m *FakeNodeHandler) Patch(_ context.Context, name string, pt types.PatchType, data []byte, _ metav1.PatchOptions, subresources ...string) (*v1.Node, error)
Patch patches a Node in the fake store.
func (*FakeNodeHandler) PatchStatus ¶
func (m *FakeNodeHandler) PatchStatus(ctx context.Context, nodeName string, data []byte) (*v1.Node, error)
PatchStatus patches a status of a Node in the fake store.
func (*FakeNodeHandler) Update ¶
func (m *FakeNodeHandler) Update(_ context.Context, node *v1.Node, _ metav1.UpdateOptions) (*v1.Node, error)
Update updates a Node in the fake store.
func (*FakeNodeHandler) UpdateStatus ¶
func (m *FakeNodeHandler) UpdateStatus(_ context.Context, node *v1.Node, _ metav1.UpdateOptions) (*v1.Node, error)
UpdateStatus updates a status of a Node in the fake store.
func (*FakeNodeHandler) Watch ¶
func (m *FakeNodeHandler) Watch(_ context.Context, opts metav1.ListOptions) (watch.Interface, error)
Watch watches Nodes in a fake store.
type FakeRecorder ¶
type FakeRecorder struct { sync.Mutex Events []*v1.Event // contains filtered or unexported fields }
FakeRecorder is used as a fake during testing.
func NewFakeRecorder ¶
func NewFakeRecorder() *FakeRecorder
NewFakeRecorder returns a pointer to a newly constructed FakeRecorder.
func (*FakeRecorder) AnnotatedEventf ¶
func (f *FakeRecorder) AnnotatedEventf(obj runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{})
AnnotatedEventf emits a fake formatted event to the fake recorder