k8s

package
v0.5.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

func GetConfig

func GetConfig(conn model.Connector, opts ...ConfigOption) (restConfig *rest.Config, err error)

GetConfig returns the rest.Config with the given model, by default, the rest.Config configures with 15s timeout/16 qps/64 burst, please modify the default configuration with ConfigOption as need.

func GetPodLogs

func GetPodLogs(
	ctx context.Context,
	cli *coreclient.CoreV1Client,
	namespace string,
	name string,
	w io.Writer,
	opts *core.PodLogOptions,
) error

GetPodLogs get the logs of a pod.

func LoadApiConfig

func LoadApiConfig(conn model.Connector) (apiConfig *api.Config, raw string, err error)

LoadApiConfig returns the client api.Config with the given model.

func New

New returns operator.Operator with the given options.

Types

type ConfigOption

type ConfigOption func(*rest.Config)

ConfigOption holds the modification to modify the return rest.Config.

func WithRateLimit

func WithRateLimit(qps float32, burst int) ConfigOption

WithRateLimit sets rate limitation.

func WithTimeout

func WithTimeout(t time.Duration) ConfigOption

WithTimeout sets the timeout.

func WithoutTimeout

func WithoutTimeout() ConfigOption

WithoutTimeout disables the timeout.

type Operator

type Operator struct {
	Logger        log.Logger
	Identifier    string
	ModelClient   model.ClientSet
	RestConfig    *rest.Config
	CoreCli       *coreclient.CoreV1Client
	BatchCli      *batchclient.BatchV1Client
	NetworkingCli *networkingclient.NetworkingV1Client
	DynamicCli    *dynamicclient.DynamicClient
}

func (Operator) Burst added in v0.3.1

func (op Operator) Burst() int

Burst implements operator.Operator.

func (Operator) Exec

func (op Operator) Exec(ctx context.Context, k string, opts optypes.ExecOptions) error

Exec implements operator.Operator.

func (Operator) GetComponents

func (op Operator) GetComponents(
	ctx context.Context,
	res *model.ResourceComponent,
) ([]*model.ResourceComponent, error)

GetComponents implements operator.Operator.

func (Operator) GetKeys

GetKeys implements operator.Operator.

func (Operator) GetStatus

func (op Operator) GetStatus(ctx context.Context, res *model.ResourceComponent) (*status.Status, error)

GetStatus implements operator.Operator.

func (Operator) ID added in v0.3.1

func (op Operator) ID() string

ID implements operator.Operator.

func (Operator) IsConnected

func (op Operator) IsConnected(ctx context.Context) error

IsConnected implements operator.Operator.

func (Operator) Label

func (op Operator) Label(ctx context.Context, res *model.ResourceComponent, labels map[string]string) error

Label implements operator.Operator.

func (Operator) Log

func (op Operator) Log(ctx context.Context, k string, opts optypes.LogOptions) error

Log implements operator.Operator.

func (Operator) Type

func (Operator) Type() optypes.Type

Type implements operator.Operator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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