config

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// DefaultRoundTripperCount is the number of allowed round trips
	// before an error is returned.
	DefaultRoundTripperCount uint = 3

	// DefaultAPIBinding is the default ADDRESS:PORT binding used for
	// exposing the API service.
	DefaultAPIBinding string = ":43001"

	// DefaultVCenterPortStr is the default port used to access vCenter in string form
	DefaultVCenterPortStr string = "443"
	// DefaultVCenterPort is the default port used to access vCenter in uint form
	DefaultVCenterPort uint = 443

	// DefaultSecretDirectory is the default path to the secrets directory.
	DefaultSecretDirectory string = "/etc/cloud/secrets"

	// IPv6Family string representation for IPv6
	IPv6Family = "ipv6"
	// IPv4Family string representation for IPv4
	IPv4Family = "ipv4"

	// DefaultIPFamily is the default IP addressing to use for networking
	DefaultIPFamily = IPv4Family

	// DefaultCredentialManager used for the Global CredMgr/Lister
	DefaultCredentialManager string = "Global"
)

Variables

View Source
var (
	// ErrUsernameMissing is returned when the provided username is empty.
	ErrUsernameMissing = errors.New("Username is missing")

	// ErrPasswordMissing is returned when the provided password is empty.
	ErrPasswordMissing = errors.New("Password is missing")

	// ErrInvalidVCenterIP is returned when the provided vCenter IP address is
	// missing from the provided configuration.
	ErrInvalidVCenterIP = errors.New("vsphere.conf does not have the VirtualCenter IP address specified")

	// ErrMissingVCenter is returned when the provided configuration does not
	// define any vCenters.
	ErrMissingVCenter = errors.New("No Virtual Center hosts defined")

	// ErrInvalidIPFamilyType is returned when an invalid IPFamily type is encountered
	ErrInvalidIPFamilyType = errors.New("Invalid IP Family type")
)

Functions

This section is empty.

Types

type CommonConfigINI added in v1.2.0

type CommonConfigINI struct {
	// Global values...
	Global GlobalINI

	// Virtual Center configurations
	VirtualCenter map[string]*VirtualCenterConfigINI

	// Tag categories and tags which correspond to "built-in node labels: zones and region"
	Labels LabelsINI
}

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

func ReadRawConfigINI added in v1.2.0

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

ReadRawConfigINI parses vSphere cloud config file and stores it into ConfigINI

func (*CommonConfigINI) CreateConfig added in v1.2.0

func (cci *CommonConfigINI) CreateConfig() *Config

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

type CommonConfigYAML added in v1.2.0

type CommonConfigYAML struct {
	// Global values...
	Global GlobalYAML

	// Virtual Center configurations
	Vcenter map[string]*VirtualCenterConfigYAML

	// Tag categories and tags which correspond to "built-in node labels: zones and region"
	Labels LabelsYAML
}

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

func ReadRawConfigYAML added in v1.2.0

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

ReadRawConfigYAML parses vSphere cloud config file and stores it into ConfigYAML

func (*CommonConfigYAML) CreateConfig added in v1.2.0

func (ccy *CommonConfigYAML) CreateConfig() *Config

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

type Config

type Config struct {
	// Global settings
	Global Global

	// Virtual Center configurations
	VirtualCenter map[string]*VirtualCenterConfig

	// Tag categories and tags which correspond to "built-in node labels: zones and region"
	Labels Labels
}

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

func ReadConfig

func ReadConfig(byConfig []byte) (*Config, error)

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

func ReadConfigINI added in v1.2.0

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

ReadConfigINI parses vSphere cloud config file and stores it into Config

func ReadConfigYAML added in v1.2.0

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

ReadConfigYAML parses vSphere cloud config file and stores it into Config

func (*Config) FromEnv added in v1.1.0

func (cfg *Config) FromEnv() error

FromEnv initializes the provided configuratoin 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 Global added in v1.2.0

