kubernetes

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 30 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SettingInCluster              = "IN_CLUSTER"
	SettingCleanupJobs            = "CLEANUP_JOBS"
	SettingLabels                 = "LABELS"
	SettingJobVolumePath          = "JOB_VOLUME_PATH"
	SettingJobVolumeName          = "JOB_VOLUME_NAME"
	SettingKubeNamespace          = "KUBE_NAMESPACE"
	SettingServiceAccount         = "SERVICE_ACCOUNT"
	SettingKubeconfig             = "KUBECONFIG"
	SettingMasterURL              = "MASTER_URL"
	SettingPodAffinityMatchLabels = "AFFINITY_MATCH_LABELS"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	// Namespace where the bundle's job should be executed. Required.
	Namespace string

	// ServiceAccountName is the name of the ServiceAccount under which the
	// bundle's job should be executed. Leave blank to execute as the default
	// ServiceAccount of the namespace.
	ServiceAccountName string

	// Annotations that should be applied to any Kubernetes resources created
	// by the driver.
	Annotations map[string]string

	// Affinity specifies the affinity constraints for the job created by the driver, for example if the PV provisioned/used for the PVC (JobVolumeName) is mounted to a node
	// using ReadWriteOnce then the job will need to run on the same node as the PVC
	Affinity *v1.Affinity

	// Labels that should be applied to any Kubernetes resources created
	// by the driver.
	Labels []string

	// LimitCPU is the amount of CPU to request and the limit for the bundle's job.
	// Set to zero to not use a limit. Defaults to zero.
	LimitCPU resource.Quantity

	// LimitMemory is the amount of memory to request and the limit for the bundle's job.
	// Set to zero to not use a limit. Defaults to zero.
	LimitMemory resource.Quantity

	// JobVolumePath is the local path where the a persistent volume is mounted to share
	// data between the driver and the bundle.
	JobVolumePath string

	// JobVolumeName is the name of the persistent volume claim that should be mounted
	// to the bundle's pod to share data between the driver and the bundle.
	//
	// Files that should be injected into the bundle are stored in ./inputs and the
	// directory ./outputs is mounted to /cnab/app/outputs to collect any bundle
	// outputs generated.
	JobVolumeName string

	// Tolerations is an optional list of tolerations to apply to the bundle's job.
	Tolerations []v1.Toleration

	// ActiveDeadlineSeconds is the time limit for running the driver's
	// execution, including retries. Set to 0 to not use a deadline. Default is
	// 5 minutes.
	//
	// Setting this value to a non-zero value can cause bundles that would have
	// been successful, or that have even completed successfully, to halt abruptly
	// before the bundle's execution run can be recorded in claim storage.
	ActiveDeadlineSeconds int64

	// BackoffLimit is the number of times to retry the driver's
	// execution. Defaults to 0, so failed executions will not be retried.
	BackoffLimit int32

	// SkipCleanup specifies if the driver should remove any Kubernetes
	// resources that it created when the driver execution completes.
	SkipCleanup bool

	// InCluster indicates if the driver should connect to the cluster using
	// in-cluster environment variables.
	InCluster bool

	// Kubeconfig is the absolute path to the kubeconfig file.
	Kubeconfig string

	// MasterURL is the Kubernetes API endpoint.
	MasterURL string
	// contains filtered or unexported fields
}

Driver runs an invocation image in a Kubernetes cluster.

func New

func New(namespace, serviceAccount string, conf *rest.Config) (*Driver, error)

New initializes a Kubernetes driver.

func (*Driver) Config

func (k *Driver) Config() map[string]string

Config returns the Kubernetes driver configuration options.

func (*Driver) Handles

func (k *Driver) Handles(imagetype string) bool

Handles receives an ImageType* and answers whether this driver supports that type.

func (*Driver) Run

Run executes the operation inside of the invocation image.

func (*Driver) SetConfig

func (k *Driver) SetConfig(settings map[string]string) error

SetConfig sets Kubernetes driver configuration.

Jump to

Keyboard shortcuts

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