v1alpha1

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the etok v1alpha1 API group +kubebuilder:object:generate=true +groupName=etok.dev

Index

Constants

View Source
const (
	RunFailedCondition      = "Failed"
	RunCompleteCondition    = "Complete"
	WorkspaceReadyCondition = "Ready"

	PodCreatedReason        = "PodCreated"
	PodPendingReason        = "PodPending"
	PodUnknownReason        = "PodUnknown"
	PodSucceededReason      = "PodSucceeded"
	PodFailedReason         = "PodFailed"
	PodRunningReason        = "PodRunning"
	RunQueuedReason         = "Queued"
	RunUnqueuedReason       = "Unqueued"
	RunEnqueueTimeoutReason = "EnqueueTimeout"
	QueueTimeoutReason      = "QueueTimeout"
	RunPendingTimeoutReason = "PodPendingTimeout"
	WorkspaceNotFoundReason = "WorkspaceNotFound"

	// Pending means whatever is being observed is reported to be progressing
	// towards a non-failure state.
	PendingReason = "Pending"

	// Failure means that an error has occured that is considered unrecoverable,
	// likely rendering the resource unavailable or unable to function.
	FailureReason = "Failure"

	// Deleting means the resource is in the process of being deletion
	DeletionReason = "Deleting"

	// Unknown means state of workspace is unknown (or the state of an essential
	// component is unknown)
	UnknownReason = "Unknown"

	// Ready means the resource and all its components are fully functional
	ReadyReason = "AllSystemsOperational"
)
View Source
const ApprovedAnnotationKeyPrefix = "approvals.etok.dev"
View Source
const (
	DefaultHandshakeTimeout = 10 * time.Second
)

Variables

View Source
var (
	// SchemeGroupVersion is group version used to register these objects
	SchemeGroupVersion = schema.GroupVersion{Group: "etok.dev", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func ApprovedAnnotationKey

func ApprovedAnnotationKey(runName string) string

func GetRunFromApprovalAnnotationKey added in v0.0.7

func GetRunFromApprovalAnnotationKey(key string) string

func RunLockFileConfigMapName added in v0.0.4

func RunLockFileConfigMapName(name string) string

func WorkspaceBuiltinsConfigMapName added in v0.0.8

func WorkspaceBuiltinsConfigMapName(name string) string

func WorkspacePodName

func WorkspacePodName(name string) string

Types

type AttachSpec

type AttachSpec struct {
	// Enable TTY on pod and await handshake string from client
	Handshake bool `json:"handshake,omitempty"`

	// How long to wait for handshake before timing out
	HandshakeTimeout string `json:"handshakeTimeout,omitempty"`
}

AttachSpec defines behaviour for clients attaching to the pod's TTY

func (*AttachSpec) DeepCopy

func (in *AttachSpec) DeepCopy() *AttachSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AttachSpec.

func (*AttachSpec) DeepCopyInto

func (in *AttachSpec) DeepCopyInto(out *AttachSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Output added in v0.0.5

type Output struct {
	// Attribute name in module
	Key string `json:"key"`
	// Value
	Value string `json:"value"`
}

Output outputs the values of Terraform output

type Run

type Run struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	RunSpec   `json:"spec,omitempty"`
	RunStatus `json:"status,omitempty"`
}

func (*Run) ApprovedAnnotationKey

func (r *Run) ApprovedAnnotationKey() string

ApprovedAnnotationKey is the key to be set on a workspace's annotations to indicate that this run is approved. Only necessary if the workspace has categorised the run's command as privileged.

func (*Run) DeepCopy

func (in *Run) DeepCopy() *Run

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Run.

func (*Run) DeepCopyInto

func (in *Run) DeepCopyInto(out *Run)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Run) DeepCopyObject

func (in *Run) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Run) IsDone added in v0.0.7

func (r *Run) IsDone() bool

IsDone checks if a run has either completed or failed

func (*Run) IsReconciled added in v0.0.3

func (r *Run) IsReconciled() bool

func (*Run) LockFileConfigMapName added in v0.0.4

func (r *Run) LockFileConfigMapName() string

func (*Run) PodName

func (r *Run) PodName() string

Run's pod shares its name

type RunList

type RunList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Run `json:"items"`
}

RunList contains a list of Run

func (*RunList) DeepCopy

func (in *RunList) DeepCopy() *RunList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunList.

func (*RunList) DeepCopyInto

func (in *RunList) DeepCopyInto(out *RunList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RunList) DeepCopyObject

