Skip to content

Commit

Permalink
Cleanup replication controller spec expander function
Browse files Browse the repository at this point in the history
  • Loading branch information
pdecat committed Nov 14, 2018
1 parent 38234d5 commit 32432ef
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions kubernetes/structures_replication_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ func expandReplicationControllerSpec(rc []interface{}, useDeprecatedSpecFields b

func expandReplicationControllerTemplate(rct []interface{}, selector map[string]string, useDeprecatedSpecFields bool) (v1.PodTemplateSpec, error) {
obj := v1.PodTemplateSpec{}
in := rct[0].(map[string]interface{})

// Get user defined metadata
obj.ObjectMeta = expandMetadata(in["metadata"].([]interface{}))

if useDeprecatedSpecFields {
// Add labels from selector to ensure proper selection of pods by the replication controller for deprecated use case
Expand All @@ -81,6 +77,11 @@ func expandReplicationControllerTemplate(rct []interface{}, selector map[string]
}
obj.Spec = podSpecDeprecated
} else {
in := rct[0].(map[string]interface{})

// Get user defined metadata
obj.ObjectMeta = expandMetadata(in["metadata"].([]interface{}))

// Get pod spec from new fields
podSpec, err := expandPodSpec(in["spec"].([]interface{}))
if err != nil {
Expand Down

0 comments on commit 32432ef

Please sign in to comment.