config

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DefaultLoadBalancerClass is the default load balancer class
	DefaultLoadBalancerClass = "default"
)

Variables

LoadBalancerSizes contains the valid size names

Functions

This section is empty.

Types

type LBConfig

type LBConfig struct {
	LoadBalancer      LoadBalancerConfig
	LoadBalancerClass map[string]*LoadBalancerClassConfig
	NSXT              NsxtConfig
}

LBConfig is used to read and store information from the cloud configuration file

func ReadConfigINI

func ReadConfigINI(byConfig []byte) (*LBConfig, error)

ReadConfigINI parses vSphere cloud config file and stores it into Config

func ReadConfigYAML

func ReadConfigYAML(byConfig []byte) (*LBConfig, error)

ReadConfigYAML parses vSphere cloud config file and stores it into Config

func ReadLBConfig

func ReadLBConfig(byConfig []byte) (*LBConfig, error)

ReadLBConfig parses vSphere cloud config file and stores it into VSphereConfig. Environment variables are also checked

func (*LBConfig) IsEnabled

func (cfg *LBConfig) IsEnabled() bool

IsEnabled checks whether the load balancer feature is enabled It is enabled if any flavor of the load balancer configuration is given.

type LBConfigINI

type LBConfigINI struct {
	LoadBalancer      LoadBalancerConfigINI                  `gcfg:"loadbalancer"`
	LoadBalancerClass map[string]*LoadBalancerClassConfigINI `gcfg:"loadbalancerclass"`
	NSXT              NsxtConfigINI                          `gcfg:"nsxt"`
}

LBConfigINI is used to read and store information from the cloud configuration file

func ReadRawConfigINI

func ReadRawConfigINI(byConfig []byte) (*LBConfigINI, error)

ReadRawConfigINI parses vSphere cloud config file and stores it into ConfigINI

func (*LBConfigINI) CompleteAndValidate

func (lbc *LBConfigINI) CompleteAndValidate() error

CompleteAndValidate sets default values, overrides by env and validates the resulting config

func (*LBConfigINI) CreateConfig

func (lbc *LBConfigINI) CreateConfig() *LBConfig

CreateConfig generates a common Config object based on what other structs and funcs are already dependent upon in other packages.

type LBConfigYAML

type LBConfigYAML struct {
	LoadBalancer      LoadBalancerConfigYAML                  `yaml:"loadBalancer"`
	LoadBalancerClass map[string]*LoadBalancerClassConfigYAML `yaml:"loadBalancerClass"`
	NSXT              NsxtConfigYAML                          `yaml:"nsxt"`
}

LBConfigYAML is used to read and store information from the cloud configuration file

func ReadRawConfigYAML

func ReadRawConfigYAML(byConfig []byte) (*LBConfigYAML, error)

ReadRawConfigYAML parses vSphere cloud config file and stores it into ConfigYAML

func (*LBConfigYAML) CompleteAndValidate

func (lbc *LBConfigYAML) CompleteAndValidate() error

CompleteAndValidate sets default values, overrides by env and validates the resulting config

func (*LBConfigYAML) CreateConfig

func (lbc *LBConfigYAML) CreateConfig() *LBConfig

CreateConfig generates a common Config object based on what other structs and funcs are already dependent upon in other packages.

type LoadBalancerClassConfig

type LoadBalancerClassConfig struct {
	IPPoolName        string
	IPPoolID          string
	TCPAppProfileName string
	TCPAppProfilePath string
	UDPAppProfileName string
	UDPAppProfilePath string
}

LoadBalancerClassConfig contains the configuration for a load balancer class

type LoadBalancerClassConfigINI

type LoadBalancerClassConfigINI struct {
	IPPoolName        string `gcfg:"ip-pool-name"`
	IPPoolID          string `gcfg:"ip-pool-id"`
	TCPAppProfileName string `gcfg:"tcp-app-profile-name"`
	TCPAppProfilePath string `gcfg:"tcp-app-profile-path"`
	UDPAppProfileName string `gcfg:"udp-app-profile-name"`
	UDPAppProfilePath string `gcfg:"udp-app-profile-path"`
}

LoadBalancerClassConfigINI contains the configuration for a load balancer class

type LoadBalancerClassConfigYAML

type LoadBalancerClassConfigYAML struct {
	IPPoolName        string `yaml:"ipPoolName"`
	IPPoolID          string `yaml:"ipPoolId"`
	TCPAppProfileName string `yaml:"tcpAppProfileName"`
	TCPAppProfilePath string `yaml:"tcpAppProfilePath"`
	UDPAppProfileName string `yaml:"udpAppProfileName"`
	UDPAppProfilePath string `yaml:"udpAppProfilePath"`
}

