k8sutil

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("k8sutil: The method is not implemented")

ErrNotImplemented this is returned when a CB method is not supported yet

Functions

func Configure

func Configure(ctx context.Context, file, namespace string) error

Configure applies file to k8s cluster and ensure that thr resource is configured

func Create

func Create(ctx context.Context, file, namespace string) error

Create applies file to k8s cluster and ensure that thr resource is created

func CreateNS

func CreateNS(ctx context.Context, namespace string) error

func Delete

func Delete(ctx context.Context, file, namespace string) error

Delete applies file to k8s cluster and ensure that thr resource is deleted

func DeleteNS

func DeleteNS(ctx context.Context, namespace string) error

func Do

func Do(r *http.Request) (*http.Response, error)

func Get added in v0.13.0

func Get(ctx context.Context, file, namespace string) error

func Init

func Init(ns, env, kubeconfig string) (func() error, error)

Types

type CB

type CB struct {
	InitFN      func(ns, kubeconfig string) (func() error, error)
	CreateFn    func(ctx context.Context, file, namespace string) error
	DeleteFn    func(ctx context.Context, file, namespace string) error
	ConfigureFn func(ctx context.Context, file, namespace string) error
	GetFn       func(ctx context.Context, file, namespace string) error
	CreateNSFn  func(ctx context.Context, ns string) error
	DeleteNSFn  func(ctx context.Context, ns string) error
}

CB is a helper struct satisfying CMD interface. Use the fields to provide callbacks for respective CMD method call.

func (CB) Configure

func (fn CB) Configure(ctx context.Context, file, namespace string) error

func (CB) Create

func (fn CB) Create(ctx context.Context, file, namespace string) error

func (CB) CreateNS

func (fn CB) CreateNS(ctx context.Context, namespace string) error

func (CB) Delete

func (fn CB) Delete(ctx context.Context, file, namespace string) error

func (CB) DeleteNS

func (fn CB) DeleteNS(ctx context.Context, namespace string) error

func (CB) Get added in v0.13.0

func (fn CB) Get(ctx context.Context, file, namespace string) error

func (CB) Init

func (fn CB) Init(ns, kubeconfig string) (func() error, error)

type CMD

type CMD interface {
	Init(ns, kubeconfig string) (cancel func() error, err error)
	CreateNS(ctx context.Context, ns string) error
	DeleteNS(ctx context.Context, ns string) error
	Create(ctx context.Context, file, namespace string) error
	Configure(ctx context.Context, file, namespace string) error
	Delete(ctx context.Context, file, namespace string) error
	Get(ctx context.Context, file, namespace string) error
}

type OpExpect

type OpExpect uint

OpExpect expected outcome from k8s operation

const (
	Created OpExpect = iota + 1
	Configured
	Deleted
	Got
)

expected k8s op outcome for resources

func (OpExpect) String

func (o OpExpect) String() string

type TykAPI

type TykAPI struct {
	Namespace  string
	Pod        string
	Container  string
	Kubeconfig string
}

func (TykAPI) Do

func (t TykAPI) Do(r *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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