type Global struct {
	// vCenter username.
	User string
	// vCenter password in clear text.
	Password string
	// Deprecated. Use VirtualCenter to specify multiple vCenter Servers.
	// vCenter IP.
	VCenterIP string
	// vCenter port.
	VCenterPort string
	// True if vCenter uses self-signed cert.
	InsecureFlag bool
	// Datacenter in which VMs are located.
	Datacenters string
	// Soap round tripper count (retries = RoundTripper - 1)
	RoundTripperCount uint
	// Specifies the path to a CA certificate in PEM format. Optional; if not
	// configured, the system's CA certificates will be used.
	CAFile string
	// Thumbprint of the VCenter's certificate thumbprint
	Thumbprint string
	// Name of the secret were vCenter credentials are present.
	SecretName string
	// Secret Namespace where secret will be present that has vCenter credentials.
	SecretNamespace string
	// Secret directory in the event that:
	// 1) we don't want to use the k8s API to listen for changes to secrets
	// 2) we are not in a k8s env, namely DC/OS, since CSI is CO agnostic
	// Default: /etc/cloud/credentials
	SecretsDirectory string
	// Disable the vSphere CCM API
	// Default: true
	APIDisable bool
	// Configurable vSphere CCM API port
	// Default: 43001
	APIBinding string
}

Global struct

type GlobalINI added in v1.2.0

type GlobalINI struct {
	// vCenter username.
	User string `gcfg:"user"`
	// vCenter password in clear text.
	Password string `gcfg:"password"`
	// Deprecated. Use VirtualCenter to specify multiple vCenter Servers.
	// vCenter IP.
	VCenterIP string `gcfg:"server"`
	// vCenter port.
	VCenterPort string `gcfg:"port"`
	// True if vCenter uses self-signed cert.
	InsecureFlag bool `gcfg:"insecure-flag"`
	// Datacenter in which VMs are located.
	Datacenters string `gcfg:"datacenters"`
	// Soap round tripper count (retries = RoundTripper - 1)
	RoundTripperCount uint `gcfg:"soap-roundtrip-count"`
	// Specifies the path to a CA certificate in PEM format. Optional; if not
	// configured, the system's CA certificates will be used.
	CAFile string `gcfg:"ca-file"`
	// Thumbprint of the VCenter's certificate thumbprint
	Thumbprint string `gcfg:"thumbprint"`
	// Name of the secret were vCenter credentials are present.
	SecretName string `gcfg:"secret-name"`
	// Secret Namespace where secret will be present that has vCenter credentials.
	SecretNamespace string `gcfg:"secret-namespace"`
	// Secret directory in the event that:
	// 1) we don't want to use the k8s API to listen for changes to secrets
	// 2) we are not in a k8s env, namely DC/OS, since CSI is CO agnostic
	// Default: /etc/cloud/credentials
	SecretsDirectory string `gcfg:"secrets-directory"`
	// Disable the vSphere CCM API
	// Default: true
	APIDisable bool `gcfg:"api-disable"`
	// Configurable vSphere CCM API port
	// Default: 43001
	APIBinding string `gcfg:"api-binding"`
	// IP Family enables the ability to support IPv4 or IPv6
	// Supported values are:
	// ipv4 - IPv4 addresses only (Default)
	// ipv6 - IPv6 addresses only
	IPFamily string `gcfg:"ip-family"`
}

GlobalINI are global values

type GlobalYAML added in v1.2.0

