config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Overview

Package config provides utilities to get configuration.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultCluster the default cluster name
	DefaultCluster = "kwok"

	// WorkDir is the directory of the work spaces.
	WorkDir = envs.GetEnvWithPrefix("WORKDIR", path.WorkDir())

	// ClustersDir is the directory of the clusters.
	ClustersDir = path.Join(WorkDir, "clusters")

	// GOOS is the operating system target for which the code is compiled.
	GOOS = runtime.GOOS

	// GOARCH is the architecture target for which the code is compiled.
	GOARCH = runtime.GOARCH
)

Functions

func ClusterName

func ClusterName(name string) string

ClusterName returns the cluster name.

func FilterWithType

func FilterWithType[T InternalObject](objs []InternalObject) (out []T)

FilterWithType returns a list of objects with the given type.

func FilterWithTypeFromContext

func FilterWithTypeFromContext[T metav1.Object](ctx context.Context) (out []T)

FilterWithTypeFromContext returns all objects of the given type from the context.

func GetKwokConfiguration

func GetKwokConfiguration(ctx context.Context) (conf *internalversion.KwokConfiguration)

GetKwokConfiguration get the configuration of the kwok.

func GetKwokctlConfiguration

func GetKwokctlConfiguration(ctx context.Context) (conf *internalversion.KwokctlConfiguration)

GetKwokctlConfiguration get the configuration of the kwokctl.

func InitFlags

func InitFlags(ctx context.Context, flags *pflag.FlagSet) (context.Context, error)

InitFlags initializes the flags for the configuration.

func Save

func Save(ctx context.Context, path string, objs []InternalObject) error

Save saves the given objects to the given path.

Types

type InternalObject added in v0.2.0

type InternalObject interface {
	GetNamespace() string
	GetName() string
}

InternalObject is an object that is internal to the kwok project.

func FilterWithoutType

func FilterWithoutType[T InternalObject](objs []InternalObject) (out []InternalObject)

FilterWithoutType filters out objects of the given type.

func FilterWithoutTypeFromContext

func FilterWithoutTypeFromContext[T InternalObject](ctx context.Context) (out []InternalObject)

FilterWithoutTypeFromContext returns all objects from the context that are not of the given type.

func Load

func Load(ctx context.Context, src ...string) ([]InternalObject, error)

Load loads the given path into the context.

Directories

Path Synopsis
Package compatibility provides compatible for old version of kwokctl.
Package compatibility provides compatible for old version of kwokctl.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