Skip to content

Commit

Permalink
pipeline api: add volumClaimTemplate (#513)
Browse files Browse the repository at this point in the history
* pipeline api: add volumClaimTemplate

Signed-off-by: Xieql <[email protected]>

* update

Signed-off-by: Xieql <[email protected]>

---------

Signed-off-by: Xieql <[email protected]>
  • Loading branch information
Xieql authored Dec 29, 2023
1 parent ed475ca commit 2430676
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 12 deletions.
96 changes: 92 additions & 4 deletions docs/content/en/references/pipeline_v1alpha1_types.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,16 @@ <h3 id="pipeline.kurator.dev/v1alpha1.Pipeline">Pipeline
<td>
<code>sharedWorkspace</code><br>
<em>
string
<a href="#pipeline.kurator.dev/v1alpha1.VolumeClaimTemplate">
VolumeClaimTemplate
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>SharedWorkspace is the name of the PVC. If not specified, a PVC with the Pipeline&rsquo;s name as prefix will be created by default.
<p>SharedWorkspace is the config of the PVC where task using
The PersistentVolumeClaim with this config will be created for each pipeline execution
it allows the user to specify e.g. size and StorageClass for the volume.
If not set, Kurator will create a PVC named Pipeline.name using default config</p>
</td>
</tr>
Expand Down Expand Up @@ -284,12 +288,16 @@ <h3 id="pipeline.kurator.dev/v1alpha1.PipelineSpec">PipelineSpec
<td>
<code>sharedWorkspace</code><br>
<em>
string
<a href="#pipeline.kurator.dev/v1alpha1.VolumeClaimTemplate">
VolumeClaimTemplate
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>SharedWorkspace is the name of the PVC. If not specified, a PVC with the Pipeline&rsquo;s name as prefix will be created by default.
<p>SharedWorkspace is the config of the PVC where task using
The PersistentVolumeClaim with this config will be created for each pipeline execution
it allows the user to specify e.g. size and StorageClass for the volume.
If not set, Kurator will create a PVC named Pipeline.name using default config</p>
</td>
</tr>
Expand Down Expand Up @@ -472,6 +480,86 @@ <h3 id="pipeline.kurator.dev/v1alpha1.TaskTemplate">TaskTemplate
(<em>Appears on:</em>
<a href="#pipeline.kurator.dev/v1alpha1.PredefinedTask">PredefinedTask</a>)
</p>
<h3 id="pipeline.kurator.dev/v1alpha1.VolumeClaimTemplate">VolumeClaimTemplate
</h3>
<p>
(<em>Appears on:</em>
<a href="#pipeline.kurator.dev/v1alpha1.PipelineSpec">PipelineSpec</a>)
</p>
<p>VolumeClaimTemplate is the configuration for the volume claim template in pipeline execution.
For more details, see <a href="https://github.com/kubernetes/api/blob/master/core/v1/types.go">https://github.com/kubernetes/api/blob/master/core/v1/types.go</a></p>
<div class="md-typeset__scrollwrap">
<div class="md-typeset__table td-content">
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>accessMode</code><br>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#persistentvolumeaccessmode-v1-core">
Kubernetes core/v1.PersistentVolumeAccessMode
</a>
</em>
</td>
<td>
<p>AccessMode determines the access modes for the volume, e.g., ReadWriteOnce.
This affects how the volume can be mounted.
&ldquo;ReadWriteOnce&rdquo; can be mounted in read/write mode to exactly 1 host
&ldquo;ReadOnlyMany&rdquo; can be mounted in read-only mode to many hosts
&ldquo;ReadWriteMany&rdquo; can be mounted in read/write mode to many hosts
&ldquo;ReadWriteOncePod&rdquo; can be mounted in read/write mode to exactly 1 pod, cannot be used in combination with other access modes</p>
</td>
</tr>
<tr>
<td>
<code>requestsStorage</code><br>
<em>
string
</em>
</td>
<td>
<p>StorageRequest defines the storage size required for this PVC, e.g., 1Gi, 100Mi.
It specifies the storage capacity needed as part of ResourceRequirements.</p>
</td>
</tr>
<tr>
<td>
<code>storageClassName</code><br>
<em>
string
</em>
</td>
<td>
<p>StorageClassName specifies the StorageClass name to which this persistent volume belongs, e.g., manual.
It allows the PVC to use the characteristics defined by the StorageClass.</p>
</td>
</tr>
<tr>
<td>
<code>volumeMode</code><br>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#persistentvolumemode-v1-core">
Kubernetes core/v1.PersistentVolumeMode
</a>
</em>
</td>
<td>
<p>VolumeMode specifies whether the volume should be used with a formatted filesystem (Filesystem)
or remain in raw block state (Block). The Filesystem value is implied when not included.
&ldquo;Block&rdquo; means the volume will not be formatted with a filesystem and will remain a raw block device.
&ldquo;Filesystem&rdquo; means the volume will be or is formatted with a filesystem.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="admonition note">
<p class="last">This page was automatically generated with <code>gen-crd-api-reference-docs</code></p>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,42 @@ spec:
of the pipeline.
type: string
sharedWorkspace:
description: SharedWorkspace is the name of the PVC. If not specified,
a PVC with the Pipeline's name as prefix will be created by default.
If not set, Kurator will create a PVC named Pipeline.name using
default config
type: string
description: SharedWorkspace is the config of the PVC where task using
The PersistentVolumeClaim with this config will be created for each
pipeline execution it allows the user to specify e.g. size and StorageClass
for the volume. If not set, Kurator will create a PVC named Pipeline.name
using default config
properties:
accessMode:
description: AccessMode determines the access modes for the volume,
e.g., ReadWriteOnce. This affects how the volume can be mounted.
"ReadWriteOnce" can be mounted in read/write mode to exactly
1 host "ReadOnlyMany" can be mounted in read-only mode to many
hosts "ReadWriteMany" can be mounted in read/write mode to many
hosts "ReadWriteOncePod" can be mounted in read/write mode to
exactly 1 pod, cannot be used in combination with other access
modes
type: string
requestsStorage:
description: StorageRequest defines the storage size required
for this PVC, e.g., 1Gi, 100Mi. It specifies the storage capacity
needed as part of ResourceRequirements.
pattern: ^[0-9]+(\.[0-9]+)?(Gi|Mi)$
type: string
storageClassName:
description: StorageClassName specifies the StorageClass name
to which this persistent volume belongs, e.g., manual. It allows
the PVC to use the characteristics defined by the StorageClass.
type: string
volumeMode:
description: VolumeMode specifies whether the volume should be
used with a formatted filesystem (Filesystem) or remain in raw
block state (Block). The Filesystem value is implied when not
included. "Block" means the volume will not be formatted with
a filesystem and will remain a raw block device. "Filesystem" means
the volume will be or is formatted with a filesystem.
type: string
type: object
tasks:
description: Tasks is an ordered list of tasks in the pipeline, containing
detailed information about each task. The tasks will be executed
Expand Down
33 changes: 31 additions & 2 deletions pkg/apis/pipeline/v1alpha1/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,39 @@ type PipelineSpec struct {
// The tasks will be executed in the order they are listed.
Tasks []PipelineTask `json:"tasks"`

// SharedWorkspace is the name of the PVC. If not specified, a PVC with the Pipeline's name as prefix will be created by default.
// SharedWorkspace is the config of the PVC where task using
// The PersistentVolumeClaim with this config will be created for each pipeline execution
// it allows the user to specify e.g. size and StorageClass for the volume.
// If not set, Kurator will create a PVC named Pipeline.name using default config
// +optional
SharedWorkspace *string `json:"sharedWorkspace,omitempty"`
SharedWorkspace *VolumeClaimTemplate `json:"sharedWorkspace,omitempty"`
}

// VolumeClaimTemplate is the configuration for the volume claim template in pipeline execution.
// For more details, see https://github.com/kubernetes/api/blob/master/core/v1/types.go
type VolumeClaimTemplate struct {
// AccessMode determines the access modes for the volume, e.g., ReadWriteOnce.
// This affects how the volume can be mounted.
// "ReadWriteOnce" can be mounted in read/write mode to exactly 1 host
// "ReadOnlyMany" can be mounted in read-only mode to many hosts
// "ReadWriteMany" can be mounted in read/write mode to many hosts
// "ReadWriteOncePod" can be mounted in read/write mode to exactly 1 pod, cannot be used in combination with other access modes
AccessMode corev1.PersistentVolumeAccessMode `json:"accessMode,omitempty"`

// StorageRequest defines the storage size required for this PVC, e.g., 1Gi, 100Mi.
// It specifies the storage capacity needed as part of ResourceRequirements.
// +kubebuilder:validation:Pattern="^[0-9]+(\\.[0-9]+)?(Gi|Mi)$"
StorageRequest string `json:"requestsStorage,omitempty"`

// StorageClassName specifies the StorageClass name to which this persistent volume belongs, e.g., manual.
// It allows the PVC to use the characteristics defined by the StorageClass.
StorageClassName string `json:"storageClassName,omitempty"`

// VolumeMode specifies whether the volume should be used with a formatted filesystem (Filesystem)
// or remain in raw block state (Block). The Filesystem value is implied when not included.
// "Block" means the volume will not be formatted with a filesystem and will remain a raw block device.
// "Filesystem" means the volume will be or is formatted with a filesystem.
VolumeMode corev1.PersistentVolumeMode `json:"volumeMode,omitempty"`
}

type PipelineTask struct {
Expand Down
18 changes: 17 additions & 1 deletion pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2430676

Please sign in to comment.