config

package
v0.20.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultconfigRoot     = "/etc/rte"
	LegacyExtraConfigPath = "/etc/resource-topology-exporter/config.yaml"
)
View Source
const (
	DefaultConfigRoot = "/etc/rte"
)

Variables

View Source
var (
	SkipDirectory = errors.New("skip config directory")
)

Functions

func Finalize added in v0.17.0

func Finalize(pArgs *ProgArgs) error

func FixExtraConfigPath added in v0.17.0

func FixExtraConfigPath(configRoot string) string

func FromEnv added in v0.17.0

func FromEnv(pArgs *ProgArgs)

func FromFiles added in v0.17.0

func FromFiles(pArgs *ProgArgs, configRoot, extraConfigPath string) error

func FromFlags added in v0.17.0

func FromFlags(pArgs *ProgArgs, args ...string) (string, string, error)

func HostNameFromEnv added in v0.17.0

func HostNameFromEnv() string

func IsConfigRootAllowed added in v0.20.3

func IsConfigRootAllowed(cfgPath string, addDirFns ...func() (string, error)) (string, error)

IsConfigRootAllowed checks if an *already cleaned and canonicalized* path is among the allowed list. use `addDirFns` to inject user-dependent paths (e.g. $HOME). Returns the matched pattern, if any, and error describing the failure. The error is only relevant if failed to inject user-provided paths.

func ReadConfiglet added in v0.20.3

func ReadConfiglet(configPath string) ([]byte, error)

func ReadConfigletDir added in v0.20.3

func ReadConfigletDir(configPath string) ([]fs.DirEntry, error)

func SetDefaults added in v0.17.0

func SetDefaults(pArgs *ProgArgs)

func TopologyManagerPolicyFromEnv added in v0.17.0

func TopologyManagerPolicyFromEnv() string

func TopologyManagerScopeFromEnv added in v0.17.0

func TopologyManagerScopeFromEnv() string

func UserHomeDir added in v0.20.3

func UserHomeDir() (string, error)

func UserRunDir added in v0.20.3

func UserRunDir() (string, error)

func Validate added in v0.17.0

func Validate(pArgs *ProgArgs) error

Types

type GlobalArgs added in v0.17.0

type GlobalArgs struct {
	KubeConfig string `json:"kubeConfig,omitempty"`
	Debug      bool   `json:"debug,omitempty"`
	Verbose    int    `json:"verbose"`
}

func (GlobalArgs) Clone added in v0.17.0

func (args GlobalArgs) Clone() GlobalArgs

type ProgArgs

type ProgArgs struct {
	Global          GlobalArgs                    `json:"global,omitempty"`
	NRTupdater      nrtupdater.Args               `json:"nrtUpdater,omitempty"`
	Resourcemonitor resourcemonitor.Args          `json:"resourceMonitor,omitempty"`
	RTE             resourcetopologyexporter.Args `json:"topologyExporter,omitempty"`
	Version         bool                          `json:"-"`
	DumpConfig      string                        `json:"-"`
}

func LoadArgs

func LoadArgs(args ...string) (ProgArgs, error)

The args is passed only for testing purposes.

func (ProgArgs) Clone added in v0.17.0

func (pa ProgArgs) Clone() ProgArgs

func (*ProgArgs) ToJSONString added in v0.17.0

func (pa *ProgArgs) ToJSONString() string

func (*ProgArgs) ToYAMLString added in v0.17.0

func (pa *ProgArgs) ToYAMLString() string

Jump to

Keyboard shortcuts

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