v1alpha1

package
v0.0.178-gc480b28 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// QuarksJobResourceKind is the kind name of QuarksJob
	QuarksJobResourceKind = "QuarksJob"
	// QuarksJobResourcePlural is the plural name of QuarksJob
	QuarksJobResourcePlural = "quarksjobs"
)
View Source
const (
	// RemoteIDKey is the key for the ENV variable which is copied to the
	// output secrets label `LabelReferencedJobName`
	// This env can be set on each container, which is supposed to generate output.
	RemoteIDKey = "REMOTE_ID"

	// TriggerManual is the default for errand jobs, change to TriggerNow to run them
	TriggerManual Strategy = "manual"
	// TriggerNow instructs the controller to run the job now,
	// resets to TriggerManual after starting the job
	TriggerNow Strategy = "now"
	// TriggerOnce jobs run only once, when created, then switches to TriggerDone
	TriggerOnce Strategy = "once"
	// TriggerDone jobs are no longer triggered. It's the final state for TriggerOnce strategies
	TriggerDone Strategy = "done"

	// PersistOneToOne results in one secret per input file using the provided
	// name as the secret name
	PersistOneToOne PersistenceMethod = "one-to-one"

	// PersistUsingFanOut results in one secret per key/value pair found in the
	// provided input file and the name being used as a prefix for the secret
	PersistUsingFanOut PersistenceMethod = "fan-out"
)

Variables

View Source
var (

	// AddToScheme is used for schema registrations in the controller package
	// and also in the generated kube code
	AddToScheme = schemeBuilder.AddToScheme

	// QuarksJobResourceShortNames is the short names of QuarksJob
	QuarksJobResourceShortNames = []string{"qjob", "qjobs"}
	// QuarksJobValidation is the validation method for QuarksJob
	QuarksJobValidation = extv1.CustomResourceValidation{
		OpenAPIV3Schema: &extv1.JSONSchemaProps{
			Type: "object",
			Properties: map[string]extv1.JSONSchemaProps{
				"spec": {
					Type: "object",
					Properties: map[string]extv1.JSONSchemaProps{
						"output": {
							Type: "object",
							Properties: map[string]extv1.JSONSchemaProps{
								"outputMap": {
									Type:                   "object",
									XPreserveUnknownFields: pointers.Bool(true),
								},
								"outputType": {
									Type: "string",
								},
								"secretLabels": {
									Type:                   "object",
									XPreserveUnknownFields: pointers.Bool(true),
								},
								"writeOnFailure": {
									Type: "boolean",
								},
							},
							Required: []string{
								"outputMap",
							},
						},
						"trigger": {
							Type: "object",
							Properties: map[string]extv1.JSONSchemaProps{
								"strategy": {
									Type: "string",
									Enum: []extv1.JSON{
										{
											Raw: []byte(`"manual"`),
										},
										{
											Raw: []byte(`"once"`),
										},
										{
											Raw: []byte(`"now"`),
										},
										{
											Raw: []byte(`"done"`),
										},
									},
								},
							},
							Required: []string{
								"strategy",
							},
						},
						"template": {
							Type:                   "object",
							XPreserveUnknownFields: pointers.Bool(true),
						},
						"updateOnConfigChange": {
							Type: "boolean",
						},
					},
				},
				"status": {
					Type: "object",
					Properties: map[string]extv1.JSONSchemaProps{
						"lastReconcile": {
							Type: "string",
						},
						"completed": {
							Type: "boolean",
						},
					},
				},
			},
		},
	}

	// QuarksJobResourceName is the resource name of QuarksJob
	QuarksJobResourceName = fmt.Sprintf("%s.%s", QuarksJobResourcePlural, apis.GroupName)

	// SchemeGroupVersion is group version used to register these objects
	SchemeGroupVersion = schema.GroupVersion{Group: apis.GroupName, Version: "v1alpha1"}
)
View Source
var (
	// LabelNamespace key for label on a namespace to indicate that cf-operator is monitoring it.
	// Can be used as an ID, to keep operators in a cluster from intefering with each other.
	LabelNamespace = fmt.Sprintf("%s/monitored", apis.GroupName)

	// LabelServiceAccount key for label on a namespace, which names the
	// service account, that will be injected to capture job output into a
	// secret
	LabelServiceAccount = fmt.Sprintf("%s/qjob-service-account", apis.GroupName)

	// LabelPersistentSecretContainer is a label used for persisted secrets,
	// identifying the container that created them
	LabelPersistentSecretContainer = fmt.Sprintf("%s/container-name", apis.GroupName)

	// LabelRemoteID is a label for persisted secrets, identifying
	// the remote resource they belong to
	LabelRemoteID = fmt.Sprintf("%s/remote-id", apis.GroupName)

	// LabelQJobName key for label on a batchv1.Job's pod, which is set to the QuarksJob's name
	LabelQJobName = fmt.Sprintf("%s/qjob-name", apis.GroupName)
	// LabelTriggeringPod key for label, which is set to the UID of the pod that triggered an QuarksJob
	LabelTriggeringPod = fmt.Sprintf("%s/triggering-pod", apis.GroupName)
)

Functions

func IsMonitoredNamespace added in v0.0.77

func IsMonitoredNamespace(n *corev1.Namespace, id string) bool

IsMonitoredNamespace returns true if the namespace has all the necessary labels and should be included in controller watches.

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type FilesToSecrets

type FilesToSecrets map[string]SecretOptions

FilesToSecrets maps file names to secret names

func NewFileToSecret

func NewFileToSecret(fileName string, secretName string, versioned bool, annotations map[string]string, labels map[string]string) FilesToSecrets

NewFileToSecret returns a FilesToSecrets with just one mapping

func NewFileToSecrets

