vsphere_cloud_config

package
v0.0.0-...-70aa31a Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalConfig

func MarshalConfig(config *CPIConfig) (string, error)

MarshalConfig serializes CPIConfig instance into a YAML document

Types

type CPIConfig

type CPIConfig struct {
	CommonConfig `yaml:"-,inline"`
	Nodes        Nodes `yaml:"nodes,omitempty"`
}

CPIConfig is the YAML representation of vsphere-cloud-provider config

func ReadConfig

func ReadConfig(config []byte) (*CPIConfig, error)

ReadConfig parses vSphere cloud-config file and returns CPIConfig structure Accepts both YAML and INI formats as input. YAML format takes precedence, in case parsing YAML is not successful function falls back to the legacy INI format. Unlike 'cloud-provider-vsphere' version of a similar function, this does ignore environment variables.

type CommonConfig

type CommonConfig struct {
	// Global values...
	Global Global

	// Virtual Center configurations
	Vcenter map[string]*VirtualCenterConfig `yaml:"vcenter,omitempty"`

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

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

type Global

type Global struct {
	// vCenter username.
	User string `yaml:"user,omitempty"`
	// vCenter password in clear text.
	Password string `yaml:"password,omitempty"`
	// Deprecated. Use VirtualCenter to specify multiple vCenter Servers.
	// vCenter IP.
	VCenterIP string `yaml:"server,omitempty"`
	// vCenter port.
	VCenterPort uint `yaml:"port,omitempty"`
	// True if vCenter uses self-signed cert.
	InsecureFlag bool `yaml:"insecureFlag,omitempty"`
	// Datacenter in which VMs are located.
	Datacenters []string `yaml:"datacenters,omitempty"`
	// Soap round tripper count (retries = RoundTripper - 1)
	RoundTripperCount uint `yaml:"soapRoundtripCount,omitempty"`
	// 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,omitempty"`
	// Thumbprint of the VCenter's certificate thumbprint
	Thumbprint string `yaml:"thumbprint,omitempty"`
	// Name of the secret were vCenter credentials are present.
	SecretName string `yaml:"secretName,omitempty"`
	// Secret Namespace where secret will be present that has vCenter credentials.
	SecretNamespace string `yaml:"secretNamespace,omitempty"`
	// 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,omitempty"`
	// Disable the vSphere CCM API
	// Default: true
	APIDisable bool `yaml:"apiDisable,omitempty"`
	// Configurable vSphere CCM API port
	// Default: 43001
	APIBinding string `yaml:"apiBinding,omitempty"`
	// 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,omitempty"`
}

Global are global values

type Labels

type Labels struct {
	Zone   string `yaml:"zone,omitempty"`
	Region string `yaml:"region,omitempty"`
}

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

type Nodes

type Nodes struct {
	// IP address on VirtualMachine's network interfaces included in the fields' CIDRs
	// that will be used in respective status.addresses fields.
	InternalNetworkSubnetCIDR string `yaml:"internalNetworkSubnetCidr,omitempty"`
	ExternalNetworkSubnetCIDR string `yaml:"externalNetworkSubnetCidr,omitempty"`
	// IP address on VirtualMachine's VM Network names that will be used to when searching
	// for status.addresses fields. Note that if InternalNetworkSubnetCIDR and
	// ExternalNetworkSubnetCIDR are not set, then the vNIC associated to this network must
	// only have a single IP address assigned to it.
	InternalVMNetworkName string `yaml:"internalVmNetworkName,omitempty"`
	ExternalVMNetworkName string `yaml:"externalVmNetworkName,omitempty"`
	// IP addresses in these subnet ranges will be excluded when selecting
	// the IP address from the VirtualMachine's VM for use in the
	// status.addresses fields.
	ExcludeInternalNetworkSubnetCIDR string `yaml:"excludeInternalNetworkSubnetCidr,omitempty"`
	ExcludeExternalNetworkSubnetCIDR string `yaml:"excludeExternalNetworkSubnetCidr,omitempty"`
}

Nodes captures internal/external networks

type VirtualCenterConfig

type VirtualCenterConfig struct {
	// vCenter username.
	User string `yaml:"user,omitempty"`
	// vCenter password in clear text.
	Password string `yaml:"password,omitempty"`
	// 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,omitempty"`
	// vCenter port.
	VCenterPort uint `yaml:"port,omitempty"`
	// True if vCenter uses self-signed cert.
	InsecureFlag bool `yaml:"insecureFlag,omitempty"`
	// Datacenter in which VMs are located.
	Datacenters []string `yaml:"datacenters,omitempty"`
	// Soap round tripper count (retries = RoundTripper - 1)
	RoundTripperCount uint `yaml:"soapRoundtripCount,omitempty"`
	// 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,omitempty"`
	// Thumbprint of the VCenter's certificate thumbprint
	Thumbprint string `yaml:"thumbprint,omitempty"`
	// Name of the secret where vCenter credentials are present.
	SecretName string `yaml:"secretName,omitempty"`
	// Namespace where the secret will be present containing vCenter credentials.
	SecretNamespace string `yaml:"secretNamespace,omitempty"`
	// 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,omitempty"`
}

VirtualCenterConfig 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