type GlobalYAML struct {
	// vCenter username.
	User string `yaml:"user"`
	// vCenter password in clear text.
	Password string `yaml:"password"`
	// Deprecated. Use VirtualCenter to specify multiple vCenter Servers.
	// vCenter IP.
	VCenterIP string `yaml:"server"`
	// vCenter port.
	VCenterPort uint `yaml:"port"`
	// True if vCenter uses self-signed cert.
	InsecureFlag bool `yaml:"insecureFlag"`
	// Datacenter in which VMs are located.
	Datacenters []string `yaml:"datacenters"`
	// Soap round tripper count (retries = RoundTripper - 1)
	RoundTripperCount uint `yaml:"soapRoundtripCount"`
	// Specifies the path to a CA certificate in PEM format. Optional; if not
	// configured, the system's CA certificates will be used.
	CAFile string `yaml:"caFile"`
	// Thumbprint of the VCenter's certificate thumbprint
	Thumbprint string `yaml:"thumbprint"`
	// Name of the secret were vCenter credentials are present.
	SecretName string `yaml:"secretName"`
	// Secret Namespace where secret will be present that has vCenter credentials.
	SecretNamespace string `yaml:"secretNamespace"`
	// Secret directory in the event that:
	// 1) we don't want to use the k8s API to listen for changes to secrets
	// 2) we are not in a k8s env, namely DC/OS, since CSI is CO agnostic
	// Default: /etc/cloud/credentials
	SecretsDirectory string `yaml:"secretsDirectory"`
	// Disable the vSphere CCM API
	// Default: true
	APIDisable bool `yaml:"apiDisable"`
	// Configurable vSphere CCM API port
	// Default: 43001
	APIBinding string `yaml:"apiBinding"`
	// IP Family enables the ability to support IPv4 or IPv6
	// Supported values are:
	// ipv4 - IPv4 addresses only (Default)
	// ipv6 - IPv6 addresses only
	IPFamilyPriority []string `yaml:"ipFamily"`
}

GlobalYAML are global values

type Labels added in v1.2.0

type Labels struct {
	// Zone describes a zone
	Zone string
	// Region describes a region
	Region string
}

Labels struct

type LabelsINI added in v1.2.0

type LabelsINI struct {
	Zone   string `gcfg:"zone"`
	Region string `gcfg:"region"`
}

LabelsINI tags categories and tags which correspond to "built-in node labels: zones and region"

type LabelsYAML added in v1.2.0

type LabelsYAML struct {
	Zone   string `yaml:"zone"`
	Region string `yaml:"region"`
}

LabelsYAML tags categories and tags which correspond to "built-in node labels: zones and region"

type VirtualCenterConfig

type VirtualCenterConfig struct {
	// vCenter username.
	User string
	// vCenter password in clear text.
	Password string
	// TenantRef (intentionally not exposed via the config) is a unique tenant ref to
	// be used in place of the vcServer as the primary connection key. If one label is set,
	// all virtual center configs must have a unique label.
	TenantRef string
	// vCenterIP - If this field in the config is set, it is assumed then that value in [VirtualCenter "<value>"]
	// is now the TenantRef above and this field is the actual VCenterIP. Otherwise for backward
	// compatibility, the value by default is the IP or FQDN of the vCenter Server.
	VCenterIP string
	// vCenter port.
	VCenterPort string
	// True if vCenter uses self-signed cert.
	InsecureFlag bool
	// Datacenter in which VMs are located.
	Datacenters string
	// Soap round tripper count (retries = RoundTripper - 1)
	RoundTripperCount uint
	// Specifies the path to a CA certificate in PEM format. Optional; if not
	// configured, the system's CA certificates will be used.
	CAFile string
	// Thumbprint of the VCenter's certificate thumbprint
	Thumbprint string
	// SecretRef (intentionally not exposed via the config) is a key to identify which
	// InformerManager holds the secret
	SecretRef string
	// Name of the secret where vCenter credentials are present.
	SecretName string
	// Namespace where the secret will be present containing vCenter credentials.
	SecretNamespace string
	// IP Family enables the ability to support IPv4 or IPv6
	// Supported values are:
	// ipv4 - IPv4 addresses only (Default)
	// ipv6 - IPv6 addresses only
	IPFamilyPriority []string
}

VirtualCenterConfig struct

type VirtualCenterConfigINI added in v1.2.0

