config

package
v0.0.0-...-bf252e8 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Pools []PoolConfig `yaml:"pools"`
}

type Opts

type Opts struct {
	// logger
	Logger struct {
		Debug       bool `long:"log.debug"    env:"LOG_DEBUG"  description:"debug mode"`
		Development bool `long:"log.devel"    env:"LOG_DEVEL"  description:"development mode"`
		Json        bool `long:"log.json"     env:"LOG_JSON"   description:"Switch log output to json format"`
	}

	// instance
	Instance struct {
		Nodename  *string `long:"instance.nodename"    env:"INSTANCE_NODENAME"   description:"Name of node where autopilot is running"`
		Namespace *string `long:"instance.namespace"   env:"INSTANCE_NAMESPACE"   description:"Name of namespace where autopilot is running"`
		Pod       *string `long:"instance.pod"         env:"INSTANCE_POD"         description:"Name of pod where autopilot is running"`
	}

	K8s struct {
		NodeLabelSelector     string        `` /* 150-byte string literal not displayed */
		WatchTimeout          time.Duration `` /* 153-byte string literal not displayed */
		ReapplyOnWatchTimeout bool          `long:"kube.watch.reapply"          env:"KUBE_WATCH_REAPPLY"          description:"Reapply node settings on watch timeout"`
	}

	// lease
	Lease struct {
		Enabled bool   `long:"lease.enable"  env:"LEASE_ENABLE"  description:"Enable lease (leader election; enabled by default in docker images)"`
		Name    string `long:"lease.name"    env:"LEASE_NAME"    description:"Name of lease lock"     default:"kube-pool-manager-leader"`
	}

	// server
	Server struct {
		// general options
		Bind         string        `long:"server.bind"              env:"SERVER_BIND"           description:"Server address"        default:":8080"`
		ReadTimeout  time.Duration `long:"server.timeout.read"      env:"SERVER_TIMEOUT_READ"   description:"Server read timeout"   default:"5s"`
		WriteTimeout time.Duration `long:"server.timeout.write"     env:"SERVER_TIMEOUT_WRITE"  description:"Server write timeout"  default:"10s"`
	}

	// general options
	DryRun bool   `long:"dry-run"  env:"DRY_RUN"       description:"Dry run (do not apply to nodes)"`
	Config string `long:"config"   env:"CONFIG"        description:"Config path"        required:"true"`
}

func (*Opts) GetJson

func (o *Opts) GetJson() []byte

type PoolConfig

type PoolConfig struct {
	Name     string               `yaml:"pool"`
	Continue bool                 `yaml:"continue"`
	Selector []PoolConfigSelector `yaml:"selector"`
	Node     PoolConfigNode       `yaml:"node"`
}

func (*PoolConfig) CreateJsonPatchSet

func (p *PoolConfig) CreateJsonPatchSet(node *corev1.Node) (patchSet *k8s.JsonPatchSet)

func (*PoolConfig) IsMatchingNode

func (p *PoolConfig) IsMatchingNode(logger *zap.SugaredLogger, node *corev1.Node) (bool, error)

type PoolConfigNode

type PoolConfigNode struct {
	Roles        PoolConfigNodeValueMap      `yaml:"roles"`
	JsonPatches  []k8s.JsonPatchObject       `yaml:"jsonPatches"`
	ConfigSource *PoolConfigNodeConfigSource `yaml:"configSource"`
	Labels       PoolConfigNodeValueMap      `yaml:"labels"`
	Annotations  PoolConfigNodeValueMap      `yaml:"annotations"`
}

type PoolConfigNodeConfigSource

type PoolConfigNodeConfigSource struct {
	ConfigMap struct {
		Name             string `yaml:"name" json:"name"`
		Namespace        string `yaml:"namespace" json:"namespace"`
		KubeletConfigKey string `yaml:"kubeletConfigKey" json:"kubeletConfigKey"`
	} `yaml:"configMap" json:"configMap"`
}

type PoolConfigNodeValueMap

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

func (*PoolConfigNodeValueMap) Entries

func (valueMap *PoolConfigNodeValueMap) Entries() map[string]*string

func (*PoolConfigNodeValueMap) UnmarshalYAML

func (valueMap *PoolConfigNodeValueMap) UnmarshalYAML(unmarshal func(interface{}) error) error

type PoolConfigSelector

type PoolConfigSelector struct {
	Path string `yaml:"path"`

	Match  *string `yaml:"match"`
	Regexp *string `yaml:"regexp"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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