config

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 4 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePersistTTLConfig added in v1.0.0

func ParsePersistTTLConfig(config *PersistTTLConfig) (*ttlcontroller.TTLconfig, error)

ParsePersistTTLConfig parse PersistTTLConfig to persistTTLConfigParsed.

Types

type ChaosControllerConfig

type ChaosControllerConfig struct {
	// ChaosDaemonPort is the port which grpc server listens on
	ChaosDaemonPort int `envconfig:"CHAOS_DAEMON_PORT" default:"31767"`

	TLSConfig

	// BPFKIPort is the port which BFFKI grpc server listens on
	BPFKIPort int `envconfig:"BPFKI_PORT" default:"50051"`
	// MetricsAddr is the address the metric endpoint binds to
	MetricsAddr string `envconfig:"METRICS_ADDR" default:":10080"`
	// PprofAddr is the address the pprof endpoint binds to.
	PprofAddr string `envconfig:"PPROF_ADDR" default:"0"`
	// EnableLeaderElection enables leader election for controller manager
	// Enabling this will ensure there is only one active controller manager
	EnableLeaderElection bool `envconfig:"ENABLE_LEADER_ELECTION" default:"false"`
	// EnableFilterNamespace will filter namespace with annotation. Only the pods/containers in namespace
	// annotated with `chaos-mesh.org/inject=enabled` will be injected
	EnableFilterNamespace bool `envconfig:"ENABLE_FILTER_NAMESPACE" default:"false"`
	// CertsDir is the directory for storing certs key file and cert file
	CertsDir string `envconfig:"CERTS_DIR" default:"/etc/webhook/certs"`
	// RPCTimeout is timeout of RPC between controllers and chaos-operator
	RPCTimeout    time.Duration `envconfig:"RPC_TIMEOUT" default:"1m"`
	WatcherConfig *watcher.Config
	// ClusterScoped means control Chaos Object in cluster level(all namespace),
	ClusterScoped bool `envconfig:"CLUSTER_SCOPED" default:"true"`
	// TargetNamespace is the target namespace to injecting chaos.
	// It only works with ClusterScoped is false;
	TargetNamespace string `envconfig:"TARGET_NAMESPACE" default:""`

	// DNSServiceName is the name of DNS service, which is used for DNS chaos
	DNSServiceName string `envconfig:"CHAOS_DNS_SERVICE_NAME" default:""`
	DNSServicePort int    `envconfig:"CHAOS_DNS_SERVICE_PORT" default:""`

	// SecurityMode is used for enable authority validation in admission webhook
	SecurityMode bool `envconfig:"SECURITY_MODE" default:"true" json:"security_mode"`

	// Namespace is the namespace which the controller manager run in
	Namespace string `envconfig:"NAMESPACE" default:""`

	// AllowHostNetworkTesting removes the restriction on chaos testing pods with `hostNetwork` set to true
	AllowHostNetworkTesting bool `envconfig:"ALLOW_HOST_NETWORK_TESTING" default:"false"`
}

ChaosControllerConfig defines the configuration for Chaos Controller

func EnvironChaosController

func EnvironChaosController() (ChaosControllerConfig, error)

EnvironChaosController returns the settings from the environment.

type ChaosDashboardConfig

type ChaosDashboardConfig struct {
	ListenHost           string            `envconfig:"LISTEN_HOST" default:"0.0.0.0" json:"listen_host"`
	ListenPort           int               `envconfig:"LISTEN_PORT" default:"2333" json:"listen_port"`
	MetricAddress        string            `envconfig:"METRIC_ADDRESS" json:"-"`
	EnableLeaderElection bool              `envconfig:"ENABLE_LEADER_ELECTION" json:"-"`
	Database             *DatabaseConfig   `json:"-"`
	PersistTTL           *PersistTTLConfig `json:"-"`
	// ClusterScoped means control Chaos Object in cluster level(all namespace),
	ClusterScoped bool `envconfig:"CLUSTER_SCOPED" default:"true" json:"cluster_mode"`
	// TargetNamespace is the target namespace to injecting chaos.
	// It only works with ClusterScoped is false;
	TargetNamespace string `envconfig:"TARGET_NAMESPACE" default:"" json:"target_namespace"`
	// EnableFilterNamespace will filter namespace with annotation. Only the pods/containers in namespace
	// annotated with `chaos-mesh.org/inject=enabled` will be injected
	EnableFilterNamespace bool `envconfig:"ENABLE_FILTER_NAMESPACE" default:"false"`

	// SecurityMode will use the token login by the user if set to true
	SecurityMode    bool   `envconfig:"SECURITY_MODE" default:"true" json:"security_mode"`
	DNSServerCreate bool   `envconfig:"DNS_SERVER_CREATE" default:"false" json:"dns_server_create"`
	Version         string `json:"version"`
}

ChaosDashboardConfig defines the configuration for Chaos Dashboard

func EnvironChaosDashboard

func EnvironChaosDashboard() (*ChaosDashboardConfig, error)

EnvironChaosDashboard returns the settings from the environment.

type DatabaseConfig

type DatabaseConfig struct {
	// Archive Chaos Experiments to DB
	Archive    bool
	Driver     string `envconfig:"DATABASE_DRIVER"     default:"sqlite3"`
	Datasource string `envconfig:"DATABASE_DATASOURCE" default:"core.sqlite"`
	Secret     string `envconfig:"DATABASE_SECRET"`
}

DatabaseConfig defines the configuration for databases

type PersistTTLConfig

type PersistTTLConfig struct {
	SyncPeriod string `envconfig:"CLEAN_SYNC_PERIOD" default:"12h"`
	Event      string `envconfig:"TTL_EVENT"       default:"168h"` // one week
	Experiment string `envconfig:"TTL_EXPERIMENT"  default:"336h"` // two weeks
}

PersistTTLConfig defines the configuration of ttl

type TLSConfig added in v1.2.0

type TLSConfig struct {
	// ChaosDaemonClientCert is the path of chaos daemon certificate
	ChaosDaemonClientCert string `envconfig:"CHAOS_DAEMON_CLIENT_CERT" default:""`
	// ChaosDaemonClientKey is the path of chaos daemon certificate key
	ChaosDaemonClientKey string `envconfig:"CHAOS_DAEMON_CLIENT_KEY" default:""`
	// ChaosMeshCACert is the path of chaos mesh ca cert
	ChaosMeshCACert string `envconfig:"CHAOS_MESH_CA_CERT" default:""`
}

TLSConfig defines the configuration for chaos-daemon tls client

Jump to

Keyboard shortcuts

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