Skip to content

Commit c8ad1b5

Browse files
committed
add restart_policy to init_container in order to support sidecars
copied from hashicorp#2449
1 parent 9d63698 commit c8ad1b5

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.changelog/2449.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
`kubernetes/schema_container.go`: add support of `restart_policy` option for sidecar init containers
3+
```

kubernetes/schema_container.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,19 @@ func containerFields(isUpdatable bool) map[string]*schema.Schema {
602602
Schema: resourcesFieldV1(isUpdatable),
603603
},
604604
},
605+
"restart_policy": {
606+
Type: schema.TypeString,
607+
Optional: true,
608+
Computed: isComputed,
609+
ForceNew: !isUpdatable,
610+
Default: conditionalDefault(!isComputed, string(corev1.RestartPolicyAlways)),
611+
Description: "Restart policy for init container. One of Always, OnFailure, Never. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy.",
612+
ValidateFunc: validation.StringInSlice([]string{
613+
string(corev1.RestartPolicyAlways),
614+
string(corev1.RestartPolicyOnFailure),
615+
string(corev1.RestartPolicyNever),
616+
}, false),
617+
},
605618
"security_context": {
606619
Type: schema.TypeList,
607620
Optional: true,

0 commit comments

Comments
 (0)