deploymentgen

package
v0.2.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSpot

func AddSpot(deployments *[]Deployment)

AddSpot adds spot workers for all workers in deployments with AddSpot set to true.

This sets AddSpot to false for the deployments processed copied.

func GenerateAll

func GenerateAll(deployments []Deployment) []*apps.DeploymentApplyConfiguration

GenerateAll the Kubernetes deployments from a list of deployment descriptions.

You should use AddSpot before calling this.

func WriteMultipleYaml

func WriteMultipleYaml[T any](w io.Writer, items []T) error

WriteMultipleYaml writes multiple YAML items, separeted by "---", to w.

Types

type Deployment

type Deployment struct {
	// Namespace of the Kubernetes deployment
	Namespace string

	// Name of the Kubernetes deployment
	Name string

	// PodName is the name of the pods created by the deployment, and the value of the "app" label.
	PodName string `yaml:"podName"`

	// Image is the container image to use.
	Image string

	// ImagePullPolicy to create the container with
	ImagePullPolicy *corev1.PullPolicy `yaml:"ImagePullPolicy"`

	// DefaultScale is the default number of replicas.
	DefaultScale int32 `yaml:"defaultScale"`

	// RevisionHistoryLimit is the number of past deployment revisions kept around.
	RevisionHistoryLimit int32 `yaml:"revisionHistoryLimit"`

	// Resources is the resource requests and limits for the pods.
	Resources *core.ResourceRequirementsApplyConfiguration

	// Volumes to apply to the deployment.
	Volumes []core.VolumeApplyConfiguration

	// VolumeMounts for the generated containers.
	VolumeMounts []core.VolumeMountApplyConfiguration `yaml:"volumeMounts"`

	// Env config for the pods.
	Env []core.EnvVarApplyConfiguration

	// NodeSelector to apply to the pods.
	NodeSelector map[string]string

	// Spot determines if the worker should only run on spot machines.
	//
	// This is currently only supported on GKE, though support for AKS is planned.
	//
	// Currently, it adds the "cloud.google.com/gke-spot" node selector toleration to the pods.
	Spot bool

	// AddSpot, if true, causes a new spot deployment to be automatically created.
	//
	// The new deployment will have "-spot" appended to its Name and PodName, it will have its
	// DefaultScale set to 0, and Spot set to true.
	AddSpot bool `yaml:"addSpot"`
}

func (*Deployment) Generate

func (deployment *Deployment) Generate() *apps.DeploymentApplyConfiguration

Generate the Kubernetes deployment from the deployment description.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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