cloud

package
v0.4.8-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AntiAffinityGroupType = "host anti-affinity"
	AffinityGroupType     = "host affinity"
)
View Source
const (
	NetOffering         = "DefaultIsolatedNetworkOfferingWithSourceNatService"
	K8sDefaultAPIPort   = 6443
	NetworkTypeIsolated = "Isolated"
	NetworkTypeShared   = "Shared"
	NetworkProtocolTCP  = "tcp"
)
View Source
const (
	ClusterTagNamePrefix               = "CAPC_cluster_"
	CreatedByCAPCTagName               = "created_by_CAPC"
	ResourceTypeNetwork   ResourceType = "Network"
	ResourceTypeIPAddress ResourceType = "PublicIpAddress"
)
View Source
const ClientCacheTTLKey = "client-cache-ttl"
View Source
const ClientConfigMapName = "capc-client-config"
View Source
const ClientConfigMapNamespace = "capc-system"
View Source
const DefaultClientCacheTTL = time.Duration(1 * time.Hour)

Variables

This section is empty.

Functions

func CompressAndEncodeString

func CompressAndEncodeString(str string) (string, error)

func GetClientCacheTTL

func GetClientCacheTTL(clientConfig *corev1.ConfigMap) time.Duration

GetClientCacheTTL returns a client cache TTL duration from the passed config map

func NetworkExists

func NetworkExists(net infrav1.Network) bool

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
}

Account contains specifications that identify an account.

type AffinityGroup

type AffinityGroup struct {
	Type string
	Name string
	ID   string
}

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 {
	VMIface
	NetworkIface
	AffinityGroupIface
	TagIface
	ZoneIFace
	IsoNetworkIface
	UserCredIFace
	NewClientInDomainAndAccount(string, string) (Client, error)
}

func NewClientFromBytesConfig

func NewClientFromBytesConfig(conf []byte, clientConfig *corev1.ConfigMap) (Client, error)

NewClientFromBytesConfig returns a client from a bytes array that unmarshals to a yaml config.

func NewClientFromCSAPIClient

func NewClientFromCSAPIClient(cs *cloudstack.CloudStackClient) Client

NewClientFromCSAPIClient creates a client from a CloudStack-Go API client. Mostly used for testing.

func NewClientFromConf

func NewClientFromConf(conf Config, clientConfig *corev1.ConfigMap) (Client, error)

NewClientFromConf creates a new Cloud Client form a map of strings to strings.

func NewClientFromK8sSecret

func NewClientFromK8sSecret(endpointSecret *corev1.Secret, clientConfig *corev1.ConfigMap) (Client, error)

NewClientFromK8sSecret returns a client from a k8s secret

func NewClientFromYamlPath

func NewClientFromYamlPath(confPath string, secretName string) (Client, error)

NewClientFromYamlPath returns a client from a yaml config at path.

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
}

Domain contains specifications that identify a domain.

type NetworkIface

type NetworkIface interface {
	ResolveNetwork(*infrav1.Network) error
	RemoveClusterTagFromNetwork(*infrav1.CloudStackCluster, infrav1.Network) error
}

type ResourceType

type ResourceType string

type SecretConfig

type SecretConfig struct {
	APIVersion string            `yaml:"apiVersion"`
	Kind       string            `yaml:"kind"`
	Type       string            `yaml:"type"`
	Metadata   map[string]string `yaml:"metadata"`
	StringData Config            `yaml:"stringData"`
}

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 User

type User struct {
	ID        string
	Name      string
	APIKey    string
	SecretKey string
	Account
}

User contains information uniquely identifying and scoping a user.

type UserCredIFace

type UserCredIFace interface {
	ResolveDomain(*Domain) error
	ResolveAccount(*Account) error
	ResolveUser(*User) error
	ResolveUserKeys(*User) error
	GetUserWithKeys(*User) (bool, error)
}

type ZoneIFace

type ZoneIFace interface {
	ResolveZone(*infrav1.CloudStackZoneSpec) error
	ResolveNetworkForZone(*infrav1.CloudStackZoneSpec) error
}

Jump to

Keyboard shortcuts

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