config

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDoneDir        = "/tmp/zora/results"
	DoneDirEnvVar         = "DONE_DIR"
	PluginEnvVar          = "PLUGIN_NAME"
	ClusterEnvVar         = "CLUSTER_NAME"
	ClusterIssuesNsEnvVar = "CLUSTER_ISSUES_NAMESPACE"
	JobEnvVar             = "JOB_NAME"
	JobUIDEnvVar          = "JOB_UID"
)

Variables

View Source
var PluginParsers = map[string]func(logr.Logger, []byte) ([]*zorav1a1.ClusterIssueSpec, error){
	"popeye": popeye.Parse,
	"marvin": marvin.Parse,
}

PluginParsers correlates plugins with their respective parsing functions.

Functions

This section is empty.

Types

type Config

type Config struct {
	DonePath        string
	ErrorPath       string
	Plugin          string
	Cluster         string
	ClusterIssuesNs string
	Job             string
	JobUID          string
}

Config stores information used by the worker to create a list of <ClusterIssue> instances, and to specify the "done" file path.

func FromEnv

func FromEnv() (*Config, error)

FromEnv instantiates a new <Config> struct, with values taken from the environment. It'll return an error in case cluster related variables aren't found.

func New

func New() *Config

New instantiates a new <Config> struct, with the default path for the "done" file.

func (*Config) HandleDonePath

func (r *Config) HandleDonePath() error

HandleDonePath ensures the directory wherefrom the "done" file will be written exists.

func (*Config) HandleResultsPath

func (r *Config) HandleResultsPath() (io.Reader, error)

HandleResultsPath returns an <io.Reader> pointing to the path inside the "done" file.

func (*Config) Validate

func (r *Config) Validate() error

Validate ensures a <Config> instance has all its fields populated, and the plugin specified is supported by the worker.

Jump to

Keyboard shortcuts

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