Documentation
¶
Overview ¶
Package v1alpha1 contains API Schema definitions for the workload v1alpha1 API group. +kubebuilder:object:generate=true +groupName=workload.otterscale.io
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // GroupVersion is group version used to register these objects. GroupVersion = schema.GroupVersion{Group: "workload.otterscale.io", Version: "v1alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitzero"`
// Spec defines the desired behavior of the Application.
// +required
Spec ApplicationSpec `json:"spec"`
// Status represents the current information about the Application.
// +optional
Status ApplicationStatus `json:"status,omitzero"`
}
Application is the Schema for the applications API. An Application provides a unified abstraction for deploying a workload with an optional Service and PersistentVolumeClaim.
func (*Application) DeepCopy ¶
func (in *Application) DeepCopy() *Application
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Application.
func (*Application) DeepCopyInto ¶
func (in *Application) DeepCopyInto(out *Application)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Application) DeepCopyObject ¶
func (in *Application) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ApplicationList ¶
type ApplicationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitzero"`
Items []Application `json:"items"`
}
ApplicationList contains a list of Application resources.
func (*ApplicationList) DeepCopy ¶
func (in *ApplicationList) DeepCopy() *ApplicationList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationList.
func (*ApplicationList) DeepCopyInto ¶
func (in *ApplicationList) DeepCopyInto(out *ApplicationList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ApplicationList) DeepCopyObject ¶
func (in *ApplicationList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ApplicationSpec ¶
type ApplicationSpec struct {
// WorkloadType determines whether to create a Deployment (default), CronJob, or Job.
// Changing this field causes the operator to delete the previously managed workload
// resource and create the new one.
//
// +kubebuilder:default=Deployment
// +optional
WorkloadType WorkloadType `json:"workloadType,omitempty"`
// DeploymentConfig groups the Deployment spec together with its optional
// Service, PersistentVolumeClaim, and mount path.
// Required when workloadType is Deployment; ignored otherwise.
// +optional
DeploymentConfig *DeploymentConfig `json:"deploymentConfig,omitempty"`
// CronJob defines the schedule and job template for a scheduled workload.
// Required when workloadType is CronJob; ignored otherwise.
// +optional
CronJob *batchv1.CronJobSpec `json:"cronJob,omitempty"`
// Job defines the job template for a one-off workload.
// Required when workloadType is Job; ignored otherwise.
// +optional
Job *batchv1.JobSpec `json:"job,omitempty"`
}
ApplicationSpec defines the desired state of an Application. It uses a discriminated-union pattern: WorkloadType selects the active workload branch. Only the corresponding spec field must be set.
+kubebuilder:validation:XValidation:rule="self.workloadType != 'Deployment' || has(self.deploymentConfig)",message="deploymentConfig is required when workloadType is Deployment" +kubebuilder:validation:XValidation:rule="self.workloadType != 'CronJob' || has(self.cronJob)",message="cronJob is required when workloadType is CronJob" +kubebuilder:validation:XValidation:rule="self.workloadType != 'Job' || has(self.job)",message="job is required when workloadType is Job" +kubebuilder:validation:XValidation:rule="[has(self.deploymentConfig), has(self.cronJob), has(self.job)].filter(x, x).size() <= 1",message="deploymentConfig, cronJob, and job are mutually exclusive; set only one"
func (*ApplicationSpec) DeepCopy ¶
func (in *ApplicationSpec) DeepCopy() *ApplicationSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationSpec.
func (*ApplicationSpec) DeepCopyInto ¶
func (in *ApplicationSpec) DeepCopyInto(out *ApplicationSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ApplicationStatus ¶
type ApplicationStatus struct {
// ObservedGeneration is the most recent generation observed by the controller.
// It corresponds to the Application's generation, which is updated on mutation by the API Server.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// DeploymentRef is a reference to the Deployment managed by this Application.
// Only set when workloadType is Deployment.
// +optional
DeploymentRef *ResourceReference `json:"deploymentRef,omitempty"`
// CronJobRef is a reference to the CronJob managed by this Application.
// Only set when workloadType is CronJob.
// +optional
CronJobRef *ResourceReference `json:"cronJobRef,omitempty"`
// JobRef is a reference to the Job managed by this Application.
// Only set when workloadType is Job.
// +optional
JobRef *ResourceReference `json:"jobRef,omitempty"`
// ServiceRef is a reference to the Service managed by this Application.
// Only set when workloadType is Deployment and a Service spec is provided.
// +optional
ServiceRef *ResourceReference `json:"serviceRef,omitempty"`
// PersistentVolumeClaimRef is a reference to the PersistentVolumeClaim managed by this Application.
// +optional
PersistentVolumeClaimRef *ResourceReference `json:"persistentVolumeClaimRef,omitempty"`
// Conditions store the status conditions of the Application (e.g., Ready, Progressing, Degraded).
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
ApplicationStatus defines the observed state of an Application. It contains references to the actual Kubernetes resources created by the controller.
func (*ApplicationStatus) DeepCopy ¶
func (in *ApplicationStatus) DeepCopy() *ApplicationStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationStatus.
func (*ApplicationStatus) DeepCopyInto ¶
func (in *ApplicationStatus) DeepCopyInto(out *ApplicationStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type DeploymentConfig ¶ added in v0.8.25
type DeploymentConfig struct {
// Deployment defines the pod template, replicas, and update strategy
// for a long-running workload.
// +required
Deployment appsv1.DeploymentSpec `json:"deployment"`
// Service defines the Service configuration.
// If specified, a Service will be created to expose the application.
// +optional
Service *corev1.ServiceSpec `json:"service,omitempty"`
// PersistentVolumeClaim defines the desired characteristics of the PVC.
// If specified, a PVC will be created and automatically mounted into all
// containers at MountPath.
// +optional
PersistentVolumeClaim *corev1.PersistentVolumeClaimSpec `json:"persistentVolumeClaim,omitempty"`
// MountPath is the absolute path within every container at which the PVC
// will be mounted (e.g. "/data").
// Required when persistentVolumeClaim is set.
//
// +kubebuilder:validation:MinLength=1
// +optional
MountPath string `json:"mountPath,omitempty"`
}
DeploymentConfig groups all Deployment-mode resources: the Deployment spec, optional Service, optional PersistentVolumeClaim, and the path at which the PVC is mounted inside every container.
+kubebuilder:validation:XValidation:rule="has(self.persistentVolumeClaim) == has(self.mountPath)",message="persistentVolumeClaim and mountPath must be specified together"
func (*DeploymentConfig) DeepCopy ¶ added in v0.8.25
func (in *DeploymentConfig) DeepCopy() *DeploymentConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentConfig.
func (*DeploymentConfig) DeepCopyInto ¶ added in v0.8.25
func (in *DeploymentConfig) DeepCopyInto(out *DeploymentConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourceReference ¶
type ResourceReference struct {
// Name is the name of the referenced resource.
// +required
Name string `json:"name"`
// Namespace is the namespace of the referenced resource.
// +optional
Namespace string `json:"namespace,omitempty"`
}
ResourceReference is a lightweight reference to a Kubernetes resource managed by the operator.
func (*ResourceReference) DeepCopy ¶
func (in *ResourceReference) DeepCopy() *ResourceReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceReference.
func (*ResourceReference) DeepCopyInto ¶
func (in *ResourceReference) DeepCopyInto(out *ResourceReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type WorkloadType ¶ added in v0.8.24
type WorkloadType string
WorkloadType defines the type of workload managed by the Application.
+kubebuilder:validation:Enum=Deployment;CronJob;Job
const ( // WorkloadTypeDeployment creates a long-running Deployment and optional Service. WorkloadTypeDeployment WorkloadType = "Deployment" // WorkloadTypeCronJob creates a scheduled CronJob workload. WorkloadTypeCronJob WorkloadType = "CronJob" // WorkloadTypeJob creates a one-off Job workload. WorkloadTypeJob WorkloadType = "Job" )