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

Commit 8ec49a6

Browse files
authored
Merge pull request #14 from qqshfox/add_ami_id
allow to override the ami id of coreos
2 parents c186253 + 4e69331 commit 8ec49a6

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

cmd/kube-aws/command_init.go

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func init() {
3131
cmdInit.Flags().StringVar(&initOpts.AvailabilityZone, "availability-zone", "", "The AWS availability-zone to deploy to")
3232
cmdInit.Flags().StringVar(&initOpts.KeyName, "key-name", "", "The AWS key-pair for ssh access to nodes")
3333
cmdInit.Flags().StringVar(&initOpts.KMSKeyARN, "kms-key-arn", "", "The ARN of the AWS KMS key for encrypting TLS assets")
34+
cmdInit.Flags().StringVar(&initOpts.AmiId, "ami-id", "", "The AMI ID of CoreOS")
3435
}
3536

3637
func runCmdInit(cmd *cobra.Command, args []string) error {

config/config.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ type Cluster struct {
132132
Region string `yaml:"region,omitempty"`
133133
AvailabilityZone string `yaml:"availabilityZone,omitempty"`
134134
ReleaseChannel string `yaml:"releaseChannel,omitempty"`
135+
AmiId string `yaml:"amiId,omitempty"`
135136
ControllerCount int `yaml:"controllerCount,omitempty"`
136137
ControllerInstanceType string `yaml:"controllerInstanceType,omitempty"`
137138
ControllerRootVolumeType string `yaml:"controllerRootVolumeType,omitempty"`
@@ -225,9 +226,13 @@ func (c Cluster) Config() (*Config, error) {
225226
}
226227
}
227228

228-
var err error
229-
if config.AMI, err = getAMI(config.Region, config.ReleaseChannel); err != nil {
230-
return nil, fmt.Errorf("failed getting AMI for config: %v", err)
229+
if c.AmiId == "" {
230+
var err error
231+
if config.AMI, err = getAMI(config.Region, config.ReleaseChannel); err != nil {
232+
return nil, fmt.Errorf("failed getting AMI for config: %v", err)
233+
}
234+
} else {
235+
config.AMI = c.AmiId
231236
}
232237

233238
//Set logical name constants

config/templates/cluster.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ externalDNSName: {{.ExternalDNSName}}
1313
# See coreos.com/releases for more information
1414
#releaseChannel: stable
1515

16+
# The AMI ID of CoreOS.
17+
# If omitted, the latest AMI for the releaseChannel is used.
18+
#amiId: ""
19+
1620
# Set to true if you want kube-aws to create a Route53 A Record for you.
1721
#createRecordSet: false
1822

0 commit comments

Comments
 (0)