v1alpha1

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the v1alpha1 API group +kubebuilder:object:generate=true +groupName=octorun.github.io

Index

Constants

View Source
const (
	RunnerBusyReason         string = "RunnerBusy"
	RunnerOnlineReason       string = "RunnerOnline"
	RunnerOfflineReason      string = "RunnerOffline"
	RunnerPodPendingReason   string = "RunnerPodPending"
	RunnerPodSucceededReason string = "RunnerPodSucceeded"
	RunnerSecretFailedReason string = "RunnerSecretFailed"
)
View Source
const (
	RunnerAdoptedReason string = "RunnerAdopted"
	RunnerCreatedReason string = "RunnerCreated"
	RunnerDeletedReason string = "RunnerDeleted"
)
View Source
const (
	// AnnotationRunnerAssignedJobAt can be used to indicate that a runner
	// already assigned a Github Workflow Job. This annotation is also used by
	// github webhook handler to retrigger runner controller reconciliation.
	AnnotationRunnerAssignedJobAt = "runner.octorun.github.io/assigned-job-at"

	// AnnotationRunnerTokenExpiresAt is used to note when the registration token will expire.
	// The runner controller will refresh the token if needed based on this annotation.
	AnnotationRunnerTokenExpiresAt = "runner.octorun.github.io/token-expires-at"

	// AnnotationRunnerEvictionPolicy used to respect the Kubernetes cluster-autoscaler eviction.
	// Since the Pod created by Runner is not controlled by Kubernetes workload controller (eg: ReplicaSet, StatefulSet etc)
	// cluster-autoscaler unable to drain underutilized node.
	//
	// The value could be Never or IfNotActive. set this annotation to IfNotActive will annotate the runner Pod
	// with `cluster-autoscaler.kubernetes.io/safe-to-evict=true` once created and will be removed when Runner become Active (has assigned job)
	//
	// NOTE: this annotation is experimental and will be added to Runner Object field if possible in the next API version.
	AnnotationRunnerEvictionPolicy = "runner.octorun.github.io/eviction-policy"
)
View Source
const (
	// LabelPrefix is well known prefix used to labels the runners.
	// the controller will pass each runners labels with this prefix
	// to the github runners labels.
	//
	// Example:
	//	"octorun.github.io/foo": "bar"
	// will passed to the Github runner label as
	//	`foo=bar`
	LabelPrefix = "octorun.github.io/"

	// LabelRunnerName is used to labels the GitHub runner using `runner: ` prefix.
	// By default, when creating a Runner resource the admission controller will
	// add this label with the value from Runner .metadata.name if created Runner
	// does not have this label.
	//
	// Example:
	// 	apiVersion: octorun.github.io/v1alpha1
	// 	kind: Runner
	// 	metadata:
	// 	name: runner-sample
	// 	labels:
	// 		octorun.github.io/runner: myrunner
	//
	// will passed to the Github runner label as
	//	runner=myrunner
	//
	// NOTE: this defaulting is applicable only if the Runner resource
	// is created directly (not using the runner template. eg: from runnerset).
	LabelRunnerName = LabelPrefix + "runner"

	// LabelRunnerSetName is used to labels the Github runner using `runnerset: ` prefix.
	// By default, when creating a RunnerSet the admission controller will
	// add this label to the Runner controlled by RunnerSet with the value from RunnerSet
	// .metadata.name if created RunnerSet does not have this label.
	//
	// Example:
	// 	apiVersion: octorun.github.io/v1alpha1
	// 	kind: RunnerSet
	// 	metadata:
	//   	name: runnerset-sample
	// 	spec:
	//   	template:
	//     	metadata:
	//       	labels:
	//         	octorun.github.io/runnerset: myrunnerset
	//
	// will passed to Github runner label as
	//	runnerset=myrunnerset
	//
	LabelRunnerSetName = LabelPrefix + "runnerset"
)
View Source
const (
	RunnerConditionOnline string = "runner.octorun.github.io/Online"
)

Variables

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

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

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

Functions

This section is empty.

Types

type Runner

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

	Spec   RunnerSpec   `json:"spec,omitempty"`
	Status RunnerStatus `json:"status,omitempty"`
}

Runner is the Schema for the runners API

func (*Runner) DeepCopy

func (in *Runner) DeepCopy() *Runner

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

func (*Runner) DeepCopyInto

func (in *Runner) DeepCopyInto(out *Runner)

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

