Skip to content

Commit

Permalink
Only use the smart default for AMI at creation time. (#114)
Browse files Browse the repository at this point in the history
When we use the "smart default" to pick the most recent EKS-optimized AMI, we now also mark the image as `ignoreChanges` to ensure that we do not pick up new "smart defaults" later.  Users can still explicitly specify an `amiID`, and if they do this will also remove the `ignoreChanges` annotation so that the change will be applied.

Fixes #88.
  • Loading branch information
lukehoban committed May 1, 2019
1 parent a160027 commit 156c750
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,9 @@

### Improvements

- fix(ami): only apply AMI smart-default selection on creation
[#114](https://github.com/pulumi/pulumi-eks/pull/114)

## 0.18.3 (Release April 25, 2019)

### Improvements
Expand Down
12 changes: 8 additions & 4 deletions nodejs/eks/nodegroup.ts
Expand Up @@ -108,9 +108,10 @@ export interface NodeGroupBaseOptions {
maxSize?: pulumi.Input<number>;

/**
* The AMI to use for worker nodes. Defaults to the value of Amazon EKS - Optimized AMI if no value is provided.
* More information about the AWS eks optimized ami is available at https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami.html.
* Use the information provided by AWS if you want to build your own AMI.
* The AMI to use for worker nodes. Defaults to the current value of Amazon EKS - Optimized AMI at time of resource
* creation if no value is provided. More information about the AWS eks optimized ami is available at
* https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami.html. Use the information provided by AWS if
* you want to build your own AMI.
*/
amiId?: pulumi.Input<string>;

Expand Down Expand Up @@ -327,6 +328,7 @@ ${customUserData}
});

let amiId: pulumi.Input<string> = args.amiId!;
let ignoreChanges: string[] = [];
const version: pulumi.Input<string> = args.version!;
if (args.amiId === undefined) {
const filters: { name: string; values: string[]}[] = [
Expand Down Expand Up @@ -381,6 +383,8 @@ ${customUserData}
throw new Error("No Linux AMI Id was found.");
}
amiId = bestAmiId;
// When we automatically pick an image to use, we want to ignore any changes to this later by default.
ignoreChanges = ["imageId"];
}

// Enable auto-assignment of public IP addresses on worker nodes for
Expand All @@ -405,7 +409,7 @@ ${customUserData}
deleteOnTermination: true,
},
userData: userdata,
}, { parent: parent });
}, { parent: parent, ignoreChanges: ignoreChanges });

const workerSubnetIds = args.nodeSubnetIds ? pulumi.output(args.nodeSubnetIds) : pulumi.output(core.subnetIds).apply(ids => computeWorkerSubnets(parent, ids));
if (args.desiredCapacity === undefined) {
Expand Down
4 changes: 2 additions & 2 deletions nodejs/eks/package.json
Expand Up @@ -11,9 +11,9 @@
"homepage": "https://pulumi.io",
"repository": "https://github.com/pulumi/pulumi-eks",
"dependencies": {
"@pulumi/aws": "^0.18.0",
"@pulumi/aws": "^0.18.3",
"@pulumi/kubernetes": "^0.21.0",
"@pulumi/pulumi": "^0.17.4",
"@pulumi/pulumi": "^0.17.8",
"which": "^1.3.1"
},
"devDependencies": {
Expand Down

0 comments on commit 156c750

Please sign in to comment.