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

Node Pool Nested Stack Name #187

Merged
merged 1 commit into from
Jan 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (c *Cluster) stackProvisioner() *cfnstack.Provisioner {
]
}
`
return cfnstack.NewProvisioner(c.ClusterName, c.WorkerDeploymentSettings().StackTags(), stackPolicyBody, c.session)
return cfnstack.NewProvisioner(c.StackName(), c.WorkerDeploymentSettings().StackTags(), stackPolicyBody, c.session)
}

func (c *Cluster) Create(stackBody string, s3URI string) error {
Expand Down Expand Up @@ -209,7 +209,7 @@ func (c *Cluster) lockEtcdResources(cfSvc *cloudformation.CloudFormation, stackB

//Fetch and unmarshal existing stack resource defintions
res, err := cfSvc.GetTemplate(&cloudformation.GetTemplateInput{
StackName: aws.String(c.ClusterName),
StackName: aws.String(c.StackName()),
})
if err != nil {
return "", fmt.Errorf("error getting stack template: %v", err)
Expand Down Expand Up @@ -269,7 +269,7 @@ func (c *Cluster) Info() (*Info, error) {
resp, err := cfSvc.DescribeStackResource(
&cloudformation.DescribeStackResourceInput{
LogicalResourceId: aws.String("ElbAPIServer"),
StackName: aws.String(c.ClusterName),
StackName: aws.String(c.StackName()),
},
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ type Config struct {

// CloudFormation stack name which is unique in an AWS account.
// This is intended to be used to reference stack name from cloud-config as the target of awscli or cfn-bootstrap-tools commands e.g. `cfn-init` and `cfn-signal`
func (c Config) StackName() string {
func (c Cluster) StackName() string {
return c.ClusterName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Any specific reason to move this method from Config to Cluster? (I guess for now there's no specific reason/it doesn't relate to the main purpose of this PR but you just thought it might be better to do so?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only that StackName was not available in the context of Cluster functions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! I somehow missed from where the ClusterName field is coming.

}

Expand Down
2 changes: 1 addition & 1 deletion nodepool/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *Cluster) stackProvisioner() *cfnstack.Provisioner {
]
}`

return cfnstack.NewProvisioner(c.NodePoolName, c.WorkerDeploymentSettings().StackTags(), stackPolicyBody, c.session)
return cfnstack.NewProvisioner(c.StackName(), c.WorkerDeploymentSettings().StackTags(), stackPolicyBody, c.session)
}

func (c *Cluster) Create(stackBody string, s3URI string) error {
Expand Down
4 changes: 2 additions & 2 deletions nodepool/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ func (c ProvidedConfig) valid() error {

// CloudFormation stack name which is unique in an AWS account.
// This is intended to be used to reference stack name from cloud-config as the target of awscli or cfn-bootstrap-tools commands e.g. `cfn-init` and `cfn-signal`
func (c ComputedConfig) StackName() string {
return c.NodePoolName
func (c ProvidedConfig) StackName() string {
return c.ClusterName + "-" + c.NodePoolName
}

func (c ComputedConfig) VPCRef() string {
Expand Down