options

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPath                = ".kc"
	DefaultDeployConfig        = "deploy-config.yaml"
	DefaultConfig              = "config"
	DefaultCaPath              = "pki"
	DefaultKcctlPKIPath        = "pki/kcctl"
	DefaultEtcdPKIPath         = "pki/etcd"
	DefaultNatsPKIPath         = "pki/nats"
	DefaultKCPKIPath           = "pki/kc"
	DefaultKcServerConfigPath  = "/etc/kubeclipper-server"
	DefaultKcAgentConfigPath   = "/etc/kubeclipper-agent"
	DefaultKcConsoleConfigPath = "/etc/kc-console"

	DefaultRegion = "default"

	// EtcdCa          = "etcd-ca"   //ca
	Ca               = "ca"
	EtcdPeer         = "etcd-peer" // peer
	EtcdServer       = "etcd"      // server
	EtcdKcClient     = "kc-server-etcd-client"
	EtcdHealthCheck  = "kube-etcd-healthcheck-client" // healthcheck-client
	NatsIOClient     = "kc-server-nats-client"
	NatsIOServer     = "kc-server-nats-server"
	KCServer         = "kc-server"
	NatsAltNameProxy = "proxy.kubeclipper.io" // add nats server SAN for agent proxy
	KCServerAltName  = "server.kubeclipper.io"

	AdminKcctlCert = "admin"
)
View Source
const (
	ResourceNode      = "node"
	ResourceCluster   = "cluster"
	ResourceUser      = "user"
	ResourceRole      = "role"
	ResourceConfigMap = "configmap"
	UpgradeKcctl      = "kcctl"
	UpgradeAgent      = "agent"
	UpgradeServer     = "server"
	UpgradeConsole    = "console"
	UpgradeAll        = "all"
)
View Source
const (
	Contact = `` /* 419-byte string literal not displayed */

)
View Source
const IPDetectDescription = `` /* 1712-byte string literal not displayed */

Variables

View Source
var (
	DefaultDeployConfigPath = filepath.Join(HomeDIR, DefaultPath, DefaultDeployConfig)
	DefaultConfigPath       = filepath.Join(HomeDIR, DefaultPath, DefaultConfig)
)
View Source
var AssumeYes bool
View Source
var (
	HomeDIR = homedir.HomeDir()
)

Functions

func AddFlagsToSSH

func AddFlagsToSSH(ssh *sshutils.SSH, flags *pflag.FlagSet)

func Omitempty

func Omitempty(data []byte) ([]byte, error)

Omitempty use unmarshal+marshal to omit empty field.

Types

type AgentRegions added in v1.2.0

type AgentRegions map[string][]string // key: region, value: ips

func (AgentRegions) Add added in v1.2.0

func (a AgentRegions) Add(region, ip string)

func (AgentRegions) Delete added in v1.2.0

func (a AgentRegions) Delete(ip string)

func (AgentRegions) Exists added in v1.2.0

func (a AgentRegions) Exists(ip string) bool

func (AgentRegions) ListIP added in v1.2.0

func (a AgentRegions) ListIP() []string

type Agents

type Agents map[string]Metadata // key:ip

func (Agents) Add

func (a Agents) Add(ip string, metadata Metadata)

func (Agents) Delete

func (a Agents) Delete(id string)

func (Agents) Exists

func (a Agents) Exists(ip string) bool

func (Agents) ExistsByID added in v1.3.1

func (a Agents) ExistsByID(id string) bool

func (Agents) ListIP

func (a Agents) ListIP() []string

type CliOptions

type CliOptions struct {
	Config string
	// contains filtered or unexported fields
}

func NewCliOptions

func NewCliOptions() *CliOptions

func (*CliOptions) AddFlags

func (c *CliOptions) AddFlags(flags *pflag.FlagSet)

func (*CliOptions) Complete

func (c *CliOptions) Complete() error

func (*CliOptions) ToRawConfig

func (c *CliOptions) ToRawConfig() config.Config

type DeployConfig

