Skip to content

Commit

Permalink
feat: add pvc config
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Dec 11, 2024
1 parent b70eb1b commit ab9169e
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/testworkflows/v1/testworkflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ type TestWorkflowSpec struct {

// steps to run at the end of the workflow
After []Step `json:"after,omitempty" expr:"include"`

// list of accompanying permanent volume claims
Pvcs map[string]TestWorkflowPvcConfig `json:"pvcs,omitempty" expr:"template,include"`
}

// TemplateRef is the reference for the template inclusion
Expand Down
3 changes: 3 additions & 0 deletions api/testworkflows/v1/testworkflowtemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ type TestWorkflowTemplateSpec struct {

// steps to run at the end of the workflow
After []IndependentStep `json:"after,omitempty" expr:"include"`

// list of accompanying permanent volume claims
Pvcs map[string]TestWorkflowPvcConfig `json:"pvcs,omitempty" expr:"template,include"`
}

// +kubebuilder:object:root=true
Expand Down
16 changes: 16 additions & 0 deletions api/testworkflows/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)

Expand Down Expand Up @@ -230,3 +231,18 @@ type TestWorkflowTagSchema struct {
// test workflow execution tags
Tags map[string]string `json:"tags,omitempty" expr:"template"`
}

type TestWorkflowPvcConfig struct {
// Specify whether the pvc should be shared between test workflow pods
Shared bool `json:"shared,omitempty" expr:"ignore"`
// Access mode for claim storage. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes
AccessModes []string `json:"accessModes,omitempty" expr:"template"`
// Volume mode indicates the consumption of the volume as either a filesystem or block device. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#volume-mode
VolumeMode string `json:"volumeMode,omitempty" expr:"template"`
// expected resources for the pvc
Resources *Resources `json:"resources,omitempty" expr:"include"`
// Storage class name specifies the name of a StorageClass. More info: https://kubernetes.io/docs/concepts/storage/storage-classes/
StorageClassName string `json:"storageClassName,omitempty" expr:"template"`
// selector is used to identify a group of volumes based on their metadata labels
Selector *metav1.LabelSelector `json:"selector,omitempty" expr:"include"`
}
44 changes: 44 additions & 0 deletions api/testworkflows/v1/zz_generated.deepcopy.go

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

82 changes: 82 additions & 0 deletions config/crd/bases/testworkflows.testkube.io_testworkflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3929,6 +3929,88 @@ spec:
volumes:
x-kubernetes-preserve-unknown-fields: true
type: object
pvcs:
additionalProperties:
properties:
accessModes:
description: 'Access mode for claim storage. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes'
items:
type: string
type: array
resources:
description: expected resources for the pvc
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
description: resource limits for the container
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
description: resource requests for the container
type: object
type: object
selector:
description: selector is used to identify a group of volumes based on their metadata labels
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
shared:
description: Specify whether the pvc should be shared between test workflow pods
type: boolean
storageClassName:
description: 'Storage class name specifies the name of a StorageClass. More info: https://kubernetes.io/docs/concepts/storage/storage-classes/'
type: string
volumeMode:
description: 'Volume mode indicates the consumption of the volume as either a filesystem or block device. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#volume-mode'
type: string
type: object
description: list of accompanying permanent volume claims
type: object
services:
additionalProperties:
properties:
Expand Down

0 comments on commit ab9169e

Please sign in to comment.