Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #358 from mumoshu/fix-custom-settings-for-node-pools
Browse files Browse the repository at this point in the history
Fix customSettings unavailability for node pools
  • Loading branch information
mumoshu authored Feb 27, 2017
2 parents 9b0249e + c6a0a5d commit 2be75bc
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
6 changes: 5 additions & 1 deletion core/controlplane/config/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ worker:
# enabled: true
# # Max number of nodes concurrently updated
# maxBatchSize: 1
#
# # Other less common customizations per node pool
# # All these settings default to the top-level ones
# keyName:
Expand All @@ -243,6 +244,9 @@ worker:
# AwsCliImageRepo: quay.io/coreos/awscli
# awsCliTag: edge
# sshAuthorizedKeys:
# # User-provided YAML map available in control-plane's stack-template.json
# customSettings:
# key1: [ 1, 2, 3 ]

# Maximum time to wait for worker creation
#workerCreateTimeout: PT15M
Expand Down Expand Up @@ -626,6 +630,6 @@ worker:
# Name: "Kubernetes"
# Environment: "Production"

# User-provided YAML map available in stack-template.json
# User-provided YAML map available in control-plane's stack-template.json
#customSettings:
# key1: [ 1, 2, 3 ]
7 changes: 4 additions & 3 deletions model/node_pool_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ type NodePoolConfig struct {
InstanceType string `yaml:"instanceType,omitempty"`
ManagedIamRoleName string `yaml:"managedIamRoleName,omitempty"`
RootVolume `yaml:",inline"`
SpotPrice string `yaml:"spotPrice,omitempty"`
SecurityGroupIds []string `yaml:"securityGroupIds,omitempty"`
Tenancy string `yaml:"tenancy,omitempty"`
SpotPrice string `yaml:"spotPrice,omitempty"`
SecurityGroupIds []string `yaml:"securityGroupIds,omitempty"`
Tenancy string `yaml:"tenancy,omitempty"`
CustomSettings map[string]interface{} `yaml:"customSettings,omitempty"`
}

type ClusterAutoscaler struct {
Expand Down
42 changes: 42 additions & 0 deletions test/integration/maincluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,48 @@ availabilityZone: us-west-1c
assertConfig []ConfigTester
assertCluster []ClusterTester
}{
{
context: "WithCustomSettings",
configYaml: minimalValidConfigYaml + `
customSettings:
stack-type: control-plane
worker:
nodePools:
- name: pool1
customSettings:
stack-type: node-pool
`,
assertConfig: []ConfigTester{
hasDefaultEtcdSettings,
asgBasedNodePoolHasWaitSignalEnabled,
func(c *config.Config, t *testing.T) {
p := c.NodePools[0]

{
expected := map[string]interface{}{
"stack-type": "control-plane",
}
actual := c.CustomSettings
if !reflect.DeepEqual(expected, actual) {
t.Errorf("customSettings didn't match : expected=%v actual=%v", expected, actual)
}
}

{
expected := map[string]interface{}{
"stack-type": "node-pool",
}
actual := p.CustomSettings
if !reflect.DeepEqual(expected, actual) {
t.Errorf("customSettings didn't match : expected=%v actual=%v", expected, actual)
}
}
},
},
assertCluster: []ClusterTester{
hasDefaultCluster,
},
},
{
context: "WithExperimentalFeatures",
configYaml: minimalValidConfigYaml + `
Expand Down

0 comments on commit 2be75bc

Please sign in to comment.