builder

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TitanManagedLabelName         = "titan.provider"
	TitanManifestServiceLabelName = "titan.provider/manifest-service"
)
View Source
const (
	StorageAttributePersistent = "persistent"
	StorageAttributeClass      = "class"
	StorageClassDefault        = "default"
	StorageAttributeMount      = "mount"

	ResourceGPUNvidia  = corev1.ResourceName("nvidia.com/gpu")
	ResourceGPUAMD     = corev1.ResourceName("amd.com/gpu")
	GPUVendorNvidia    = "nvidia"
	GPUVendorAMD       = "amd"
	GPUAttributeVendor = "vendor"
)
View Source
const SettingsKey = ContextKey("kube-client-settings")
View Source
const SuffixForNodePortServiceName = "-np"

Variables

View Source
var ErrSettingsValidation = xerrors.New("settings validation")

Functions

func DidNS

func DidNS(did manifest.DeploymentID) string

func NewHostName

func NewHostName(ns string, hostName string) string

func ShouldBeIngress

func ShouldBeIngress(expose *manifest.ServiceExpose) bool

func ValidateSettings

func ValidateSettings(settings Settings) error

Types

type ClusterDeployment

type ClusterDeployment struct {
	Did     manifest.DeploymentID
	Group   *manifest.Group
	Sparams ClusterSettings
}

func (*ClusterDeployment) ClusterParams

func (d *ClusterDeployment) ClusterParams() ClusterSettings

func (*ClusterDeployment) DeploymentID

func (d *ClusterDeployment) DeploymentID() manifest.DeploymentID

func (*ClusterDeployment) ManifestGroup

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

type ClusterSettings

type ClusterSettings struct {
	SchedulerParams []*SchedulerParams `json:"scheduler_params"`
}

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 HostnameDirective

type HostnameDirective struct {
	IngressName string
	Hostname    string
	ServiceName string
	ServicePort int32
	ReadTimeout uint32
	SendTimeout uint32
	NextTimeout uint32
	MaxBodySize uint32
	NextTries   uint32
	NextCases   []string
}

func BuildHostNameDirective

func BuildHostNameDirective(ns, hostName, serviceName, ingressName string, serviceExpose *manifest.ServiceExpose) *HostnameDirective

type IClusterDeployment

type IClusterDeployment interface {
	DeploymentID() manifest.DeploymentID
	ManifestGroup() *manifest.Group
	ClusterParams() ClusterSettings
}

type Ingress

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

func BuildIngress

func BuildIngress(workload Workload, directive *HostnameDirective, tls []netv1.IngressTLS) Ingress

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 SchedulerParams

type SchedulerParams struct {
	RuntimeClass string              `json:"runtime_class"`
	Resources    *SchedulerResources `json:"resources,omitempty"`
}

type SchedulerResourceGPU

type SchedulerResourceGPU struct {
	Vendor string `json:"vendor"`
	Model  string `json:"model"`
}

type SchedulerResources

type SchedulerResources struct {
	GPU *SchedulerResourceGPU `json:"gpu"`
}

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 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 NewWorkload

func NewWorkload(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