Skip to content

Commit 24157b3

Browse files
committed
add initContainer resource
1 parent 40b573b commit 24157b3

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

api/disaggregated/v1/types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ type SystemInitialization struct {
226226

227227
// Arguments to the entrypoint.
228228
Args []string `json:"args,omitempty"`
229+
230+
// defines the specification of resource cpu and mem for Custom initContainer.
231+
// the default behavior of the operator `initContainer` does not require resource constraints.
232+
// ep: {"requests":{"cpu": 4, "memory": "16Gi"},"limits":{"cpu":4,"memory":"16Gi"}}
233+
corev1.ResourceRequirements `json:",inline"`
229234
}
230235

231236
// PersistentVolume defines volume information and container mount information.

api/doris/v1/types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,11 @@ type SystemInitialization struct {
281281

282282
// Arguments to the entrypoint.
283283
Args []string `json:"args,omitempty"`
284+
285+
// defines the specification of resource cpu and mem for Custom initContainer.
286+
// the default behavior of the operator `initContainer` does not require resource constraints.
287+
// ep: {"requests":{"cpu": 4, "memory": "16Gi"},"limits":{"cpu":4,"memory":"16Gi"}}
288+
corev1.ResourceRequirements `json:",inline"`
284289
}
285290

286291
// PersistentVolume defines volume information and container mount information.

pkg/common/utils/resource/pod.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ func constructDisaggregatedInitContainers(skipDefaultInit bool, componentType dv
285285
Command: si.Command,
286286
ImagePullPolicy: corev1.PullIfNotPresent,
287287
Args: si.Args,
288+
Resources: si.ResourceRequirements,
288289
SecurityContext: &corev1.SecurityContext{
289290
Privileged: &enablePrivileged,
290291
},
@@ -404,6 +405,7 @@ func mergeEnvs(src []corev1.EnvVar, dst []corev1.EnvVar) []corev1.EnvVar {
404405
return dst
405406
}
406407

408+
// for DCR
407409
func newBaseInitContainer(name string, si *v1.SystemInitialization) corev1.Container {
408410
enablePrivileged := true
409411
initImage := si.InitImage
@@ -416,6 +418,7 @@ func newBaseInitContainer(name string, si *v1.SystemInitialization) corev1.Conta
416418
Command: si.Command,
417419
ImagePullPolicy: corev1.PullIfNotPresent,
418420
Args: si.Args,
421+
Resources: si.ResourceRequirements,
419422
SecurityContext: &corev1.SecurityContext{
420423
Privileged: &enablePrivileged,
421424
},
@@ -1219,6 +1222,7 @@ func constructAffinity(dcrAffinity *corev1.Affinity, componentType v1.ComponentT
12191222
return affinity
12201223
}
12211224

1225+
// for DDC and DCR
12221226
func constructBeDefaultInitContainer(defaultImage string) corev1.Container {
12231227
return newBaseInitContainer(
12241228
"default-init",

0 commit comments

Comments
 (0)