config

package
v0.0.0-...-bbbbc68 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 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 `json:"pools"`
}

type Opts

type Opts struct {
	// logger
	Logger struct {
		Level string `` // nolint:staticcheck // multiple choices are ok
		/* 152-byte string literal not displayed */
		Format string `long:"log.format"   env:"LOG_FORMAT"  description:"Log format" choice:"logfmt" choice:"json" default:"logfmt"` // nolint:staticcheck // multiple choices are ok
		Source string ``                                                                                                              // nolint:staticcheck // multiple choices are ok
		/* 177-byte string literal not displayed */
		Color string `long:"log.color"    env:"LOG_COLOR"   description:"Enable color for logs" choice:"" choice:"auto" choice:"yes" choice:"no"` // nolint:staticcheck // multiple choices are ok
		Time  bool   `long:"log.time"     env:"LOG_TIME"    description:"Show log time"`
	}

	// 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               `json:"pool"`
	Continue bool                 `json:"continue"`
	Selector []PoolConfigSelector `json:"selector"`
	Node     PoolConfigNode       `json:"node"`
}

func (*PoolConfig) CreateJsonPatchSet

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

func (*PoolConfig) IsMatchingNode

func (p *PoolConfig) IsMatchingNode(logger *slogger.Logger, node *corev1.Node) (bool, error)

type PoolConfigNode

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

type PoolConfigNodeConfigSource

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

type PoolConfigNodeValueMap

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

func (*PoolConfigNodeValueMap) Entries

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

func (*PoolConfigNodeValueMap) UnmarshalJSON

func (valueMap *PoolConfigNodeValueMap) UnmarshalJSON(b []byte) error

type PoolConfigSelector

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

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

Jump to

Keyboard shortcuts

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