func NewFileToSecrets(fileName string, secretName string, versioned bool, annotations map[string]string, labels map[string]string) FilesToSecrets

NewFileToSecrets uses a fan out style and creates one secret per key/value pair in the given input file

func (FilesToSecrets) DeepCopy

func (in FilesToSecrets) DeepCopy() FilesToSecrets

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

func (FilesToSecrets) DeepCopyInto

func (in FilesToSecrets) DeepCopyInto(out *FilesToSecrets)

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

func (FilesToSecrets) PrefixedPaths

func (f FilesToSecrets) PrefixedPaths(prefix string) []string

PrefixedPaths retuns all output file names, prefixed with the `prefix`

type Output

type Output struct {
	// OutputMap allows for for additional output files per container.
	// Each filename maps to a set of options.
	OutputMap OutputMap `json:"outputMap"`

	// OutputType only JSON is supported for now
	OutputType string `json:"outputType,omitempty"`

	// SecretLabels are copied onto the newly created secrets
	SecretLabels   map[string]string `json:"secretLabels,omitempty"`
	WriteOnFailure bool              `json:"writeOnFailure,omitempty"`
}

Output contains options to persist job output to secrets

func (*Output) DeepCopy

func (in *Output) DeepCopy() *Output

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

func (*Output) DeepCopyInto

func (in *Output) DeepCopyInto(out *Output)

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

type OutputMap

type OutputMap map[string]FilesToSecrets

OutputMap has FilesToSecrets mappings for every container

func (OutputMap) DeepCopy

func (in OutputMap) DeepCopy() OutputMap

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

func (OutputMap) DeepCopyInto

func (in OutputMap) DeepCopyInto(out *OutputMap)

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

type PersistenceMethod

type PersistenceMethod string

PersistenceMethod describes the secret persistence implemention style

type QuarksJob

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

	Spec   QuarksJobSpec   `json:"spec,omitempty"`
	Status QuarksJobStatus `json:"status,omitempty"`
}

QuarksJob is the Schema for the QuarksJobs API +k8s:openapi-gen=true

func (*QuarksJob) DeepCopy

func (in *QuarksJob) DeepCopy() *QuarksJob

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

func (*QuarksJob) DeepCopyInto

func (in *QuarksJob) DeepCopyInto(out *QuarksJob)

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

func (*QuarksJob) DeepCopyObject

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

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

func (*QuarksJob) GetNamespacedName added in v0.0.77

func (q *QuarksJob) GetNamespacedName() string

GetNamespacedName returns the resource name with its namespace

func (*QuarksJob) IsAutoErrand

func (q *QuarksJob) IsAutoErrand() bool

IsAutoErrand returns true if this quarks job is an auto errand

func (*QuarksJob) ToBeDeleted

func (q *QuarksJob) ToBeDeleted() bool

ToBeDeleted checks whether this QuarksJob has been marked for deletion

type QuarksJobList

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

QuarksJobList contains a list of QuarksJob

func (*QuarksJobList) DeepCopy

func (in *QuarksJobList) DeepCopy() *QuarksJobList

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

func (*QuarksJobList) DeepCopyInto

func (in *QuarksJobList) DeepCopyInto(out *QuarksJobList)

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

func (*QuarksJobList) DeepCopyObject

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

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

type QuarksJobSpec

type QuarksJobSpec struct {
	Output               *Output                 `json:"output,omitempty"`
	Trigger              Trigger                 `json:"trigger"`
	Template             batchv1.JobTemplateSpec `json:"template"`
	UpdateOnConfigChange bool                    `json:"updateOnConfigChange"`
}

QuarksJobSpec defines the desired state of QuarksJob

func (*QuarksJobSpec) DeepCopy

func (in *QuarksJobSpec) DeepCopy() *QuarksJobSpec

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

func (*QuarksJobSpec) DeepCopyInto

func (in *QuarksJobSpec) DeepCopyInto(out *QuarksJobSpec)

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

type QuarksJobStatus

type QuarksJobStatus struct {
	LastReconcile *metav1.Time `json:"lastReconcile"`
	Completed     bool         `json:"completed"`
}

QuarksJobStatus defines the observed state of QuarksJob

func (*QuarksJobStatus) DeepCopy

func (in *QuarksJobStatus) DeepCopy() *QuarksJobStatus

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

func (*QuarksJobStatus) DeepCopyInto

func (in *QuarksJobStatus) DeepCopyInto(out *QuarksJobStatus)

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

type SecretOptions

type SecretOptions struct {
	Name                        string            `json:"name,omitempty"`
	AdditionalSecretLabels      map[string]string `json:"secretLabels,omitempty"`
	AdditionalSecretAnnotations map[string]string `json:"secretAnnotations,omitempty"`
	Versioned                   bool              `json:"versioned,omitempty"`
	PersistenceMethod           PersistenceMethod `json:"persistencemethod,omitempty"`
}

SecretOptions specify the name of the output secret and if it's versioned

func (*SecretOptions) DeepCopy

func (in *SecretOptions) DeepCopy() *SecretOptions

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

func (*SecretOptions) DeepCopyInto

func (in *SecretOptions) DeepCopyInto(out *SecretOptions)

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

func (SecretOptions) FanOutName

func (so SecretOptions) FanOutName(key string) string

FanOutName returns the name of the secret for PersistenceMethod 'fan-out'

type Strategy

type Strategy string

Strategy describes the trigger strategy

type Trigger

type Trigger struct {
	Strategy Strategy `json:"strategy"`
}

Trigger decides how to trigger the QuarksJob

func (*Trigger) DeepCopy

func (in *Trigger) DeepCopy() *Trigger

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

func (*Trigger) DeepCopyInto

func (in *Trigger) DeepCopyInto(out *Trigger)

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