LoadBalancerClassConfigYAML contains the configuration for a load balancer class

type LoadBalancerConfig

type LoadBalancerConfig struct {
	LoadBalancerClassConfig
	Size             string
	LBServiceID      string
	Tier1GatewayPath string
	AdditionalTags   map[string]string
}

LoadBalancerConfig contains the configuration for the load balancer itself

func (*LoadBalancerConfig) IsEmpty

func (cfg *LoadBalancerConfig) IsEmpty() bool

IsEmpty checks whether the load balancer config is empty (no values specified)

type LoadBalancerConfigINI

type LoadBalancerConfigINI struct {
	LoadBalancerClassConfigINI
	Size             string `gcfg:"size"`
	LBServiceID      string `gcfg:"lb-service-id"`
	Tier1GatewayPath string `gcfg:"tier1-gateway-path"`
	RawTags          string `gcfg:"tags"`
	AdditionalTags   map[string]string
}

LoadBalancerConfigINI contains the configuration for the load balancer itself

type LoadBalancerConfigYAML

type LoadBalancerConfigYAML struct {
	Size             string            `yaml:"size"`
	LBServiceID      string            `yaml:"lbServiceId"`
	Tier1GatewayPath string            `yaml:"tier1GatewayPath"`
	AdditionalTags   map[string]string `yaml:"tags"`

	// this struct use to inherit from LoadBalancerClassConfigYAML, but the YAML parser
	// wasnt able to indirectly parse inherited fields
	IPPoolName        string `yaml:"ipPoolName"`
	IPPoolID          string `yaml:"ipPoolId"`
	TCPAppProfileName string `yaml:"tcpAppProfileName"`
	TCPAppProfilePath string `yaml:"tcpAppProfilePath"`
	UDPAppProfileName string `yaml:"udpAppProfileName"`
	UDPAppProfilePath string `yaml:"udpAppProfilePath"`
}

LoadBalancerConfigYAML contains the configuration for the load balancer itself

type NsxtConfig

type NsxtConfig struct {
	// NSX-T username.
	User string
	// NSX-T password in clear text.
	Password string
	// NSX-T host.
	Host string
	// InsecureFlag is to be set to true if NSX-T uses self-signed cert.
	InsecureFlag bool

	VMCAccessToken     string
	VMCAuthHost        string
	ClientAuthCertFile string
	ClientAuthKeyFile  string
	CAFile             string
}

NsxtConfig contains the NSX-T specific configuration

func (*NsxtConfig) FromEnv

func (cfg *NsxtConfig) FromEnv() error

FromEnv initializes the provided configuration object with values obtained from environment variables. If an environment variable is set for a property that's already initialized, the environment variable's value takes precedence.

type NsxtConfigINI

type NsxtConfigINI struct {
	// NSX-T username.
	User string `gcfg:"user"`
	// NSX-T password in clear text.
	Password string `gcfg:"password"`
	// NSX-T host.
	Host string `gcfg:"host"`
	// InsecureFlag is to be set to true if NSX-T uses self-signed cert.
	InsecureFlag bool `gcfg:"insecure-flag"`

	VMCAccessToken     string `gcfg:"vmc-access-token"`
	VMCAuthHost        string `gcfg:"vmc-auth-host"`
	ClientAuthCertFile string `gcfg:"client-auth-cert-file"`
	ClientAuthKeyFile  string `gcfg:"client-auth-key-file"`
	CAFile             string `gcfg:"ca-file"`
}

NsxtConfigINI contains the NSX-T specific configuration

type NsxtConfigYAML

type NsxtConfigYAML struct {
	// NSX-T username.
	User string `yaml:"user"`
	// NSX-T password in clear text.
	Password string `yaml:"password"`
	// NSX-T host.
	Host string `yaml:"host"`
	// InsecureFlag is to be set to true if NSX-T uses self-signed cert.
	InsecureFlag bool `yaml:"insecureFlag"`

	VMCAccessToken     string `yaml:"vmcAccessToken"`
	VMCAuthHost        string `yaml:"vmcAuthHost"`
	ClientAuthCertFile string `yaml:"clientAuthCertFile"`
	ClientAuthKeyFile  string `yaml:"clientAuthKeyFile"`
	CAFile             string `yaml:"caFile"`
}

NsxtConfigYAML contains the NSX-T specific configuration

Jump to

Keyboard shortcuts

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