diff --git a/internal/kubernetes/core/v1/pod/expand.go b/internal/kubernetes/core/v1/pod/expand.go index e1dabf32..ff802a35 100644 --- a/internal/kubernetes/core/v1/pod/expand.go +++ b/internal/kubernetes/core/v1/pod/expand.go @@ -83,5 +83,9 @@ func Expand(in []interface{}) (corev1.PodTemplateSpec, error) { } } + if val, ok := raw[FieldHostPID]; ok { + template.Spec.HostPID = val.(bool) + } + return template, nil } diff --git a/internal/kubernetes/core/v1/pod/fields.go b/internal/kubernetes/core/v1/pod/fields.go index 79f33d4d..d7556663 100644 --- a/internal/kubernetes/core/v1/pod/fields.go +++ b/internal/kubernetes/core/v1/pod/fields.go @@ -22,6 +22,8 @@ const ( FieldServiceAccount = "service_account" // FieldPullSecret is a field identifier. FieldPullSecret = "pull_secret" + // FieldHostPID is a field identifier. + FieldHostPID = "host_pid" ) // Fields which define a Pod. @@ -52,6 +54,11 @@ func Fields() *schema.Schema { Type: schema.TypeString, Optional: true, }, + FieldHostPID: { + Type: schema.TypeBool, + Description: "Use the host’s pid namespace.", + Optional: true, + }, }, }, } diff --git a/internal/kubernetes/core/v1/pod/flatten.go b/internal/kubernetes/core/v1/pod/flatten.go index f6e974ca..b50af4bd 100644 --- a/internal/kubernetes/core/v1/pod/flatten.go +++ b/internal/kubernetes/core/v1/pod/flatten.go @@ -41,6 +41,10 @@ func Flatten(template corev1.PodTemplateSpec) []interface{} { row[FieldPullSecret] = template.Spec.ImagePullSecrets[0].Name } + if template.Spec.HostPID { + row[FieldHostPID] = template.Spec.HostPID + } + out[0] = row return out