func (*Runner) DeepCopyObject

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

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

type RunnerImage

type RunnerImage struct {
	// Runner Container image name.
	Name string `json:"name,omitempty"`

	// Image pull policy.
	// One of Always, Never, IfNotPresent.
	// +kubebuilder:validation:Enum=Always;Never;IfNotPresent
	// +optional
	PullPolicy corev1.PullPolicy `json:"pullPolicy,omitempty"`

	// An optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec.
	// If specified, these secrets will be passed to individual puller implementations for them to use. For example,
	// in the case of docker, only DockerConfig type secrets are honored.
	// More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
	// +optional
	PullSecrets []corev1.LocalObjectReference `json:"pullSecrets,omitempty"`
}

func (*RunnerImage) DeepCopy

func (in *RunnerImage) DeepCopy() *RunnerImage

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

func (*RunnerImage) DeepCopyInto

func (in *RunnerImage) DeepCopyInto(out *RunnerImage)

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

type RunnerList

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

RunnerList contains a list of Runner

func (*RunnerList) DeepCopy

func (in *RunnerList) DeepCopy() *RunnerList

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

func (*RunnerList) DeepCopyInto

func (in *RunnerList) DeepCopyInto(out *RunnerList)

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

func (*RunnerList) DeepCopyObject

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

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

type RunnerPhase

type RunnerPhase string
const (
	// Pending means the runner is in the initialization process.
	// eg: creating runner pod, registering the runner, etc.
	RunnerPendingPhase RunnerPhase = "Pending"
	// Idle means the runner has successfully initialized but has no
	// job assigned to this runner yet.
	RunnerIdlePhase RunnerPhase = "Idle"
	// Active means the runner has an assigned job.
	RunnerActivePhase RunnerPhase = "Active"
	// Complete means the runner has already completed his job.
	RunnerCompletePhase RunnerPhase = "Complete"
)

These are the valid phases of runners.

type RunnerPlacement

type RunnerPlacement struct {
	// A selector which must be true for the pod to fit on a node.
	// Selector which must match a node's labels for the pod to be scheduled on that node.
	// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
	// +optional
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// If specified, the pod's tolerations.
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

	// If specified, the pod's scheduling constraints
	// +optional
	Affinity *corev1.Affinity `json:"affinity,omitempty"`
}

func (*RunnerPlacement) DeepCopy

func (in *RunnerPlacement) DeepCopy() *RunnerPlacement

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

func (*RunnerPlacement) DeepCopyInto

func (in *RunnerPlacement) DeepCopyInto(out *RunnerPlacement)

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

type RunnerSet

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

	Spec   RunnerSetSpec   `json:"spec,omitempty"`
	Status RunnerSetStatus `json:"status,omitempty"`
}

RunnerSet is the Schema for the runnersets API

func (*RunnerSet) DeepCopy

func (in *RunnerSet) DeepCopy() *RunnerSet

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

func (*RunnerSet) DeepCopyInto

func (in *RunnerSet) DeepCopyInto(out *RunnerSet)

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

func (*RunnerSet) DeepCopyObject

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

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

type RunnerSetList

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

RunnerSetList contains a list of RunnerSet

func (*RunnerSetList) DeepCopy

func (in *RunnerSetList) DeepCopy() *RunnerSetList

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

func (*RunnerSetList) DeepCopyInto

func (in *RunnerSetList) DeepCopyInto(out *RunnerSetList)

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

func (*RunnerSetList) DeepCopyObject

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

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

type RunnerSetSpec

type RunnerSetSpec struct {
	// Runners is the number of desired runners. This is a pointer
	// to distinguish between explicit zero and unspecified.
	// Defaults to 1.
	// +optional
	// +kubebuilder:default=1
	Runners *int32 `json:"runners,omitempty"`

	// Selector is a label query over runners that should match the replica count.
	// Label keys and values that must match in order to be controlled by this RunnerSet.
	// It must match the runner template's labels.
	// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
	Selector metav1.LabelSelector `json:"selector"`

	// Template is the object that describes the runner that will be created if
	// insufficient replicas are detected.
	// +optional
	Template RunnerTemplateSpec `json:"template"`
}

RunnerSetSpec defines the desired state of RunnerSet

func (*RunnerSetSpec) DeepCopy

func (in *RunnerSetSpec) DeepCopy() *RunnerSetSpec

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

func (*RunnerSetSpec) DeepCopyInto

