@@ -158,12 +158,63 @@ type Task struct {
158
158
// Container is the main container image to run in the pod
159
159
Container * corev1.Container `json:"container,omitempty"`
160
160
161
- // Volumes is a list of volumes that can be mounted by containers in a template.
162
- // +patchStrategy=merge
161
+ // +optional
163
162
// +patchMergeKey=name
164
- Volumes []corev1.Volume `json:"volumes,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
163
+ // +patchStrategy=merge,retainKeys
164
+ Volumes []corev1.Volume `json:"volumes,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
165
+
166
+ // +optional
167
+ TerminationGracePeriodSeconds * int64 `json:"terminationGracePeriodSeconds,omitempty"`
168
+
169
+ // +optional
170
+ ActiveDeadlineSeconds * int64 `json:"activeDeadlineSeconds,omitempty"`
171
+
172
+ // +optional
173
+ // +mapType=atomic
174
+ NodeSelector map [string ]string `json:"nodeSelector,omitempty"`
175
+
176
+ // +optional
177
+ ServiceAccountName string `json:"serviceAccountName,omitempty"`
178
+
179
+ // +optional
180
+ AutomountServiceAccountToken * bool `json:"automountServiceAccountToken,omitempty"`
181
+
182
+ // +optional
183
+ SecurityContext * corev1.PodSecurityContext `json:"securityContext,omitempty"`
165
184
166
- // TODO: maybe we could specify parameters in other ways, like loading context from file
185
+ // +optional
186
+ // +patchMergeKey=name
187
+ // +patchStrategy=merge
188
+ ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
189
+
190
+ // +optional
191
+ Affinity * corev1.Affinity `json:"affinity,omitempty"`
192
+
193
+ // +optional
194
+ Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
195
+
196
+ // +optional
197
+ // +patchMergeKey=topologyKey
198
+ // +patchStrategy=merge
199
+ // +listType=map
200
+ // +listMapKey=topologyKey
201
+ // +listMapKey=whenUnsatisfiable
202
+ TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty" patchStrategy:"merge" patchMergeKey:"topologyKey"`
203
+ }
204
+
205
+ func (t * Task ) PodSpec () corev1.PodSpec {
206
+ return corev1.PodSpec {
207
+ Volumes : t .Volumes ,
208
+ TerminationGracePeriodSeconds : t .TerminationGracePeriodSeconds ,
209
+ ActiveDeadlineSeconds : t .ActiveDeadlineSeconds ,
210
+ NodeSelector : t .NodeSelector ,
211
+ ServiceAccountName : t .ServiceAccountName ,
212
+ AutomountServiceAccountToken : t .AutomountServiceAccountToken ,
213
+ SecurityContext : t .SecurityContext ,
214
+ ImagePullSecrets : t .ImagePullSecrets ,
215
+ Affinity : t .Affinity ,
216
+ TopologySpreadConstraints : t .TopologySpreadConstraints ,
217
+ }
167
218
}
168
219
169
220
// +kubebuilder:object:root=true
0 commit comments