Documentation
¶
Index ¶
- Constants
- func IsSelected(labels Labels, selectors ...Selector) bool
- func RoundDuration(duration time.Duration) string
- type BuildContext
- type BuildOpts
- type BuildPlan
- type Component
- type Config
- func (c *Config) Finalize() error
- func (c *Config) LogConfig() *logger.Config
- func (c *Config) LogFlagSet() *flag.FlagSet
- func (c *Config) Logger() *slog.Logger
- func (c *Config) NewTopLevelLogger() *slog.Logger
- func (c *Config) Printf(format string, a ...any)
- func (c *Config) Println(a ...any)
- func (c *Config) Stderr() io.Writer
- func (c *Config) Stdin() io.Reader
- func (c *Config) Stdout() io.Writer
- func (c *Config) TxtarFlagSet() *flag.FlagSet
- func (c *Config) TxtarIndex() int
- func (c *Config) TxtarQuote() bool
- func (c *Config) Vet() error
- func (c *Config) Write(p []byte)
- func (c *Config) WriteFlagSet() *flag.FlagSet
- func (c *Config) WriteTo() string
- type Encoder
- type Exporter
- type Labels
- type Option
- type OrderedEncoder
- type Platform
- type Selector
- type Selectors
- type StringSlice
- type TagMap
- type TypeMeta
Constants ¶
const BuildPlanRequest string = "BuildPlanRequest"
BuildPlanRequest represents the kind value of a BuildPlanRequest
const BuildPlanResponse string = "BuildPlanResponse"
BuildPlanResponse represents the kind value of a BuildPlanResponse
const DefaultProvisionerNamespace = "secrets"
const TagMapHelp = "set the value of a cue @tag field in the form key=value or simply key"
const TypeMetaFile string = "typemeta.yaml"
TypeMetaFile represents the file holos uses to discriminate the api version of a component BuildPlan.
const WriteToDefault string = "deploy"
WriteToDefault represents the default value of the --write-to flag which is the base directory where holos render component writes rendered configuration into.
const WriteToEnvVar string = "HOLOS_WRITE_TO"
WriteToEnvVar represents the environment variable used to look up the default value of the --write-to flag.
Variables ¶
This section is empty.
Functions ¶
func IsSelected ¶ added in v0.100.0
IsSelected returns true if any one selector selects the given labels or no selectors are given.
func RoundDuration ¶ added in v0.90.0
RoundDuration rounds a duration to the nearest unit based on its length.
Types ¶
type BuildContext ¶ added in v0.104.2
type BuildContext struct {
// TempDir represents the temporary directory managed and owned by the holos
// render component command for the execution of one BuildPlan. Multiple
// tasks in the build plan share this temporary directory and therefore should
// avoid reading and writing into the same sub-directories as one another.
TempDir string `json:"tempDir" yaml:"tempDir"`
}
BuildContext represents build context values provided by the holos render component command. These values are expected to be randomly generated and late binding, meaning they cannot be known ahead of time in a static configuration. As such, CUE configuration may refer to the values here which will be populated by holos when the final build plan is exported from CUE.
type BuildOpts ¶ added in v0.100.0
type BuildOpts struct {
Store artifact.Store
Concurrency int
Stderr io.Writer
WriteTo string
// Path represents the component path relative to the platform module root.
Path string
// Tags represents user managed tags including a component name, labels, and
// annotations.
Tags []string
// contains filtered or unexported fields
}
BuildOpts represents options common across BuildPlan api versions. Use NewBuildOpts to create a new concrete value.
func NewBuildOpts ¶ added in v0.100.0
NewBuildOpts returns a BuildOpts configured to build the component at leaf from the platform module at root writing rendered manifests into the deploy directory.
func (*BuildOpts) AbsWriteTo ¶ added in v0.104.2
AbsWriteTo returns the absolute path to the write to directory, usually the deploy sub directory of the platform module root.
func (*BuildOpts) Leaf ¶ added in v0.104.2
Leaf returns the cleaned component path relative to the platform root. For example "components/podinfo"
func (*BuildOpts) Root ¶ added in v0.104.2
Root returns the platform root directory containing the cue module.
func (*BuildOpts) TempDir ¶ added in v0.104.2
TempDir returns the temporary directory managed by holos and injected into cue using a BuildContext so artifacts can refer to the same path in the configuration.
type BuildPlan ¶ added in v0.100.0
type BuildPlan interface {
Load(cue.Value) error
Build(context.Context) error
Export(idx int, encoder OrderedEncoder) error
}
BuildPlan is the interface to load, build, and export a BuildPlan from a cue value.
type Component ¶ added in v0.100.0
type Component interface {
// Describe represents a description of the component for user feedback.
Describe() string
// Path represents the component path relative to the platform root.
Path() string
// Tags represents the Component name, labels, annotations injected into cue
// for BuildPlan export.
Tags() ([]string, error)
}
Component represents the information needed to produce a BuildPlan from a platform component.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds configuration for the whole program, used by main(). The config should be initialized early at a well known location in the program lifecycle then remain immutable.
func (*Config) Finalize ¶
Finalize validates the config and finalizes the startup lifecycle based on user configuration.
func (*Config) LogFlagSet ¶
LogFlagSet returns the logging *flag.FlagSet for use by the command handler.
func (*Config) Logger ¶
Logger returns a *slog.Logger configured by the user or the default logger if no logger has been configured by the user.
func (*Config) NewTopLevelLogger ¶
NewTopLevelLogger returns a *slog.Logger with a handler that filters source attributes. Useful as a top level error logger in main().
func (*Config) TxtarFlagSet ¶
TxtarFlagSet returns the *flag.FlagSet for txtar related commands.
func (*Config) TxtarQuote ¶ added in v0.98.0
func (*Config) WriteFlagSet ¶
WriteFlagSet returns a *flag.FlagSet wired to c *Config. Useful for commands that write files.
type Encoder ¶ added in v0.100.0
Encoder encodes to json or yaml. Concrete values must be safe for concurrent execution. Use NewEncoder to obtain a json or yaml encoder.
type Exporter ¶ added in v0.104.2
Exporter is the interface used to export Platform, Component, and BuildPlan resources. Useful for the show subcommand.
type Option ¶
type Option func(o *options)
An Option configures a Config using [functional options](https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html).
type OrderedEncoder ¶ added in v0.100.0
OrderedEncoder encodes in sequential order from idx 0. Concrete values must be safe for concurrent execution. Use NewSequentialEncoder to obtain a json or yaml encoder.
func NewSequentialEncoder ¶ added in v0.100.0
func NewSequentialEncoder(encoding string, w io.Writer) (OrderedEncoder, error)
NewSequentialEncoder returns a yaml or json encoder that writes to w. The encoding argument may be "json" or "yaml".
type Platform ¶ added in v0.100.0
type Platform interface {
Load(cue.Value) error
Select(...Selector) []Component
Export(Encoder) error
}
Platform is the interface all Platform versions must support.
Concrete values must preserve the relative ordering of components when filtering with Select.
type Selector ¶ added in v0.100.0
func (*Selector) IsSelected ¶ added in v0.100.0
IsSelected returns true when the selector selects the given labels
type Selectors ¶ added in v0.102.4
type Selectors []Selector
type StringSlice ¶
type StringSlice []string
StringSlice represents zero or more flag values.
func (*StringSlice) Set ¶
func (i *StringSlice) Set(value string) error
Set implements the flag.Value interface.
func (*StringSlice) String ¶
func (i *StringSlice) String() string
String implements the flag.Value interface.
func (*StringSlice) Type ¶
func (i *StringSlice) Type() string
Type implements the pflag.Value interface and describes the type.
type TagMap ¶ added in v0.100.0
TagMap represents a map of key values for CUE TagMap for flag parsing. The values are pointers to disambiguate between the case where a tag is a boolean ("--inject foo") and the case where a tag has a string zero value ("--inject foo="). Refer to the Tags field of cue/load.Config
type TypeMeta ¶ added in v0.100.0
type TypeMeta struct {
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
}
TypeMeta represents the kind and version of a resource holos needs to process. Useful to discriminate generated resources.