namespace

package
v0.0.0-...-1b2a2de Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 19 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NilGetter = func() Instance {
	return nil
}

NilGetter is a Getter that always returns nil.

Functions

func Dump

func Dump(ctx resource.Context, name string)

func Setup

func Setup(ns *Instance, cfg Config) resource.SetupFn

Setup is a utility function for creating a namespace in a test suite.

Types

type Config

type Config struct {
	// Prefix to use for autogenerated namespace name
	Prefix string
	// Inject indicates whether to add sidecar injection label to this namespace
	Inject bool
	// Revision is the namespace of custom injector instance
	Revision string
	// Labels to be applied to namespace
	Labels map[string]string
	// SkipDump, if enabled, will disable dumping the namespace. This is useful to avoid duplicate
	// dumping of istio-system.
	SkipDump bool
	// SkipCleanup, if enabled, the namespace will not be deleted during cleanup. Used for istio-system namespace
	SkipCleanup bool
}

Config contains configuration information about the namespace instance

type Getter

type Getter func() Instance

Getter for a namespace Instance

func Future

func Future(ns *Instance) Getter

Future creates a Getter for a variable that namespace that will be set at sometime in the future. This is helpful for configuring a setup chain for a test suite that operates on global variables.

func (Getter) Get

func (g Getter) Get() Instance

Get is a utility method that helps in readability of call sites.

type Instance

type Instance interface {
	Name() string
	SetLabel(key, value string) error
	RemoveLabel(key string) error
	Prefix() string
	Labels() (map[string]string, error)
	IsAmbient() bool
	IsInjected() bool
}

Instance represents an allocated namespace that can be used to create config, or deploy components in.

func Claim

func Claim(ctx resource.Context, cfg Config) (i Instance, err error)

Claim an existing namespace in all clusters, or create a new one if doesn't exist.

func ClaimOrFail

func ClaimOrFail(t resource.ContextFailer, name string) Instance

ClaimOrFail calls Claim and fails test if it returns error

func GetAll

func GetAll(ctx resource.Context) ([]Instance, error)

GetAll returns all namespaces that have exist in the context.

func New

func New(ctx resource.Context, cfg Config) (i Instance, err error)

New creates a new Namespace in all clusters.

func NewOrFail

func NewOrFail(t resource.ContextFailer, nsConfig Config) Instance

NewOrFail calls New and fails test if it returns error

type Static

type Static string

Static is a namespace that may or may not exist. It is used for configuration purposes only

func (Static) IsAmbient

func (s Static) IsAmbient() bool

func (Static) IsInjected

func (s Static) IsInjected() bool

func (Static) Labels

func (s Static) Labels() (map[string]string, error)

func (Static) Name

func (s Static) Name() string

func (Static) Prefix

func (s Static) Prefix() string

func (Static) RemoveLabel

func (s Static) RemoveLabel(key string) error

func (Static) SetLabel

func (s Static) SetLabel(key, value string) error

func (*Static) UnmarshalJSON

func (s *Static) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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