func (in *RunList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type RunPhase

type RunPhase string

A RunPhase summarises the current status of the run

const (
	// Unknown: current status cannot be determined
	RunPhaseUnknown RunPhase = "unknown"
	// Waiting: waiting to be added to workspace queue (only relevant to those
	// runs with a command that needs to be queued, e.g. apply, sh, etc.)
	RunPhaseWaiting RunPhase = "waiting"
	// Queued: run is currently in workspace queue backlog i.e. not first place
	RunPhaseQueued RunPhase = "queued"
	// Provisioning: run's pod is in the process of being created
	RunPhaseProvisioning RunPhase = "provisioning"
	// Running: run's pod is running
	RunPhaseRunning RunPhase = "running"
	// Completed: run's pod completed (regardless of exit code)
	RunPhaseCompleted RunPhase = "completed"
	// Failed: a fatal error occurred and the run will not be completed
	RunPhaseFailed RunPhase = "failed"

	RunDefaultConfigMapKey = "config.tar.gz"
)

type RunSpec

type RunSpec struct {

	// The command to run on the pod
	Command string `json:"command"`

	// The arguments to be passed to the command
	Args []string `json:"args,omitempty"`

	// ConfigMap containing the tarball to extract on the pod
	ConfigMap string `json:"configMap"`

	// The config map key identifying the tarball to extract
	ConfigMapKey string `json:"configMapKey"`

	// The path within the archive to the root module
	ConfigMapPath string `json:"configMapPath"`

	// The workspace of the run.
	Workspace string `json:"workspace"`

	// Logging verbosity.
	Verbosity int `json:"verbosity,omitempty"`

	// AttachSpec defines behaviour for clients attaching to the pod's TTY
	AttachSpec `json:",inline"`
}

RunSpec defines the desired state of Run

func (*RunSpec) DeepCopy

func (in *RunSpec) DeepCopy() *RunSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunSpec.

func (*RunSpec) DeepCopyInto

func (in *RunSpec) DeepCopyInto(out *RunSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RunStatus

type RunStatus struct {
	// Current phase of the run's lifecycle.
	Phase RunPhase `json:"phase,omitempty"`

	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// Exit code of run pod's runner container
	ExitCode *int `json:"exitCode,omitempty"`
}

RunStatus defines the observed state of Run

func (*RunStatus) DeepCopy

func (in *RunStatus) DeepCopy() *RunStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RunStatus.

func (*RunStatus) DeepCopyInto

func (in *RunStatus) DeepCopyInto(out *RunStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Variable added in v0.0.5

type Variable struct {
	// Variable name
	Key string `json:"key"`
	// Variable value
	Value string `json:"value"`
	// Source for the variable's value. Cannot be used if value is not empty.
	ValueFrom *corev1.EnvVarSource `json:"valueFrom,omitempty"`
	// EnvironmentVariable denotes if this variable should be created as
	// environment variable
	EnvironmentVariable bool `json:"environmentVariable,omitempty"`
}

Variable denotes an input to the module

type Workspace

type Workspace struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   WorkspaceSpec   `json:"spec,omitempty"`
	Status WorkspaceStatus `json:"status,omitempty"`
}

Workspace is the Schema for the workspaces API +kubebuilder:subresource:status +kubebuilder:resource:path=workspaces,scope=Namespaced,shortName={ws} +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase" +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.terraformVersion" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +kubebuilder:printcolumn:name="Active",type="string",JSONPath=".status.active" +kubebuilder:printcolumn:name="Queue",type="string",JSONPath=".status.queue" +genclient

func (*Workspace) BackupObjectName added in v0.0.5

func (ws *Workspace) BackupObjectName() string

BackupObjectName returns the object name to be used for the backup of the workspace's state file.

func (*Workspace) BuiltinsConfigMapName added in v0.0.8

func (ws *Workspace) BuiltinsConfigMapName() string

func (*Workspace) DeepCopy

func (in *Workspace) DeepCopy() *Workspace

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workspace.

func (*Workspace) DeepCopyInto

func (in *Workspace) DeepCopyInto(out *Workspace)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Workspace) DeepCopyObject

func (in *Workspace) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Workspace) IsPrivilegedCommand

func (ws *Workspace) IsPrivilegedCommand(cmd string) bool

func (*Workspace) IsReconciled added in v0.0.3

func (ws *Workspace) IsReconciled() bool

