Documentation ¶
Index ¶
- Constants
- Variables
- func GetClientCacheTTL(clientConfig *corev1.ConfigMap) time.Duration
- func NetworkExists(net infrav1.Network) bool
- func UnmarshalAllSecretConfigs(in []byte, out *[]SecretConfig) error
- type Account
- type AffinityGroup
- type AffinityGroupIface
- type Client
- func NewClientFromBytesConfig(conf []byte, clientConfig *corev1.ConfigMap, project string) (Client, error)
- func NewClientFromCSAPIClient(cs *cloudstack.CloudStackClient, user *User) Client
- func NewClientFromConf(conf Config, clientConfig *corev1.ConfigMap, project string) (Client, error)
- func NewClientFromK8sSecret(endpointSecret *corev1.Secret, clientConfig *corev1.ConfigMap, project string) (Client, error)
- func NewClientFromYamlPath(confPath string, secretName string) (Client, error)
- type ClusterIface
- type ClustertypeSetter
- type Config
- type Domain
- type IsoNetworkIface
- type NetworkIface
- type Project
- type ResourceType
- type SecretConfig
- type TagIface
- type User
- type UserCredIFace
- type VMIface
- type ZoneIFace
Constants ¶
const ( AntiAffinityGroupType = "host anti-affinity" AffinityGroupType = "host affinity" )
const ( NetOffering = "DefaultIsolatedNetworkOfferingWithSourceNatService" K8sDefaultAPIPort = 6443 NetworkTypeIsolated = "Isolated" NetworkProtocolTCP = "tcp" NetworkProtocolUDP = "udp" NetworkProtocolICMP = "icmp" )
const ( ClusterTagNamePrefix = "CAPC_cluster_" CreatedByCAPCTagName = "created_by_CAPC" ResourceTypeNetwork ResourceType = "Network" ResourceTypeIPAddress ResourceType = "PublicIpAddress" )
const ClientCacheTTLKey = "client-cache-ttl"
const ClientConfigMapName = "capc-client-config"
const ClientConfigMapNamespace = "capc-system"
const DefaultClientCacheTTL = time.Duration(1 * time.Hour)
Variables ¶
var NewAsyncClient = cloudstack.NewAsyncClient
var NewClient = cloudstack.NewClient
Functions ¶
func GetClientCacheTTL ¶
GetClientCacheTTL returns a client cache TTL duration from the passed config map
func NetworkExists ¶
NetworkExists checks that the network already exists based on the presence of all fields. Assumes that the a fetch has been done on network statuses prior.
func UnmarshalAllSecretConfigs ¶
func UnmarshalAllSecretConfigs(in []byte, out *[]SecretConfig) error
UnmarshalAllSecretConfigs parses a yaml document for each secret.
Types ¶
type Account ¶
type Account struct { Name string Domain Domain ID string CPUAvailable string MemoryAvailable string VMAvailable string }
Account contains specifications that identify an account.
type AffinityGroup ¶
type AffinityGroupIface ¶
type AffinityGroupIface interface { FetchAffinityGroup(*AffinityGroup) error GetOrCreateAffinityGroup(*AffinityGroup) error DeleteAffinityGroup(*AffinityGroup) error AssociateAffinityGroup(*infrav1.CloudStackMachine, AffinityGroup) error DisassociateAffinityGroup(*infrav1.CloudStackMachine, AffinityGroup) error }
type Client ¶
type Client interface { ClusterIface VMIface NetworkIface AffinityGroupIface TagIface ZoneIFace IsoNetworkIface UserCredIFace NewClientInDomainAndAccount(string, string, string) (Client, error) }
func NewClientFromBytesConfig ¶
func NewClientFromBytesConfig(conf []byte, clientConfig *corev1.ConfigMap, project string) (Client, error)
NewClientFromBytesConfig returns a client from a bytes array that unmarshals to a yaml config.
func NewClientFromCSAPIClient ¶
func NewClientFromCSAPIClient(cs *cloudstack.CloudStackClient, user *User) Client
NewClientFromCSAPIClient creates a client from a CloudStack-Go API client. Used only for testing.
func NewClientFromConf ¶
NewClientFromConf creates a new Cloud Client form a map of strings to strings.
type ClusterIface ¶ added in v0.5.0
type ClusterIface interface { GetOrCreateCksCluster(*clusterv1.Cluster, *infrav1.CloudStackCluster, *infrav1.CloudStackFailureDomainSpec) error DeleteCksCluster(*infrav1.CloudStackCluster) error AddVMToCksCluster(*infrav1.CloudStackCluster, *infrav1.CloudStackMachine) error RemoveVMFromCksCluster(*infrav1.CloudStackCluster, *infrav1.CloudStackMachine) error }
type ClustertypeSetter ¶ added in v0.5.0
type ClustertypeSetter interface {
SetClustertype(string)
}
type Config ¶
type Config struct { APIUrl string `yaml:"api-url"` APIKey string `yaml:"api-key"` SecretKey string `yaml:"secret-key"` VerifySSL string `yaml:"verify-ssl"` }
cloud-config ini structure.
type Domain ¶
type Domain struct { Name string Path string ID string CPUAvailable string MemoryAvailable string VMAvailable string }
Domain contains specifications that identify a domain.
type IsoNetworkIface ¶
type IsoNetworkIface interface { GetOrCreateIsolatedNetwork(*infrav1.CloudStackFailureDomain, *infrav1.CloudStackIsolatedNetwork, *infrav1.CloudStackCluster) error AssociatePublicIPAddress(*infrav1.CloudStackFailureDomain, *infrav1.CloudStackIsolatedNetwork, *infrav1.CloudStackCluster) error GetOrCreateLoadBalancerRule(*infrav1.CloudStackFailureDomain, *infrav1.CloudStackIsolatedNetwork, *infrav1.CloudStackCluster) error OpenFirewallRules(*infrav1.CloudStackIsolatedNetwork) error GetPublicIP(*infrav1.CloudStackFailureDomain, *infrav1.CloudStackIsolatedNetwork, *infrav1.CloudStackCluster) (*cloudstack.PublicIpAddress, error) ResolveLoadBalancerRuleDetails(*infrav1.CloudStackFailureDomain, *infrav1.CloudStackIsolatedNetwork, *infrav1.CloudStackCluster) error AssignVMToLoadBalancerRule(isoNet *infrav1.CloudStackIsolatedNetwork, instanceID string) error DeleteNetwork(infrav1.Network) error DisposeIsoNetResources(*infrav1.CloudStackFailureDomain, *infrav1.CloudStackIsolatedNetwork, *infrav1.CloudStackCluster) error }
type NetworkIface ¶
type Project ¶ added in v0.5.0
type Project struct { Name string ID string CPUAvailable string MemoryAvailable string VMAvailable string }
Project contains specifications that identify a project.
type ResourceType ¶
type ResourceType string
type SecretConfig ¶
type TagIface ¶
type TagIface interface { AddClusterTag(ResourceType, string, *infrav1.CloudStackCluster) error DeleteClusterTag(ResourceType, string, *infrav1.CloudStackCluster) error AddCreatedByCAPCTag(ResourceType, string) error DeleteCreatedByCAPCTag(ResourceType, string) error DoClusterTagsAllowDisposal(ResourceType, string) (bool, error) AddTags(ResourceType, string, map[string]string) error GetTags(ResourceType, string) (map[string]string, error) DeleteTags(ResourceType, string, map[string]string) error }
type UserCredIFace ¶
type VMIface ¶
type VMIface interface { GetOrCreateVMInstance(*infrav1.CloudStackMachine, *clusterv1.Machine, *infrav1.CloudStackCluster, *infrav1.CloudStackFailureDomain, *infrav1.CloudStackAffinityGroup, string) error ResolveVMInstanceDetails(*infrav1.CloudStackMachine) error DestroyVMInstance(*infrav1.CloudStackMachine) error }
type ZoneIFace ¶
type ZoneIFace interface { ResolveZone(*infrav1.CloudStackZoneSpec) error ResolveNetworkForZone(*infrav1.CloudStackZoneSpec) error }