Documentation ¶
Index ¶
- Variables
- func DecodeFile(path string) (runtime.Object, error)
- func DecodeObject(bytes []byte) (runtime.Object, error)
- func DecodeObjectGVK(bytes []byte) (runtime.Object, *schema.GroupVersionKind, error)
- func Decoder() runtime.Decoder
- type FakeListerWatcher
- func (f *FakeListerWatcher) Delete(obj runtime.Object)
- func (f *FakeListerWatcher) DeleteFromFile(path string) error
- func (f *FakeListerWatcher) DeleteFromText(content string) error
- func (f *FakeListerWatcher) List(options v1.ListOptions) (runtime.Object, error)
- func (f *FakeListerWatcher) Stop()
- func (f *FakeListerWatcher) Upsert(obj runtime.Object)
- func (f *FakeListerWatcher) UpsertFromFile(path string) error
- func (f *FakeListerWatcher) UpsertFromText(content string) error
- func (f *FakeListerWatcher) Watch(options v1.ListOptions) (watch.Interface, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultVersion = "1.26" // APIResources is the list of API resources for the k8s version that we're mocking. // This is mostly relevant for the feature detection at pkg/k8s/version/version.go. // The lists here are currently not exhaustive and expanded on need-by-need basis. APIResources = map[string][]*metav1.APIResourceList{ "1.16": { CoreV1APIResources, CiliumV2APIResources, }, "1.24": { CoreV1APIResources, DiscoveryV1APIResources, DiscoveryV1Beta1APIResources, CiliumV2APIResources, }, "1.25": { CoreV1APIResources, DiscoveryV1APIResources, CiliumV2APIResources, }, "1.26": { CoreV1APIResources, DiscoveryV1APIResources, CiliumV2APIResources, }, } CoreV1APIResources = &metav1.APIResourceList{ GroupVersion: corev1.SchemeGroupVersion.String(), APIResources: []metav1.APIResource{ {Name: "nodes", Kind: "Node"}, {Name: "pods", Namespaced: true, Kind: "Pod"}, {Name: "services", Namespaced: true, Kind: "Service"}, {Name: "endpoints", Namespaced: true, Kind: "Endpoint"}, }, } CiliumV2APIResources = &metav1.APIResourceList{ TypeMeta: metav1.TypeMeta{}, GroupVersion: cilium_v2.SchemeGroupVersion.String(), APIResources: []metav1.APIResource{ {Name: cilium_v2.CNPluralName, Kind: cilium_v2.CNKindDefinition}, {Name: cilium_v2.CEPPluralName, Namespaced: true, Kind: cilium_v2.CEPKindDefinition}, {Name: cilium_v2.CIDPluralName, Namespaced: true, Kind: cilium_v2.CIDKindDefinition}, {Name: cilium_v2.CEGPPluralName, Namespaced: true, Kind: cilium_v2.CEGPKindDefinition}, {Name: cilium_v2.CNPPluralName, Namespaced: true, Kind: cilium_v2.CNPKindDefinition}, {Name: cilium_v2.CCNPPluralName, Namespaced: true, Kind: cilium_v2.CCNPKindDefinition}, {Name: cilium_v2.CLRPPluralName, Namespaced: true, Kind: cilium_v2.CLRPKindDefinition}, {Name: cilium_v2.CEWPluralName, Namespaced: true, Kind: cilium_v2.CEWKindDefinition}, {Name: cilium_v2.CCECPluralName, Namespaced: true, Kind: cilium_v2.CCECKindDefinition}, {Name: cilium_v2.CECPluralName, Namespaced: true, Kind: cilium_v2.CECKindDefinition}, }, } DiscoveryV1APIResources = &metav1.APIResourceList{ TypeMeta: metav1.TypeMeta{}, GroupVersion: discov1.SchemeGroupVersion.String(), APIResources: []metav1.APIResource{ {Name: "endpointslices", Namespaced: true, Kind: "EndpointSlice"}, }, } DiscoveryV1Beta1APIResources = &metav1.APIResourceList{ GroupVersion: discov1beta1.SchemeGroupVersion.String(), APIResources: []metav1.APIResource{ {Name: "endpointslices", Namespaced: true, Kind: "EndpointSlice"}, }, } )
View Source
var ( // Scheme for object types used in Cilium. // The scheme can be extended by init() functions since [Decoder] is // lazily constructed. Scheme = runtime.NewScheme() )
Functions ¶
func DecodeObjectGVK ¶
func Decoder ¶
Decoder returns an object decoder for Cilium and Slim objects. The DecodeObject and DecodeFile functions are provided as shorthands for decoding from bytes and files respectively.
Types ¶
type FakeListerWatcher ¶
type FakeListerWatcher struct {
// contains filtered or unexported fields
}
FakeListerWatcher implements a fake cache.ListerWatcher that can be fed objects directly, or from YAML files or strings. The YAML data is decoded with a schema that covers the Cilium CRDs and Slim schemas.
func NewFakeListerWatcher ¶
func NewFakeListerWatcher(objs ...runtime.Object) *FakeListerWatcher
func (*FakeListerWatcher) Delete ¶
func (f *FakeListerWatcher) Delete(obj runtime.Object)
func (*FakeListerWatcher) DeleteFromFile ¶
func (f *FakeListerWatcher) DeleteFromFile(path string) error
func (*FakeListerWatcher) DeleteFromText ¶
func (f *FakeListerWatcher) DeleteFromText(content string) error
func (*FakeListerWatcher) List ¶
func (f *FakeListerWatcher) List(options v1.ListOptions) (runtime.Object, error)
List implements cache.ListerWatcher.
func (*FakeListerWatcher) Stop ¶
func (f *FakeListerWatcher) Stop()
func (*FakeListerWatcher) Upsert ¶
func (f *FakeListerWatcher) Upsert(obj runtime.Object)
func (*FakeListerWatcher) UpsertFromFile ¶
func (f *FakeListerWatcher) UpsertFromFile(path string) error
func (*FakeListerWatcher) UpsertFromText ¶
func (f *FakeListerWatcher) UpsertFromText(content string) error
func (*FakeListerWatcher) Watch ¶
func (f *FakeListerWatcher) Watch(options v1.ListOptions) (watch.Interface, error)
Watch implements cache.ListerWatcher.
Click to show internal directories.
Click to hide internal directories.