Documentation
¶
Index ¶
Constants ¶
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" // DefaultVCenterPort is the default port used to access vCenter. DefaultVCenterPort string = "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 ¶
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 Config ¶
type Config struct { Global 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"` } // Virtual Center configurations VirtualCenter map[string]*VirtualCenterConfig // Tag categories and tags which correspond to "built-in node labels: zones and region" Labels struct { Zone string `gcfg:"zone"` Region string `gcfg:"region"` } }
Config is used to read and store information from the cloud configuration file
func ReadConfig ¶
ReadConfig parses vSphere cloud config file and stores it into VSphereConfig. Environment variables are also checked
func (*Config) FromEnv ¶ added in v1.1.0
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.
func (*Config) IsSecretInfoProvided ¶ added in v1.1.0
IsSecretInfoProvided returns true if k8s secret is set or using generic CO secret method. If both k8s secret and generic CO both are true, we don't know which to use, so return false.
type VirtualCenterConfig ¶
type VirtualCenterConfig 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 }
VirtualCenterConfig contains information used to access a remote vCenter endpoint.
func (*VirtualCenterConfig) IsSecretInfoProvided ¶ added in v1.1.0
func (vcc *VirtualCenterConfig) IsSecretInfoProvided() bool
IsSecretInfoProvided returns true if the secret per VC has been configured