diff --git a/cronjob/cronjob.go b/cronjob/cronjob.go index 736ab07e..be3421a6 100644 --- a/cronjob/cronjob.go +++ b/cronjob/cronjob.go @@ -39,6 +39,11 @@ func Resource() *schema.Resource { Description: "How often to run this CronJob.", Required: true, }, + "host_pid": { + Type: schema.TypeBool, + Description: "Use the host’s pid namespace.", + Optional: true, + }, "service_account": { Type: schema.TypeString, Description: "ServiceAccount to associate with this CronJob.", @@ -58,6 +63,7 @@ func generateCronJob(d *schema.ResourceData) (batchv1beta1.CronJob, error) { namespace = d.Get("namespace").(string) labels = d.Get("labels").(map[string]interface{}) schedule = d.Get("schedule").(string) + hostPid = d.Get("host_pid").(bool) serviceaccount = d.Get("service_account").(string) aliases = d.Get("hostaliases").([]interface{}) containers = d.Get("container").([]interface{}) @@ -94,6 +100,7 @@ func generateCronJob(d *schema.ResourceData) (batchv1beta1.CronJob, error) { Volumes: volumeList, ServiceAccountName: serviceaccount, HostAliases: hostaliases.Expand(aliases), + HostPID: hostPid, }, }, }, diff --git a/cronjob/read.go b/cronjob/read.go index 97a2aba0..ab3d5060 100644 --- a/cronjob/read.go +++ b/cronjob/read.go @@ -33,6 +33,7 @@ func resourceRead(d *schema.ResourceData, m interface{}) error { d.Set("namespace", cronJob.ObjectMeta.Namespace) d.Set("labels", cronJob.ObjectMeta.Labels) d.Set("schedule", cronJob.Spec.Schedule) + d.Set("host_pid", cronJob.Spec.JobTemplate.Spec.Template.Spec.HostPID) d.Set("service_account", cronJob.Spec.JobTemplate.Spec.Template.Spec.ServiceAccountName) d.Set("container", container.Flatten(cronJob.Spec.JobTemplate.Spec.Template.Spec.Containers)) d.Set("hostaliases", hostaliases.Flatten(cronJob.Spec.JobTemplate.Spec.Template.Spec.HostAliases)) diff --git a/daemonset/daemonset.go b/daemonset/daemonset.go index fcdc5d81..8317a639 100644 --- a/daemonset/daemonset.go +++ b/daemonset/daemonset.go @@ -39,6 +39,11 @@ func Resource() *schema.Resource { Optional: true, Default: false, }, + "host_pid": { + Type: schema.TypeBool, + Description: "Use the host’s pid namespace.", + Optional: true, + }, "service_account": { Type: schema.TypeString, Description: "ServiceAccount to associate with this DaemonSet.", @@ -59,6 +64,7 @@ func generateDaemonSet(d *schema.ResourceData) (appsv1beta2.DaemonSet, error) { namespace = d.Get("namespace").(string) labels = d.Get("labels").(map[string]interface{}) hostNetwork = d.Get("host_network").(bool) + hostPid = d.Get("host_pid").(bool) serviceAccount = d.Get("service_account").(string) initContainer = d.Get("init_container").([]interface{}) aliases = d.Get("hostaliases").([]interface{}) @@ -101,6 +107,7 @@ func generateDaemonSet(d *schema.ResourceData) (appsv1beta2.DaemonSet, error) { InitContainers: initContainerList, Containers: containerList, Volumes: volumeList, + HostPID: hostPid, HostAliases: hostaliases.Expand(aliases), }, }, diff --git a/daemonset/read.go b/daemonset/read.go index 56023962..ac232d9c 100644 --- a/daemonset/read.go +++ b/daemonset/read.go @@ -31,6 +31,7 @@ func resourceRead(d *schema.ResourceData, m interface{}) error { d.Set("name", daemonset.ObjectMeta.Name) d.Set("namespace", daemonset.ObjectMeta.Namespace) + d.Set("host_pid", daemonset.Spec.Template.Spec.HostPID) d.Set("service_account", daemonset.Spec.Template.Spec.ServiceAccountName) d.Set("labels", daemonset.ObjectMeta.Labels) d.Set("hostaliases", hostaliases.Flatten(daemonset.Spec.Template.Spec.HostAliases)) diff --git a/deployment/deployment.go b/deployment/deployment.go index 41da5cf8..cb473965 100644 --- a/deployment/deployment.go +++ b/deployment/deployment.go @@ -37,6 +37,11 @@ func Resource() *schema.Resource { Description: "ServiceAccount to associate with this Deployment.", Optional: true, }, + "host_pid": { + Type: schema.TypeBool, + Description: "Use the host’s pid namespace.", + Optional: true, + }, "labels": label.Fields(), "container": container.Fields(), "hostaliases": hostaliases.Fields(), @@ -49,6 +54,7 @@ func generateDeployment(d *schema.ResourceData) (appsv1beta2.Deployment, error) var ( name = d.Get("name").(string) namespace = d.Get("namespace").(string) + hostPid = d.Get("host_pid").(bool) serviceaccount = d.Get("service_account").(string) labels = d.Get("labels").(map[string]interface{}) aliases = d.Get("hostaliases").([]interface{}) @@ -85,6 +91,7 @@ func generateDeployment(d *schema.ResourceData) (appsv1beta2.Deployment, error) Containers: containerList, Volumes: volumeList, HostAliases: hostaliases.Expand(aliases), + HostPID: hostPid, }, }, }, diff --git a/deployment/read.go b/deployment/read.go index 62bf8fd0..be4874c2 100644 --- a/deployment/read.go +++ b/deployment/read.go @@ -37,6 +37,7 @@ func resourceRead(d *schema.ResourceData, m interface{}) error { d.Set("name", deployment.ObjectMeta.Name) d.Set("namespace", deployment.ObjectMeta.Namespace) + d.Set("host_pid", deployment.Spec.Template.Spec.HostPID) d.Set("service_account", deployment.Spec.Template.Spec.ServiceAccountName) d.Set("labels", deployment.ObjectMeta.Labels) d.Set("image", deployment.Spec.Template.Spec.Containers[0].Image)