func (in *RunnerSetSpec) DeepCopyInto(out *RunnerSetSpec)

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

type RunnerSetStatus

type RunnerSetStatus struct {
	// Runners is the most recently observed number of runners.
	// +optional
	Runners int32 `json:"runners"`

	// The number of idle runners for this RunnerSet.
	// +optional
	IdleRunners int32 `json:"idleRunners"`

	// The number of active runners for this RunnerSet.
	// +optional
	ActiveRunners int32 `json:"activeRunners"`

	// Conditions defines current service state of the runner.
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// Selector is the same as the label selector but in the string format to avoid introspection
	// by clients. The string will be in the same format as the query-param syntax.
	// More info about label selectors: http://kubernetes.io/docs/user-guide/labels#label-selectors
	// +optional
	Selector string `json:"selector,omitempty"`
}

RunnerSetStatus defines the observed state of RunnerSet

func (*RunnerSetStatus) DeepCopy

func (in *RunnerSetStatus) DeepCopy() *RunnerSetStatus

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

func (*RunnerSetStatus) DeepCopyInto

func (in *RunnerSetStatus) DeepCopyInto(out *RunnerSetStatus)

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

type RunnerSpec

type RunnerSpec struct {
	// The github Organization or Repository URL for this runner.
	// Must be a valid Github Org or Repository URL.
	// eg:
	// 	- "https://github.com/org"
	// 	- "https://github.com/org/repo"
	URL string `json:"url"`

	// ID of the runner assigned by Github, basically it is sequential number.
	// Read-only.
	// +optional
	ID *int64 `json:"id,omitempty"`

	// OS type of the runner. Populated by the system.
	// Read-only.
	// +optional
	OS string `json:"os,omitempty"`

	// Name of the runner group to add to this runner.
	// Defaults to Default.
	// +optional
	Group string `json:"group,omitempty"`

	// Relative runner work directory.
	// +optional
	Workdir string `json:"workdir,omitempty"`

	// Runner container image specification
	// +optional
	Image RunnerImage `json:"image,omitempty"`

	// Placement configuration to pass to kubernetes pod (affinity, node selector, etc).
	// +optional
	Placement RunnerPlacement `json:"placement,omitempty"`

	// Compute resources required by runner container.
	// +optional
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`

	// ServiceAccountName is the name of the ServiceAccount to use to run this runner pod.
	// More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
	// +optional
	ServiceAccountName string `json:"serviceAccountName,omitempty"`

	// SecurityContext holds security configuration that will be applied to the runner container.
	// +optional
	SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`

	// RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used
	// to run this runner pod.  If no RuntimeClass resource matches the named class, the pod will not be run.
	// If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an
	// empty definition that uses the default runtime handler.
	// +optional
	RuntimeClassName *string `json:"runtimeClassName,omitempty"`

	// List of volumes that can be mounted by runner container belonging to the runner pod.
	// +optional
	Volumes []corev1.Volume `json:"volumes,omitempty"`

	// Runner pod volumes to mount into the runner container filesystem.
	// +optional
	VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

RunnerSpec defines the desired state of Runner

func (*RunnerSpec) DeepCopy

func (in *RunnerSpec) DeepCopy() *RunnerSpec

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

func (*RunnerSpec) DeepCopyInto

func (in *RunnerSpec) DeepCopyInto(out *RunnerSpec)

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

type RunnerStatus

type RunnerStatus struct {
	// Phase represents the current phase of runner.
	// +optional
	Phase RunnerPhase `json:"phase,omitempty"`

	// Conditions defines current service state of the runner.
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

RunnerStatus defines the observed state of Runner

func (*RunnerStatus) DeepCopy

func (in *RunnerStatus) DeepCopy() *RunnerStatus

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

func (*RunnerStatus) DeepCopyInto

func (in *RunnerStatus) DeepCopyInto(out *RunnerStatus)

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

type RunnerTemplateSpec

type RunnerTemplateSpec struct {
	// Standard object's metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Specification of the desired behavior of the runner.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
	// +optional
	Spec RunnerSpec `json:"spec,omitempty"`
}

RunnerTemplateSpec describes the data a runner should have when created from a template

func (*RunnerTemplateSpec) DeepCopy

func (in *RunnerTemplateSpec) DeepCopy() *RunnerTemplateSpec

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

func (*RunnerTemplateSpec) DeepCopyInto

func (in *RunnerTemplateSpec) DeepCopyInto(out *RunnerTemplateSpec)

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