mockkubeapiserver

package module
v0.0.0-...-cf8082c Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 23 Imported by: 6

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.

Index

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

type HTTPOperation struct {
	Request *http.Request
}

HTTPOperation contains the details of an HTTP operation

type Hook

type Hook interface {
}

Hook is the base interface implemented by a hook

type MockKubeAPIServer

type MockKubeAPIServer struct {
	// contains filtered or unexported fields
}

func NewMockKubeAPIServer

func NewMockKubeAPIServer(addr string, options ...Option) (*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) DirectTransport

func (s *MockKubeAPIServer) DirectTransport() http.RoundTripper

DirectTransport returns an http.RoundTripper that can serve requests without needing a listening socket.

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 Option

type Option func(config *MockKubeAPIServer) error

func WithStorage

func WithStorage(storage storage.Storage) Option

WithStorage is an Option that allows specifying the storage implementation.

type Request

type Request interface {
	Run(ctx context.Context, s *MockKubeAPIServer) error
	Init(w http.ResponseWriter, r *http.Request)
}

Directories

Path Synopsis
tools

Jump to

Keyboard shortcuts

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