IsReconciled indicates whether resource has reconciled. It does this by checking that a ready condition has been set, regardless of whether it is true or false.

func (*Workspace) IsRunApproved

func (ws *Workspace) IsRunApproved(run *Run) bool

func (*Workspace) PVCName

func (ws *Workspace) PVCName() string

func (*Workspace) PodName

func (ws *Workspace) PodName() string

func (*Workspace) StateSecretName added in v0.0.5

func (ws *Workspace) StateSecretName() string

StateSecretName retrieves the name of the secret containing the terraform state for this workspace.

type WorkspaceCacheSpec

type WorkspaceCacheSpec struct {
	// Storage class for the cache's persistent volume claim. This is a pointer
	// to distinguish between explicit empty string and nil (which triggers
	// different behaviour for dynamic provisioning of persistent volumes).
	StorageClass *string `json:"storageClass,omitempty"`

	// Size of cache's persistent volume claim.
	Size string `json:"size,omitempty"`
}

WorkspaceSpec defines the desired state of Workspace's cache storage

func (*WorkspaceCacheSpec) DeepCopy

func (in *WorkspaceCacheSpec) DeepCopy() *WorkspaceCacheSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceCacheSpec.

func (*WorkspaceCacheSpec) DeepCopyInto

func (in *WorkspaceCacheSpec) DeepCopyInto(out *WorkspaceCacheSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WorkspaceList

type WorkspaceList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Workspace `json:"items"`
}

WorkspaceList contains a list of Workspace

func (*WorkspaceList) DeepCopy

func (in *WorkspaceList) DeepCopy() *WorkspaceList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceList.

func (*WorkspaceList) DeepCopyInto

func (in *WorkspaceList) DeepCopyInto(out *WorkspaceList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*WorkspaceList) DeepCopyObject

func (in *WorkspaceList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type WorkspacePhase

type WorkspacePhase string
const (
	WorkspacePhaseInitializing WorkspacePhase = "initializing"
	WorkspacePhaseReady        WorkspacePhase = "ready"
	WorkspacePhaseError        WorkspacePhase = "error"
	WorkspacePhaseUnknown      WorkspacePhase = "unknown"
	WorkspacePhaseDeleting     WorkspacePhase = "deleting"
)

type WorkspaceSpec

type WorkspaceSpec struct {
	// Persistent Volume Claim specification for workspace's cache.
	Cache WorkspaceCacheSpec `json:"cache,omitempty"`

	// Logging verbosity.
	Verbosity int `json:"verbosity,omitempty"`

	// List of commands that are deemed privileged. The client must set a
	// specific annotation on the workspace to approve a run with a privileged
	// command.
	PrivilegedCommands []string `json:"privilegedCommands,omitempty"`

	// Required version of Terraform on workspace pod
	TerraformVersion string `json:"terraformVersion,omitempty"`

	// Variables as inputs to module
	Variables []*Variable `json:"variables,omitempty"`

	// Ephemeral turns off state backup (and restore) - intended for short-lived
	// workspaces.
	Ephemeral bool `json:"ephemeral,omitempty"`
}

WorkspaceSpec defines the desired state of Workspace

func (*WorkspaceSpec) DeepCopy

func (in *WorkspaceSpec) DeepCopy() *WorkspaceSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceSpec.

func (*WorkspaceSpec) DeepCopyInto

func (in *WorkspaceSpec) DeepCopyInto(out *WorkspaceSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WorkspaceStatus

type WorkspaceStatus struct {
	// Queue of runs. Only runs with queueable commands (sh, apply, etc) are
	// queued.
	Queue []string `json:"queue,omitempty"`

	Active string `json:"active,omitempty"`

	// Lifecycle phase of workspace.
	Phase WorkspacePhase `json:"phase,omitempty"`

	// Outputs from state file
	Outputs []*Output `json:"outputs,omitempty"`

	// Serial number of state file. Nil means there is no state file.
	Serial *int `json:"serial,omitempty"`

	// Serial number of the last successfully backed up state file. Nil means it
	// has not been backed up.
	BackupSerial *int `json:"backupSerial,omitempty"`

	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

WorkspaceStatus defines the observed state of Workspace

func (*WorkspaceStatus) DeepCopy

func (in *WorkspaceStatus) DeepCopy() *WorkspaceStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceStatus.

func (*WorkspaceStatus) DeepCopyInto

func (in *WorkspaceStatus) DeepCopyInto(out *WorkspaceStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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