Documentation
¶
Overview ¶
Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type BeforeHTTPOperation
- type Clock
- type HTTPOperation
- type Hook
- type ListFilter
- type MemoryStorage
- func (s *MemoryStorage) AddObject(obj *unstructured.Unstructured) error
- func (s *MemoryStorage) AllResources() []metav1.APIResource
- func (s *MemoryStorage) CreateObject(ctx context.Context, resource *ResourceInfo, id types.NamespacedName, ...) error
- func (s *MemoryStorage) DeleteObject(ctx context.Context, resource *ResourceInfo, id types.NamespacedName) (*unstructured.Unstructured, error)
- func (s *MemoryStorage) FindResource(gr schema.GroupResource) *ResourceInfo
- func (s *MemoryStorage) GetObject(ctx context.Context, resource *ResourceInfo, id types.NamespacedName) (*unstructured.Unstructured, bool, error)
- func (s *MemoryStorage) ListObjects(ctx context.Context, resource *ResourceInfo, filter ListFilter) (*unstructured.UnstructuredList, error)
- func (s *MemoryStorage) RegisterType(gvk schema.GroupVersionKind, resource string, scope meta.RESTScope)
- func (s *MemoryStorage) UpdateObject(ctx context.Context, resource *ResourceInfo, id types.NamespacedName, ...) error
- func (s *MemoryStorage) Watch(ctx context.Context, resource *ResourceInfo, opt WatchOptions, ...) error
- type MockKubeAPIServer
- func (s *MockKubeAPIServer) AddHook(hook Hook)
- func (s *MockKubeAPIServer) AddObject(obj *unstructured.Unstructured) error
- func (s *MockKubeAPIServer) AddObjectsFromManifest(y string) error
- func (s *MockKubeAPIServer) RegisterType(gvk schema.GroupVersionKind, resource string, scope meta.RESTScope)
- func (s *MockKubeAPIServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *MockKubeAPIServer) StartServing() (net.Addr, error)
- func (s *MockKubeAPIServer) Stop() error
- type RandomUIDGenerator
- type RealClock
- type Request
- type ResourceInfo
- type TestClock
- type TestUIDGenerator
- type UIDGenerator
- type WatchCallback
- type WatchOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeforeHTTPOperation ¶
type BeforeHTTPOperation interface {
BeforeHTTPOperation(op *HTTPOperation)
}
BeforeHTTPOperation is implemented by hooks that want to be called before every HTTP operation
type HTTPOperation ¶
HTTPOperation contains the details of an HTTP operation
type ListFilter ¶
type ListFilter struct {
Namespace string
}
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
func NewMemoryStorage ¶
func NewMemoryStorage(clock Clock, uidGenerator UIDGenerator) *MemoryStorage
func (*MemoryStorage) AddObject ¶
func (s *MemoryStorage) AddObject(obj *unstructured.Unstructured) error
AddObject pre-creates an object
func (*MemoryStorage) AllResources ¶
func (s *MemoryStorage) AllResources() []metav1.APIResource
func (*MemoryStorage) CreateObject ¶
func (s *MemoryStorage) CreateObject(ctx context.Context, resource *ResourceInfo, id types.NamespacedName, u *unstructured.Unstructured) error
func (*MemoryStorage) DeleteObject ¶
func (s *MemoryStorage) DeleteObject(ctx context.Context, resource *ResourceInfo, id types.NamespacedName) (*unstructured.Unstructured, error)
func (*MemoryStorage) FindResource ¶
func (s *MemoryStorage) FindResource(gr schema.GroupResource) *ResourceInfo
func (*MemoryStorage) GetObject ¶
func (s *MemoryStorage) GetObject(ctx context.Context, resource *ResourceInfo, id types.NamespacedName) (*unstructured.Unstructured, bool, error)
func (*MemoryStorage) ListObjects ¶
func (s *MemoryStorage) ListObjects(ctx context.Context, resource *ResourceInfo, filter ListFilter) (*unstructured.UnstructuredList, error)
func (*MemoryStorage) RegisterType ¶
func (s *MemoryStorage) RegisterType(gvk schema.GroupVersionKind, resource string, scope meta.RESTScope)
RegisterType registers a type with the schema for the mock kubeapiserver
func (*MemoryStorage) UpdateObject ¶
func (s *MemoryStorage) UpdateObject(ctx context.Context, resource *ResourceInfo, id types.NamespacedName, u *unstructured.Unstructured) error
func (*MemoryStorage) Watch ¶
func (s *MemoryStorage) Watch(ctx context.Context, resource *ResourceInfo, opt WatchOptions, callback WatchCallback) error
type MockKubeAPIServer ¶
type MockKubeAPIServer struct {
// contains filtered or unexported fields
}
func NewMockKubeAPIServer ¶
func NewMockKubeAPIServer(addr string) (*MockKubeAPIServer, error)
func (*MockKubeAPIServer) AddHook ¶
func (s *MockKubeAPIServer) AddHook(hook Hook)
func (*MockKubeAPIServer) AddObject ¶
func (s *MockKubeAPIServer) AddObject(obj *unstructured.Unstructured) error
AddObject pre-creates an object
func (*MockKubeAPIServer) AddObjectsFromManifest ¶
func (s *MockKubeAPIServer) AddObjectsFromManifest(y string) error
AddObjectsFromManifest pre-creates the objects in the manifest
func (*MockKubeAPIServer) RegisterType ¶
func (s *MockKubeAPIServer) RegisterType(gvk schema.GroupVersionKind, resource string, scope meta.RESTScope)
RegisterType registers a type with the schema for the mock kubeapiserver
func (*MockKubeAPIServer) ServeHTTP ¶
func (s *MockKubeAPIServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*MockKubeAPIServer) StartServing ¶
func (s *MockKubeAPIServer) StartServing() (net.Addr, error)
func (*MockKubeAPIServer) Stop ¶
func (s *MockKubeAPIServer) Stop() error
type RandomUIDGenerator ¶
type RandomUIDGenerator struct { }
func (*RandomUIDGenerator) NewUID ¶
func (c *RandomUIDGenerator) NewUID() types.UID
type Request ¶
type Request interface { Run(ctx context.Context, s *MockKubeAPIServer) error Init(w http.ResponseWriter, r *http.Request) }
type ResourceInfo ¶
type ResourceInfo struct { API metav1.APIResource GVR schema.GroupVersionResource GVK schema.GroupVersionKind ListGVK schema.GroupVersionKind // contains filtered or unexported fields }
type TestClock ¶
type TestClock struct {
// contains filtered or unexported fields
}
func NewTestClock ¶
func NewTestClock() *TestClock
type TestUIDGenerator ¶
type TestUIDGenerator struct {
// contains filtered or unexported fields
}
func NewTestUIDGenerator ¶
func NewTestUIDGenerator() *TestUIDGenerator
func (*TestUIDGenerator) NewUID ¶
func (c *TestUIDGenerator) NewUID() types.UID
type UIDGenerator ¶
type WatchCallback ¶
type WatchCallback func(ev *watchEvent) error
type WatchOptions ¶
type WatchOptions struct {
Namespace string
}