Skip to content

Commit

Permalink
Move expandPodSecurityContext back to its original place
Browse files Browse the repository at this point in the history
  • Loading branch information
pdecat committed Oct 29, 2018
1 parent 8eef9c0 commit 61d3085
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions kubernetes/structures_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,32 +313,6 @@ func flattenSecretVolumeSource(in *v1.SecretVolumeSource) []interface{} {

// Expanders

func expandPodSecurityContext(l []interface{}) *v1.PodSecurityContext {
if len(l) == 0 || l[0] == nil {
return &v1.PodSecurityContext{}
}
in := l[0].(map[string]interface{})
obj := &v1.PodSecurityContext{}
if v, ok := in["fs_group"].(int); ok {
obj.FSGroup = ptrToInt64(int64(v))
}
if v, ok := in["run_as_non_root"].(bool); ok {
obj.RunAsNonRoot = ptrToBool(v)
}
if v, ok := in["run_as_user"].(int); ok {
obj.RunAsUser = ptrToInt64(int64(v))
}
if v, ok := in["supplemental_groups"].(*schema.Set); ok {
obj.SupplementalGroups = schemaSetToInt64Array(v)
}

if v, ok := in["se_linux_options"].([]interface{}); ok && len(v) > 0 {
obj.SELinuxOptions = expandSeLinuxOptions(v)
}

return obj
}

func expandPodSpec(p []interface{}) (v1.PodSpec, error) {
obj := v1.PodSpec{}
if len(p) == 0 || p[0] == nil {
Expand Down Expand Up @@ -435,6 +409,32 @@ func expandPodSpec(p []interface{}) (v1.PodSpec, error) {
return obj, nil
}

func expandPodSecurityContext(l []interface{}) *v1.PodSecurityContext {
if len(l) == 0 || l[0] == nil {
return &v1.PodSecurityContext{}
}
in := l[0].(map[string]interface{})
obj := &v1.PodSecurityContext{}
if v, ok := in["fs_group"].(int); ok {
obj.FSGroup = ptrToInt64(int64(v))
}
if v, ok := in["run_as_non_root"].(bool); ok {
obj.RunAsNonRoot = ptrToBool(v)
}
if v, ok := in["run_as_user"].(int); ok {
obj.RunAsUser = ptrToInt64(int64(v))
}
if v, ok := in["supplemental_groups"].(*schema.Set); ok {
obj.SupplementalGroups = schemaSetToInt64Array(v)
}

if v, ok := in["se_linux_options"].([]interface{}); ok && len(v) > 0 {
obj.SELinuxOptions = expandSeLinuxOptions(v)
}

return obj
}

func expandSeLinuxOptions(l []interface{}) *v1.SELinuxOptions {
if len(l) == 0 || l[0] == nil {
return &v1.SELinuxOptions{}
Expand Down

0 comments on commit 61d3085

Please sign in to comment.