Documentation ¶
Overview ¶
Package config provides utilities to get configuration.
Index ¶
- Variables
- func ClusterName(name string) string
- func FilterWithType[T InternalObject](objs []InternalObject) (out []T)
- func FilterWithTypeFromContext[T metav1.Object](ctx context.Context) (out []T)
- func GetKwokConfiguration(ctx context.Context) (conf *internalversion.KwokConfiguration)
- func GetKwokctlConfiguration(ctx context.Context) (conf *internalversion.KwokctlConfiguration)
- func InitFlags(ctx context.Context, flags *pflag.FlagSet) (context.Context, error)
- func Marshal(obj InternalObject) ([]byte, error)
- func Save(ctx context.Context, dist string, objs []InternalObject) error
- func SaveTo(ctx context.Context, w io.Writer, objs []InternalObject) error
- func UnmarshalWithType[T InternalObject, D string | []byte](raw D) (t T, err error)
- type InternalObject
- func FilterWithoutType[T InternalObject](objs []InternalObject) (out []InternalObject)
- func FilterWithoutTypeFromContext[T InternalObject](ctx context.Context) (out []InternalObject)
- func GetFromContext(ctx context.Context) []InternalObject
- func Load(ctx context.Context, src ...string) ([]InternalObject, error)
- func LoadUnstructured(src ...string) ([]InternalObject, error)
- func Unmarshal[D string | []byte](d D) (InternalObject, error)
Constants ¶
This section is empty.
Variables ¶
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 FilterWithType ¶
func FilterWithType[T InternalObject](objs []InternalObject) (out []T)
FilterWithType returns a list of objects with the given type.
func FilterWithTypeFromContext ¶
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 Marshal ¶ added in v0.4.0
func Marshal(obj InternalObject) ([]byte, error)
Marshal marshals the given internal object into a raw message.
func Save ¶
func Save(ctx context.Context, dist string, objs []InternalObject) error
Save saves the given objects to the given path.
func UnmarshalWithType ¶ added in v0.4.0
func UnmarshalWithType[T InternalObject, D string | []byte](raw D) (t T, err error)
UnmarshalWithType unmarshals the given raw message into the internal object.
Types ¶
type InternalObject ¶ added in v0.2.0
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 GetFromContext ¶ added in v0.4.0
func GetFromContext(ctx context.Context) []InternalObject
GetFromContext returns the objects from the context.
func Load ¶
func Load(ctx context.Context, src ...string) ([]InternalObject, error)
Load loads the given path into the context.
func LoadUnstructured ¶ added in v0.6.0
func LoadUnstructured(src ...string) ([]InternalObject, error)
LoadUnstructured loads the given path into the context.