builder

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AkashManagedLabelName         = "akash.network"
	AkashManifestServiceLabelName = "akash.network/manifest-service"
	AkashNetworkStorageClasses    = "akash.network/storageclasses"
	AkashServiceTarget            = "akash.network/service-target"
	AkashServiceCapabilityGPU     = "akash.network/capabilities.gpu"
	AkashServiceCapabilityStorage = "akash.network/capabilities.storage"
	AkashMetalLB                  = "metal-lb"

	AkashLeaseOwnerLabelName    = "akash.network/lease.id.owner"
	AkashLeaseDSeqLabelName     = "akash.network/lease.id.dseq"
	AkashLeaseGSeqLabelName     = "akash.network/lease.id.gseq"
	AkashLeaseOSeqLabelName     = "akash.network/lease.id.oseq"
	AkashLeaseProviderLabelName = "akash.network/lease.id.provider"
	AkashLeaseManifestVersion   = "akash.network/manifest.version"
	AkashLeaseUpdatedAt         = "akash.network/lease.updated_at"
)
View Source
const (
	ValTrue  = "true"
	ValFalse = "false"
)
View Source
const (
	ResourceGPUNvidia = corev1.ResourceName("nvidia.com/gpu")
	ResourceGPUAMD    = corev1.ResourceName("amd.com/gpu")
	GPUVendorNvidia   = "nvidia"
	GPUVendorAMD      = "amd"
)
View Source
const SettingsKey = ContextKey("kube-client-settings")
View Source
const SuffixForNodePortServiceName = "-np"

Variables

View Source
var (
	ErrKubeBuilder = errors.New("kube-builder")
)
View Source
var ErrSettingsValidation = errors.New("settings validation")

Functions

func AppendLeaseLabels

func AppendLeaseLabels(lid mtypes.LeaseID, labels map[string]string) map[string]string

func LidNS

func LidNS(lid mtypes.LeaseID) string

LidNS generates a unique sha256 sum for identifying a provider's object name.

func ValidateSettings

func ValidateSettings(settings Settings) error

Types

type ClusterDeployment

type ClusterDeployment struct {
	Lid     mtypes.LeaseID
	Group   *mani.Group
	Sparams crd.ClusterSettings
	// contains filtered or unexported fields
}

func (*ClusterDeployment) ClusterParams

func (d *ClusterDeployment) ClusterParams() crd.ClusterSettings

func (*ClusterDeployment) LeaseID

func (d *ClusterDeployment) LeaseID() mtypes.LeaseID

func (*ClusterDeployment) ManifestGroup

func (d *ClusterDeployment) ManifestGroup() *mani.Group

func (*ClusterDeployment) UpdateManifest

func (d *ClusterDeployment) UpdateManifest() bool

type ContextKey

type ContextKey string

type Deployment

type Deployment interface {
	Create() (*appsv1.Deployment, error)
	Update(obj *appsv1.Deployment) (*appsv1.Deployment, error)
	// contains filtered or unexported methods
}

func NewDeployment

func NewDeployment(workload Workload) Deployment

type IClusterDeployment

type IClusterDeployment interface {
	LeaseID() mtypes.LeaseID
	ManifestGroup() *mani.Group
	UpdateManifest() bool
	ClusterParams() crd.ClusterSettings
}

func ClusterDeploymentFromDeployment

func ClusterDeploymentFromDeployment(d ctypes.IDeployment) (IClusterDeployment, error)

type Manifest

type Manifest interface {
	Create() (*crd.Manifest, error)
	Update(obj *crd.Manifest) (*crd.Manifest, error)
	Name() string
	// contains filtered or unexported methods
}

func BuildManifest

func BuildManifest(log log.Logger, settings Settings, ns string, deployment IClusterDeployment) Manifest

type NS

type NS interface {
	Create() (*corev1.Namespace, error)
	Update(obj *corev1.Namespace) (*corev1.Namespace, error)
	// contains filtered or unexported methods
}

func BuildNS

func BuildNS(settings Settings, deployment IClusterDeployment) NS

type NetPol

type NetPol interface {
	Create() ([]*netv1.NetworkPolicy, error)
	Update(obj *netv1.NetworkPolicy) (*netv1.NetworkPolicy, error)
	// contains filtered or unexported methods
}

func BuildNetPol

func BuildNetPol(settings Settings, deployment IClusterDeployment) NetPol

type Service

type Service interface {
	Create() (*corev1.Service, error)
	Update(obj *corev1.Service) (*corev1.Service, error)
	Any() bool
	// contains filtered or unexported methods
}

func BuildService

func BuildService(workload Workload, requireNodePort bool) Service

type ServiceCredentials

type ServiceCredentials interface {
	NS() string
	Name() string
	Create() (*corev1.Secret, error)
	Update(obj *corev1.Secret) (*corev1.Secret, error)
}

func NewServiceCredentials

func NewServiceCredentials(ns string, serviceName string, credentials *mani.ServiceImageCredentials) ServiceCredentials

type Settings

type Settings struct {
	// gcp:    NodePort
	// others: ClusterIP
	DeploymentServiceType corev1.ServiceType

	// gcp:    false
	// others: true
	DeploymentIngressStaticHosts bool
	// Ingress domain to map deployments to
	DeploymentIngressDomain string

	// Return load balancer host in lease status command ?
	// gcp:    true
	// others: optional
	DeploymentIngressExposeLBHosts bool

	// Global hostname for arbitrary ports
	ClusterPublicHostname string

	// NetworkPoliciesEnabled determines if NetworkPolicies should be installed.
	NetworkPoliciesEnabled bool

	CPUCommitLevel     float64
	GPUCommitLevel     float64
	MemoryCommitLevel  float64
	StorageCommitLevel float64

	DeploymentRuntimeClass string

	// Name of the image pull secret to use in pod spec
	DockerImagePullSecretsName string
}

Settings configures k8s object generation such that it is customized to the cluster environment that is being used. For instance, GCP requires a different service type than minikube.

func NewDefaultSettings

func NewDefaultSettings() Settings

type StatefulSet

type StatefulSet interface {
	Create() (*appsv1.StatefulSet, error)
	Update(obj *appsv1.StatefulSet) (*appsv1.StatefulSet, error)
	// contains filtered or unexported methods
}

func BuildStatefulSet

func BuildStatefulSet(workload Workload) StatefulSet

type Workload

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

func NewWorkloadBuilder

func NewWorkloadBuilder(
	log log.Logger,
	settings Settings,
	deployment IClusterDeployment,
	serviceIdx int) Workload

func (*Workload) NS

func (b *Workload) NS() string

func (*Workload) Name

func (b *Workload) Name() string

func (*Workload) Validate

func (b *Workload) Validate() error

Jump to

Keyboard shortcuts

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