provider

package module
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 18 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCloudProvider

func AddCloudProvider(name string, cloud CloudProvider)

func DefaultToEnv

func DefaultToEnv(field *string, env, fallback string)

func GetBestFitInstanceType

func GetBestFitInstanceType(sortedInstanceTypeSpecList []InstanceTypeSpec, vcpus int64, memory int64) (string, error)

Method to find the best fit instance type for the given memory and vcpus The sortedInstanceTypeSpecList slice is a sorted list of instance types based on ascending order of supported memory

func GetBestFitInstanceTypeWithGPU added in v0.11.0

func GetBestFitInstanceTypeWithGPU(sortedInstanceTypeSpecList []InstanceTypeSpec, gpus, vcpus, memory int64) (string, error)

Implement the GetBestFitInstanceTypeWithGPU function TBD: Incorporate GPU model based selection as well

func List

func List() []string

func LoadCloudProvider added in v0.9.0

func LoadCloudProvider(name string)

LoadCloudProvider loads cloud provider external plugin from the given path CLOUD_PROVIDER_EXTERNAL_PLUGIN_PATH The values of 1) ${CLOUD_PROVIDER}, 2) the filename of the cloud provider external plugin and 3) the provider defined within the external plugin must all match

func SelectInstanceTypeToUse

func SelectInstanceTypeToUse(spec InstanceTypeSpec, specList []InstanceTypeSpec, validInstanceTypes []string, defaultInstanceType string) (string, error)

func VerifyCloudInstanceType

func VerifyCloudInstanceType(instanceType string, validInstanceTypes []string, defaultInstanceType string) (string, error)

Method to verify the correct instanceType to be used for Pod VM

func VerifySSHKeyFile added in v0.11.0

func VerifySSHKeyFile(sshKeyFile string) error

Verify SSH public key file Check the permissions and the content of the file to ensure it is a valid SSH public key

func WriteUserData added in v0.9.0

func WriteUserData(instanceName string, userData string, dataDir string) (string, error)

Types

type CloudProvider

type CloudProvider interface {
	ParseCmd(flags *flag.FlagSet)
	LoadEnv()
	NewProvider() (Provider, error)
}

func Get

func Get(name string) CloudProvider

type FlagOption added in v0.18.0

type FlagOption func(*flagOptions)

FlagOption is a functional option for configuring flag metadata.

func Required added in v0.18.0

func Required() FlagOption

Required marks a flag as required.

func Secret added in v0.18.0

func Secret() FlagOption

Secret marks a flag as containing sensitive data.

type FlagRegistrar added in v0.18.0

type FlagRegistrar struct {
	// contains filtered or unexported fields
}

FlagRegistrar wraps a FlagSet to provide registration methods with environment variable support.

func NewFlagRegistrar added in v0.18.0

func NewFlagRegistrar(flags *flag.FlagSet) *FlagRegistrar

NewFlagRegistrar creates a new FlagRegistrar for the given FlagSet.

func (*FlagRegistrar) BoolWithEnv added in v0.18.0

func (r *FlagRegistrar) BoolWithEnv(field *bool, flagName string, hardcodedDefault bool, envVarName, usage string, opts ...FlagOption)

BoolWithEnv registers a bool flag with environment variable support. Accepts: "1" or "true" (case-insensitive) for true, anything else for false. Optional FlagOption parameters (Required(), Secret()) are metadata-only (used by config-extractor).

func (*FlagRegistrar) CustomTypeWithEnv added in v0.18.0

func (r *FlagRegistrar) CustomTypeWithEnv(field flag.Value, flagName, hardcodedDefault, envVarName, usage string, opts ...FlagOption)

CustomTypeWithEnv registers a custom flag type (like comma-separated lists or key-value maps) with environment variable support. The field must implement flag.Value interface. Optional FlagOption parameters (Required(), Secret()) are metadata-only (used by config-extractor).

func (*FlagRegistrar) DurationWithEnv added in v0.18.0

func (r *FlagRegistrar) DurationWithEnv(field *time.Duration, flagName string, hardcodedDefault time.Duration, envVarName, usage string, opts ...FlagOption)

DurationWithEnv registers a duration flag with environment variable support. Optional FlagOption parameters (Required(), Secret()) are metadata-only (used by config-extractor).

func (*FlagRegistrar) Float64WithEnv added in v0.18.0

func (r *FlagRegistrar) Float64WithEnv(field *float64, flagName string, hardcodedDefault float64, envVarName, usage string, opts ...FlagOption)

Float64WithEnv registers a float64 flag with environment variable support. Optional FlagOption parameters (Required(), Secret()) are metadata-only (used by config-extractor).

func (*FlagRegistrar) IntWithEnv added in v0.18.0

func (r *FlagRegistrar) IntWithEnv(field *int, flagName string, hardcodedDefault int, envVarName, usage string, opts ...FlagOption)

IntWithEnv registers an int flag with environment variable support. Optional FlagOption parameters (Required(), Secret()) are metadata-only (used by config-extractor).

func (*FlagRegistrar) StringWithEnv added in v0.18.0

func (r *FlagRegistrar) StringWithEnv(field *string, flagName, hardcodedDefault, envVarName, usage string, opts ...FlagOption)

StringWithEnv registers a string flag with environment variable support. Optional FlagOption parameters (Required(), Secret()) are metadata-only (used by config-extractor). Usage: reg.StringWithEnv(&field, "flag", "", "ENV", "desc", Required(), Secret())

func (*FlagRegistrar) UintWithEnv added in v0.18.0

func (r *FlagRegistrar) UintWithEnv(field *uint, flagName string, hardcodedDefault uint, envVarName, usage string, opts ...FlagOption)

UintWithEnv registers a uint flag with environment variable support. Optional FlagOption parameters (Required(), Secret()) are metadata-only (used by config-extractor).

type Instance

type Instance struct {
	ID   string
	Name string
	IPs  []netip.Addr
}

type InstanceTypeSpec

type InstanceTypeSpec struct {
	InstanceType string
	VCPUs        int64
	Memory       int64
	Arch         string
	GPUs         int64
	Image        string
	MultiNic     bool
}

func FilterOutGPUInstances added in v0.11.0

func FilterOutGPUInstances(instanceTypeSpecList []InstanceTypeSpec) []InstanceTypeSpec

Filter out GPU instances from the instance type spec list

func SortInstanceTypesOnResources added in v0.11.0

func SortInstanceTypesOnResources(instanceTypeSpecList []InstanceTypeSpec) []InstanceTypeSpec

Method to sort InstanceTypeSpec into ascending order based on gpu, then memory, followed by cpu

type KeyValueFlag

type KeyValueFlag map[string]string

keyValueFlag represents a flag of key-value pairs

func (*KeyValueFlag) Set

func (k *KeyValueFlag) Set(value string) error

Set parses the input string and sets the keyValueFlag value

func (*KeyValueFlag) String

func (k *KeyValueFlag) String() string

String returns the string representation of the keyValueFlag

type Provider

type Provider interface {
	CreateInstance(ctx context.Context, podName, sandboxID string, cloudConfig cloudinit.CloudConfigGenerator, spec InstanceTypeSpec) (instance *Instance, err error)
	DeleteInstance(ctx context.Context, instanceID string) error
	Teardown() error
	ConfigVerifier() error
}

Directories

Path Synopsis
(C) Copyright Confidential Containers Contributors SPDX-License-Identifier: Apache-2.0
(C) Copyright Confidential Containers Contributors SPDX-License-Identifier: Apache-2.0
cmd

Jump to

Keyboard shortcuts

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