Skip to content

Commit

Permalink
Added host_pid field to pod resource.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Santamaria committed Mar 29, 2019
1 parent 2a3d4b1 commit 974ce6d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/kubernetes/core/v1/pod/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
7 changes: 7 additions & 0 deletions internal/kubernetes/core/v1/pod/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
},
},
},
}
Expand Down
4 changes: 4 additions & 0 deletions internal/kubernetes/core/v1/pod/flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 974ce6d

Please sign in to comment.