Skip to content

Commit 9c1206d

Browse files
rekfuki-f3grahambrereton-form3
authored andcommitted
feat: extends Task with additional PodSpec fields
Adds the following fields from the corev1.PodSpec in order to make the task pod more configurable: * RestartPolicy * RestartPolicy * ActiveDeadlineSeconds * NodeSelector * ServiceAccountName * AutomountServiceAccountToken * SecurityContext * ImagePullSecrets * Affinity * Tolerations * TopologySpreadConstraints
1 parent 72ab449 commit 9c1206d

File tree

14 files changed

+21650
-3139
lines changed

14 files changed

+21650
-3139
lines changed

.github/.licenserc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ header:
1414
- '**/*.json'
1515
- '**/*.log'
1616
- 'vendor/**'
17+
- 'api/vendor/**'
1718
- '**/go.mod'
1819
- '**/go.sum'
1920
- '**/go.work'

api/v1alpha1/workflow_types.go

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,63 @@ type Task struct {
157157
// Container is the main container image to run in the pod
158158
Container *corev1.Container `json:"container,omitempty"`
159159

160-
// Volumes is a list of volumes that can be mounted by containers in a template.
161-
// +patchStrategy=merge
160+
// +optional
162161
// +patchMergeKey=name
163-
Volumes []corev1.Volume `json:"volumes,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
162+
// +patchStrategy=merge,retainKeys
163+
Volumes []corev1.Volume `json:"volumes,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
164+
165+
// +optional
166+
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
167+
168+
// +optional
169+
ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"`
170+
171+
// +optional
172+
// +mapType=atomic
173+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
174+
175+
// +optional
176+
ServiceAccountName string `json:"serviceAccountName,omitempty"`
177+
178+
// +optional
179+
AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty"`
180+
181+
// +optional
182+
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
164183

165-
// TODO: maybe we could specify parameters in other ways, like loading context from file
184+
// +optional
185+
// +patchMergeKey=name
186+
// +patchStrategy=merge
187+
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
188+
189+
// +optional
190+
Affinity *corev1.Affinity `json:"affinity,omitempty"`
191+
192+
// +optional
193+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
194+
195+
// +optional
196+
// +patchMergeKey=topologyKey
197+
// +patchStrategy=merge
198+
// +listType=map
199+
// +listMapKey=topologyKey
200+
// +listMapKey=whenUnsatisfiable
201+
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty" patchStrategy:"merge" patchMergeKey:"topologyKey"`
202+
}
203+
204+
func (t *Task) PodSpec() corev1.PodSpec {
205+
return corev1.PodSpec{
206+
Volumes: t.Volumes,
207+
TerminationGracePeriodSeconds: t.TerminationGracePeriodSeconds,
208+
ActiveDeadlineSeconds: t.ActiveDeadlineSeconds,
209+
NodeSelector: t.NodeSelector,
210+
ServiceAccountName: t.ServiceAccountName,
211+
AutomountServiceAccountToken: t.AutomountServiceAccountToken,
212+
SecurityContext: t.SecurityContext,
213+
ImagePullSecrets: t.ImagePullSecrets,
214+
Affinity: t.Affinity,
215+
TopologySpreadConstraints: t.TopologySpreadConstraints,
216+
}
166217
}
167218

168219
// +kubebuilder:object:root=true

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/chaos-mesh.org_schedules.yaml

Lines changed: 1464 additions & 2 deletions
Large diffs are not rendered by default.

config/crd/bases/chaos-mesh.org_workflownodes.yaml

Lines changed: 3187 additions & 305 deletions
Large diffs are not rendered by default.

config/crd/bases/chaos-mesh.org_workflows.yaml

Lines changed: 1379 additions & 2 deletions
Large diffs are not rendered by default.

helm/chaos-mesh/crds/chaos-mesh.org_schedules.yaml

Lines changed: 1464 additions & 2 deletions
Large diffs are not rendered by default.

helm/chaos-mesh/crds/chaos-mesh.org_workflownodes.yaml

Lines changed: 3187 additions & 305 deletions
Large diffs are not rendered by default.

helm/chaos-mesh/crds/chaos-mesh.org_workflows.yaml

Lines changed: 1379 additions & 2 deletions
Large diffs are not rendered by default.

manifests/crd.yaml

Lines changed: 8219 additions & 2498 deletions
Large diffs are not rendered by default.

pkg/dashboard/swaggerdocs/docs.go

Lines changed: 354 additions & 1 deletion
Large diffs are not rendered by default.

pkg/dashboard/swaggerdocs/swagger.json

Lines changed: 354 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)