Skip to content

Commit

Permalink
update tags doc
Browse files Browse the repository at this point in the history
- Document that tags are applied to created volumes as well
- Reword to indicate that we both merge & override
  • Loading branch information
tzneal committed Mar 3, 2022
1 parent 761554c commit 995987f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
21 changes: 21 additions & 0 deletions pkg/cloudprovider/aws/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,27 @@ var _ = Describe("Allocation", func() {
ExpectTags(createFleetInput.TagSpecifications[1].Tags, provider.Tags)
})

It("should override default tag names", func() {
// these tags are defaulted, so ensure users can override them
provider.Tags = map[string]string{
v1alpha5.ProvisionerNameLabelKey: "myprovisioner",
"Name": "myname",
}

pod := ExpectProvisioned(ctx, env.Client, selectionController, provisioners, ProvisionerWithProvider(provisioner, provider), test.UnschedulablePod())[0]
ExpectScheduled(ctx, env.Client, pod)
Expect(fakeEC2API.CalledWithCreateFleetInput.Cardinality()).To(Equal(1))
createFleetInput := fakeEC2API.CalledWithCreateFleetInput.Pop().(*ec2.CreateFleetInput)
Expect(createFleetInput.TagSpecifications).To(HaveLen(2))

// tags should be included in both the instance and volume tag specification
Expect(*createFleetInput.TagSpecifications[0].ResourceType).To(Equal(ec2.ResourceTypeInstance))
ExpectTags(createFleetInput.TagSpecifications[0].Tags, provider.Tags)

Expect(*createFleetInput.TagSpecifications[1].ResourceType).To(Equal(ec2.ResourceTypeVolume))
ExpectTags(createFleetInput.TagSpecifications[1].Tags, provider.Tags)
})

It("should default to a generated launch template", func() {
pod := ExpectProvisioned(ctx, env.Client, selectionController, provisioners, provisioner, test.UnschedulablePod())[0]
ExpectScheduled(ctx, env.Client, pod)
Expand Down
15 changes: 8 additions & 7 deletions website/content/en/preview/AWS/provisioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,15 @@ Select security groups by name using a wildcard:

### Tags

Tags will be added to every EC2 Instance launched by this provisioner.
Karpenter adds tags to both the EC2 Instances and attached volumes launched by provisioners. The default set of AWS tags are listed below.

```
Name: karpenter.sh/cluster/<cluster-name>/provisioner/<provisioner-name>
karpenter.sh/cluster/<cluster-name>: owned
kubernetes.io/cluster/<cluster-name>: owned
```

Additional tags can be added in the provider tags section which are merged with and can override the default tag values.
```
spec:
provider:
Expand All @@ -124,12 +131,6 @@ spec:
dev.corp.net/app: Calculator
dev.corp.net/team: MyTeam
```
Note: Karpenter will set the default AWS tags listed below, but these can be overridden in the tags section above.
```
Name: karpenter.sh/cluster/<cluster-name>/provisioner/<provisioner-name>
karpenter.sh/cluster/<cluster-name>: owned
kubernetes.io/cluster/<cluster-name>: owned
```

### Metadata Options

Expand Down

0 comments on commit 995987f

Please sign in to comment.