type VirtualCenterConfigINI struct {
	// vCenter username.
	User string `gcfg:"user"`
	// vCenter password in clear text.
	Password string `gcfg:"password"`
	// TenantRef (intentionally not exposed via the config) is a unique tenant ref to
	// be used in place of the vcServer as the primary connection key. If one label is set,
	// all virtual center configs must have a unique label.
	TenantRef string
	// vCenterIP - If this field in the config is set, it is assumed then that value in [VirtualCenter "<value>"]
	// is now the TenantRef above and this field is the actual VCenterIP. Otherwise for backward
	// compatibility, the value by default is the IP or FQDN of the vCenter Server.
	VCenterIP string `gcfg:"server"`
	// vCenter port.
	VCenterPort string `gcfg:"port"`
	// True if vCenter uses self-signed cert.
	InsecureFlag bool `gcfg:"insecure-flag"`
	// Datacenter in which VMs are located.
	Datacenters string `gcfg:"datacenters"`
	// Soap round tripper count (retries = RoundTripper - 1)
	RoundTripperCount uint `gcfg:"soap-roundtrip-count"`
	// Specifies the path to a CA certificate in PEM format. Optional; if not
	// configured, the system's CA certificates will be used.
	CAFile string `gcfg:"ca-file"`
	// Thumbprint of the VCenter's certificate thumbprint
	Thumbprint string `gcfg:"thumbprint"`
	// SecretRef (intentionally not exposed via the config) is a key to identify which
	// InformerManager holds the secret
	SecretRef string
	// Name of the secret where vCenter credentials are present.
	SecretName string `gcfg:"secret-name"`
	// Namespace where the secret will be present containing vCenter credentials.
	SecretNamespace string `gcfg:"secret-namespace"`
	// IP Family enables the ability to support IPv4 or IPv6
	// Supported values are:
	// ipv4 - IPv4 addresses only (Default)
	// ipv6 - IPv6 addresses only
	IPFamily string `gcfg:"ip-family"`
	// IPFamilyPriority (intentionally not exposed via the config) the list/priority of IP versions
	IPFamilyPriority []string
}

VirtualCenterConfigINI contains information used to access a remote vCenter endpoint.

type VirtualCenterConfigYAML added in v1.2.0

type VirtualCenterConfigYAML struct {
	// vCenter username.
	User string `yaml:"user"`
	// vCenter password in clear text.
	Password string `yaml:"password"`
	// TenantRef (intentionally not exposed via the config) is a unique tenant ref to
	// be used in place of the vcServer as the primary connection key. If one label is set,
	// all virtual center configs must have a unique label.
	TenantRef string
	// vCenterIP - If this field in the config is set, it is assumed then that value in [VirtualCenter "<value>"]
	// is now the TenantRef above and this field is the actual VCenterIP. Otherwise for backward
	// compatibility, the value by default is the IP or FQDN of the vCenter Server.
	VCenterIP string `yaml:"server"`
	// vCenter port.
	VCenterPort uint `yaml:"port"`
	// True if vCenter uses self-signed cert.
	InsecureFlag bool `yaml:"insecureFlag"`
	// Datacenter in which VMs are located.
	Datacenters []string `yaml:"datacenters"`
	// Soap round tripper count (retries = RoundTripper - 1)
	RoundTripperCount uint `yaml:"soapRoundtripCount"`
	// Specifies the path to a CA certificate in PEM format. Optional; if not
	// configured, the system's CA certificates will be used.
	CAFile string `yaml:"caFile"`
	// Thumbprint of the VCenter's certificate thumbprint
	Thumbprint string `yaml:"thumbprint"`
	// SecretRef (intentionally not exposed via the config) is a key to identify which
	// InformerManager holds the secret
	SecretRef string
	// Name of the secret where vCenter credentials are present.
	SecretName string `yaml:"secretName"`
	// Namespace where the secret will be present containing vCenter credentials.
	SecretNamespace string `yaml:"secretNamespace"`
	// IP Family enables the ability to support IPv4 or IPv6
	// Supported values are:
	// ipv4 - IPv4 addresses only (Default)
	// ipv6 - IPv6 addresses only
	IPFamilyPriority []string `yaml:"ipFamily"`
}

VirtualCenterConfigYAML contains information used to access a remote vCenter endpoint.

Jump to

Keyboard shortcuts

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