type DeployConfig struct {
	Config             string                         `json:"-" yaml:"-"`
	SSHConfig          *sshutils.SSH                  `json:"ssh" yaml:"ssh,omitempty"`
	EtcdConfig         *Etcd                          `json:"etcd" yaml:"etcd,omitempty"`
	ServerIPs          []string                       `json:"serverIPs" yaml:"serverIPs,omitempty"`
	Agents             Agents                         `json:"agents" yaml:"agents,omitempty"`
	Proxys             []string                       `json:"proxys" yaml:"proxys,omitempty"`
	IPDetect           string                         `json:"ipDetect" yaml:"ipDetect,omitempty"`
	NodeIPDetect       string                         `json:"nodeIPDetect" yaml:"nodeIPDetect,omitempty"`
	Debug              bool                           `json:"debug" yaml:"debug,omitempty"`
	DefaultRegion      string                         `json:"defaultRegion" yaml:"defaultRegion,omitempty"`
	ServerPort         int                            `json:"serverPort" yaml:"serverPort,omitempty"`
	TLS                bool                           `json:"tls" yaml:"tls,omitempty"`
	StaticServerPort   int                            `json:"staticServerPort" yaml:"staticServerPort,omitempty"`
	StaticServerPath   string                         `json:"staticServerPath" yaml:"staticServerPath,omitempty"`
	Pkg                string                         `json:"pkg" yaml:"pkg,omitempty"`
	ConsolePort        int                            `json:"consolePort" yaml:"consolePort,omitempty"`
	JWTSecret          string                         `json:"jwtSecret" yaml:"jwtSecret,omitempty"`
	AuditOpts          *option.AuditOptions           `json:"audit" yaml:"audit,omitempty"`
	MQ                 *MQ                            `json:"mq" yaml:"mq,omitempty"`
	OpLog              *OpLog                         `json:"opLog" yaml:"opLog,omitempty"`
	ImageProxy         *ImageProxy                    `json:"imageProxy" yaml:"imageProxy,omitempty"`
	AuthenticationOpts *options.AuthenticationOptions `json:"authentication" yaml:"authentication,omitempty"`
}

func NewDeployOptions

func NewDeployOptions() *DeployConfig

func (*DeployConfig) AddFlags

func (c *DeployConfig) AddFlags(flags *pflag.FlagSet)

func (*DeployConfig) Complete

func (c *DeployConfig) Complete() error

func (*DeployConfig) GetKcAgentConfigTemplateContent added in v1.2.0

func (c *DeployConfig) GetKcAgentConfigTemplateContent(metadata Metadata) (string, error)

func (*DeployConfig) GetKcServerConfigTemplateContent added in v1.2.0

func (c *DeployConfig) GetKcServerConfigTemplateContent(ip string) (string, error)

func (*DeployConfig) MergeDeployOptions

func (c *DeployConfig) MergeDeployOptions()

func (*DeployConfig) Write

func (c *DeployConfig) Write() error

type Etcd

type Etcd struct {
	ClientPort  int    `json:"clientPort" yaml:"clientPort,omitempty"`
	PeerPort    int    `json:"peerPort" yaml:"peerPort,omitempty"`
	MetricsPort int    `json:"metricsPort" yaml:"metricsPort,omitempty"`
	DataDir     string `json:"dataDir" yaml:"dataDir,omitempty"`
}

type FIPs added in v1.2.0

type FIPs map[string]string // key: ip, value: fip

type IOStreams

type IOStreams struct {
	// In think, os.Stdin
	In io.Reader
	// Out think, os.Stdout
	Out io.Writer
	// ErrOut think, os.Stderr
	ErrOut io.Writer
}

type ImageProxy

type ImageProxy struct {
	KcImageRepoMirror string `json:"kcImageRepoMirror" yaml:"kcImageRepoMirror,omitempty"`
}

type MQ

type MQ struct {
	External    bool     `json:"external" yaml:"external,omitempty"`
	TLS         bool     `json:"tls" yaml:"tls,omitempty"`
	CA          string   `json:"ca" yaml:"ca,omitempty"`
	ClientCert  string   `json:"clientCert" yaml:"clientCert,omitempty"`
	ClientKey   string   `json:"clientKey" yaml:"clientKey,omitempty"`
	IPs         []string `json:"ips" yaml:"ips,omitempty"`
	Port        int      `json:"port" yaml:"port,omitempty"`
	ClusterPort int      `json:"clusterPort" yaml:"clusterPort,omitempty"`
	User        string   `json:"user" yaml:"user,omitempty"`
	Secret      string   `json:"secret" yaml:"secret,omitempty"`
}

type Metadata added in v1.2.0

type Metadata struct {
	AgentID string `json:"agentID" yaml:"agentID,omitempty"`
	Region  string `json:"region" yaml:"region,omitempty"`
	FloatIP string `json:"floatIP" yaml:"floatIP,omitempty"`

	// proxy server for proxy kc-server(mq and static server)
	ProxyServer string `json:"proxyServer" yaml:"proxyServer,omitempty"`
	// address for server to access k8s apiserver
	ProxyAPIServer string `json:"proxyAPIServer" yaml:"proxyAPIServer,omitempty"`
	// address for server to access node's ssh
	ProxySSH string `json:"proxySSH" yaml:"proxySSH,omitempty"`
}

Metadata user custom node info,region will use by filter,use label,others use annotation.

type OpLog

type OpLog struct {
	Dir       string `json:"dir" yaml:"dir,omitempty"`
	Threshold int    `json:"threshold" yaml:"threshold,omitempty"`
}

Jump to

Keyboard shortcuts

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