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) or a CronJob.
// 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"`
// Deployment defines the pod template, replicas, and update strategy
// for a long-running workload.
// Required when workloadType is Deployment; ignored otherwise.
// +optional
Deployment *appsv1.DeploymentSpec `json:"deployment,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"`
// Service defines the Service configuration.
// If specified, a Service will be created to expose the application.
// Only applicable when workloadType is Deployment.
// +optional
Service *corev1.ServiceSpec `json:"service,omitempty"`
// PersistentVolumeClaim defines the PersistentVolumeClaim configuration.
// If specified, a PersistentVolumeClaim will be created for persistent storage.
// Only applicable when workloadType is Deployment.
// +optional
PersistentVolumeClaim *corev1.PersistentVolumeClaimSpec `json:"persistentVolumeClaim,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 (Deployment or CronJob) must be set.
+kubebuilder:validation:XValidation:rule="self.workloadType != 'Deployment' || has(self.deployment)",message="deployment 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="!(has(self.deployment) && has(self.cronJob))",message="deployment and cronJob 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"`
// 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 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
const ( // WorkloadTypeDeployment creates a long-running Deployment and optional Service. WorkloadTypeDeployment WorkloadType = "Deployment" // WorkloadTypeCronJob creates a scheduled CronJob workload. WorkloadTypeCronJob WorkloadType = "CronJob" )