Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipeline api: add volumClaimTemplate #513

Merged
merged 2 commits into from
Dec 29, 2023
Merged

Conversation

Xieql
Copy link
Contributor

@Xieql Xieql commented Dec 11, 2023

What type of PR is this?

/kind api-change

What this PR does:

Add complete pvc config about SharedWorkspace,rather than a string.

Why we need it:

Using a pre-created PVC (Persistent Volume Claim) in a pipeline then references it name is not recommended, as PVCs are meant to be linked with each specific pipeline execution instance, not the pipeline itself.

To simplify the user experience, only fields that have appeared in the Tekton Hub are included.

In total, there are only four configurations, among which almost only the RequestsStorage is a meaningful setting. The remaining three, even if configured, are almost always default settings.

Copy link

netlify bot commented Dec 11, 2023

Deploy Preview for kurator-dev canceled.

Name Link
🔨 Latest commit d4f155b
🔍 Latest deploy log https://app.netlify.com/sites/kurator-dev/deploys/658e6c53b790e8000869296e

@Xieql
Copy link
Contributor Author

Xieql commented Dec 12, 2023

/label tide/merge-method-squash

type VolumeClaimTemplate struct {
// AccessMode determines the access modes for the volume, e.g., ReadWriteOnce.
// This affects how the volume can be mounted.
AccessMode string `json:"accessMode,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Donot use string, please refer to k8s https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes

And its API: AccessModes []PersistentVolumeAccessMode , PersistentVolumeAccessMode is a type aliase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


// RequestsStorage defines the storage size required for this PVC, e.g., 1Gi, 100Mi.
// It specifies the storage capacity needed as part of ResourceRequirements.
RequestsStorage string `json:"requestsStorage,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you validate string with Gi, Mi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use Pattern like // +kubebuilder:validation:Pattern="^[0-9]+(\.[0-9]+)?(Gi|Mi)$"


// RequestsStorage defines the storage size required for this PVC, e.g., 1Gi, 100Mi.
// It specifies the storage capacity needed as part of ResourceRequirements.
RequestsStorage string `json:"requestsStorage,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/RequestsStorage/StorageRequest, it is singular

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


// 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.
VolumeMode string `json:"volumeMode,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above donot use a generic string type

Signed-off-by: Xieql <[email protected]>
@Xieql Xieql marked this pull request as ready for review December 29, 2023 06:58
@Xieql
Copy link
Contributor Author

Xieql commented Dec 29, 2023

@hzxuzhonghu PTAL

// 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"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not realize: isn't this a PVC spec. why do we redefine a new one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a pre-created PVC (Persistent Volume Claim) in a pipeline then references it name is not recommended, as PVCs are meant to be linked with each specific pipeline execution instance, not the pipeline itself.

@hzxuzhonghu
Copy link
Member

/lgtm
/approve

@kurator-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kurator-bot kurator-bot merged commit 2430676 into kurator-dev:main Dec 29, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants