config

package
v0.0.0-...-6eb52ac Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 26 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorEmptyFile indicates that manifest file was empty.
	// Useful to distinguish where the manifast was empty or malformed.
	ErrorEmptyFile = errors.New("emptyfile")
)

Functions

func GetFuncs

func GetFuncs(fsys fs.FS) template.FuncMap

GetFuncs returns map of names to functions, that are supported by template provider.

func GetMapping

func GetMapping(clusterLoaderConfig *ClusterLoaderConfig, testOverridePaths []string) (map[string]interface{}, *errors.ErrorList)

GetMapping returns template variable mapping for the given ClusterLoaderConfig.

func LoadCL2Envs

func LoadCL2Envs() (map[string]interface{}, error)

LoadCL2Envs returns mapping from the envs starting with CL2_ prefix.

func LoadTestOverrides

func LoadTestOverrides(paths []string, testOverridePaths []string) (map[string]interface{}, error)

LoadTestOverrides returns mapping from file specified by the given paths. Test specific overrides in testOverridePath will supersede any global overrides.

func LoadTestSuite

func LoadTestSuite(path string) (api.TestSuite, error)

LoadTestSuite creates test suite config from file specified by the given path.

func MergeMappings

func MergeMappings(a, b map[string]interface{}) error

MergeMappings modifies map b to contain all new key=value pairs from b. It will return error in case of conflict, i.e. if exists key k for which a[k] != b[k]

Types

type ClusterConfig

type ClusterConfig struct {
	KubeConfigPath      string
	RunFromCluster      bool
	Nodes               int
	Provider            provider.Provider
	EtcdCertificatePath string
	EtcdKeyPath         string
	EtcdInsecurePort    int
	MasterIPs           []string
	MasterInternalIPs   []string
	MasterName          string
	// Deprecated: use NamespaceConfig.DeleteStaleNamespaces instead.
	DeleteStaleNamespaces bool
	// TODO(#1696): Clean up after removing automanagedNamespaces
	DeleteAutomanagedNamespaces bool
	// APIServerPprofByClientEnabled determines whether kube-apiserver pprof endpoint can be accessed
	// using kubernetes client. If false, clusterloader will avoid collecting kube-apiserver profiles.
	APIServerPprofByClientEnabled bool
	KubeletPort                   int
	K8SClientsNumber              int
	SkipClusterVerification       bool
}

ClusterConfig is a structure that represents cluster description.

func (*ClusterConfig) GetMasterIP

func (c *ClusterConfig) GetMasterIP() string

GetMasterIP returns the first master ip, added for backward compatibility. TODO(mmatt): Remove this method once all the codebase is migrated to support multiple masters.

func (*ClusterConfig) GetMasterInternalIP

func (c *ClusterConfig) GetMasterInternalIP() string

GetMasterInternalIP returns the first internal master ip, added for backward compatibility. TODO(mmatt): Remove this method once all the codebase is migrated to support multiple masters.

type ClusterLoaderConfig

type ClusterLoaderConfig struct {
	ClusterConfig     ClusterConfig
	ReportDir         string
	ExecServiceConfig ExecServiceConfig
	ModifierConfig    ModifierConfig
	PrometheusConfig  PrometheusConfig
	// OverridePaths defines what override files should be applied
	// globally to the config specified by the ConfigPath for each TestScenario.
	OverridePaths []string `json:"overridePaths"`
}

ClusterLoaderConfig represents all single test run parameters used by CLusterLoader.

type ExecServiceConfig

type ExecServiceConfig struct {
	// Determines if service config should be enabled.
	Enable bool
}

ExecServiceConfig represents all flags used by service config.

type ModifierConfig

type ModifierConfig struct {
	// A list of overwrites applied to each test config
	OverwriteTestConfig []string
	// A list of names of steps that should be ignored when executing test run
	SkipSteps []string
}

ModifierConfig represent all flags used by test modification

type PrometheusConfig

type PrometheusConfig struct {
	TearDownServer             bool
	EnableServer               bool
	EnablePushgateway          bool
	ScrapeEtcd                 bool
	ScrapeNodeExporter         bool
	ScrapeWindowsNodeExporter  bool
	ScrapeKubelets             bool
	ScrapeMasterKubelets       bool
	ScrapeKubeProxy            bool
	KubeProxySelectorKey       string
	ScrapeKubeStateMetrics     bool
	ScrapeMetricsServerMetrics bool
	ScrapeNodeLocalDNS         bool
	ScrapeAnet                 bool
	ScrapeMastersWithPublicIPs bool
	APIServerScrapePort        int
	SnapshotProject            string
	ManifestPath               string
	StorageClassProvisioner    string
	StorageClassVolumeType     string
	PVCStorageClass            string
	ReadyTimeout               time.Duration
	PrometheusMemoryRequest    string
}

PrometheusConfig represents all flags used by prometheus.

type TemplateProvider

type TemplateProvider struct {
	// contains filtered or unexported fields
}

TemplateProvider provides object templates. Templates in unstructured form are served by reading file from given path or by using cache if available.

func NewTemplateProvider

func NewTemplateProvider(fsys fs.FS) *TemplateProvider

NewTemplateProvider creates new template provider.

func (*TemplateProvider) RawToObject

func (tp *TemplateProvider) RawToObject(path string) (*unstructured.Unstructured, error)

RawToObject creates object from file specified by the given path or uses cached object if available.

func (*TemplateProvider) TemplateInto

func (tp *TemplateProvider) TemplateInto(path string, mapping map[string]interface{}, obj interface{}) error

TemplateInto decodes template specified by the given path into given structure.

func (*TemplateProvider) TemplateToConfig

func (tp *TemplateProvider) TemplateToConfig(path string, mapping map[string]interface{}) (*api.Config, error)

TemplateToConfig creates test config from file specified by the given path. Template's placeholders are replaced based on provided mapping.

func (*TemplateProvider) TemplateToObject

func (tp *TemplateProvider) TemplateToObject(path string, mapping map[string]interface{}) (*unstructured.Unstructured, error)

TemplateToObject creates object from file specified by the given path or uses cached object if available. Template's placeholders are replaced based on provided mapping.

Jump to

Keyboard shortcuts

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