providers

package
v0.1.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MetdataDomain = "provider.unikorn-cloud.org"
)

Variables

This section is empty.

Functions

func GetAnnotations

func GetAnnotations(resource metav1.Object) map[string]string

Types

type CloudConfig added in v0.1.2

type CloudConfig struct {
	// Type defines the provider type.
	Type ProviderType
	// OpenStack is populated when the type is "openstack"
	OpenStack *OpenStackCloudConfig
}

CloudConfig is a top level provider "agnostic" type to be passed to the HTTP handler.

type ClusterInfo added in v0.1.2

type ClusterInfo struct {
	// OrganizationID defines which organization this belings to.
	OrganizationID string
	// ProjectID defines which project this belongs to.
	ProjectID string
	// ClusterID defines which cluster this belongs to.
	ClusterID string
}

ClusterInfo is required metadata when using the identity APIs to allow tracking of ownership information.

type ExternalNetwork added in v0.1.3

type ExternalNetwork struct {
	// ID is the provider specific netwokr ID.
	ID string
	// Name is the netwokr name.
	Name string
}

ExternalNetwork represents an external network.

type ExternalNetworks added in v0.1.3

type ExternalNetworks []ExternalNetwork

ExternalNetworks is a list of provider networks.

type Flavor

type Flavor struct {
	// ID must be an immutable ID, preferably a UUID.
	// If the provider doesn't have the concept of an ID, and the name
	// is immutable you can make one out of that.
	ID string
	// Name of the flavor.
	Name string
	// CPU count.
	CPUs int
	// Memory available.
	Memory *resource.Quantity
	// Disk available.
	Disk *resource.Quantity
	// GPU count.
	GPUs int
	// GPUVendor is who makes the GPU, used to determine the drivers etc.
	GPUVendor GPUVendor
	// BareMetal is a bare-metal flavor.
	BareMetal bool
}

Flavor represents a machine type.

type FlavorList

type FlavorList []Flavor

FlavorList allows us to attach sort functions and the like.

type GPUVendor

type GPUVendor string

GPUVendor defines the GPU vendor.

const (
	Nvidia GPUVendor = "nvidia"
	AMD    GPUVendor = "amd"
)

type Image

type Image struct {
	// ID must be an immutable ID, preferably a UUID.
	// If the provider doesn't have the concept of an ID, and the name
	// is immutable you can make one out of that.
	ID string
	// Name of the image.
	Name string
	// Created is when the image was created.
	Created time.Time
	// Modified is when the image was modified.
	Modified time.Time
	// KubernetesVersion is only populated if the image contains a pre-installed
	// version of Kubernetes, this acts as a cache and improves provisioning performance.
	// This is pretty much the only source of truth about Kubernetes versions at
	// present, so should be populated.  It must be a semver (starts with a vN.N.N).
	KubernetesVersion string
}

Image represents an operating system image.

type ImageList

type ImageList []Image

ImageList allows us to attach sort functions and the like.

type OpenStackCloudConfig added in v0.1.2

type OpenStackCloudConfig struct {
	// Credentials contain login data, bound to a user and project.
	Credentials *OpenStackCloudCredentials
	// State holds other pertinent metadata.
	State *OpenStackCloudState
}

OpenStackCloudConfig bundles together various OpenStack specific state.

type OpenStackCloudCredentials added in v0.1.2

type OpenStackCloudCredentials struct {
	Cloud       string
	CloudConfig []byte
}

OpenStackCloudCredentials define OpenStack specific identity information which is usually in the form of a cloud config for most uses.

type OpenStackCloudState added in v0.1.2

type OpenStackCloudState struct {
	// UserID is the unique user ID.
	UserID string
	// ProjectID is the unique project ID.
	ProjectID string
}

OpenStackCloudState is used to propagate pertinent inforamtion up to the client which is especially relevant for piecing together API logs and provider logs.

type Provider

type Provider interface {
	// Flavors list all available flavors.
	Flavors(ctx context.Context) (FlavorList, error)
	// Images lists all available images.
	Images(ctx context.Context) (ImageList, error)
	// CreateIdentity creates a new identity for cloud infrastructure.
	CreateIdentity(ctx context.Context, info *ClusterInfo) (*unikornv1.Identity, *CloudConfig, error)
	// DeleteIdentity cleans up an identity for cloud infrastructure.
	DeleteIdentity(ctx context.Context, identityID string) error
	// ListExternalNetworks returns a list of external networks if the platform
	// supports such a concept.
	ListExternalNetworks(ctx context.Context) (ExternalNetworks, error)
}

Providers are expected to provide a provider agnostic manner. They are also expected to provide any caching or memoization required to provide high performance and a decent UX.

type ProviderType added in v0.1.2

type ProviderType string

ProviderType defines the provider to the client, while this is implicit, as you had to select a region in the first instance, it's handy to refer to to perform provider specific configuration.

const (
	ProviderTypeOpenStack ProviderType = "openstack"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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