Skip to content

Commit

Permalink
PR Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ellistarn committed Jan 15, 2022
1 parent 660cfd6 commit b6ab892
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pkg/cloudprovider/aws/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (p *InstanceProvider) launchInstances(ctx context.Context, constraints *v1a
TagSpecifications: []*ec2.TagSpecification{
{
ResourceType: aws.String(ec2.ResourceTypeInstance),
Tags: v1alpha1.MergeTags(ctx, constraints.Tags),
Tags: v1alpha1.MergeTags(ctx, constraints.Tags, map[string]string{fmt.Sprintf("kubernetes.io/cluster/%s", injection.GetOptions(ctx).ClusterName): "owned"}),
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloudprovider/aws/launchtemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (p *LaunchTemplateProvider) createLaunchTemplate(ctx context.Context, optio
},
TagSpecifications: []*ec2.TagSpecification{{
ResourceType: aws.String(ec2.ResourceTypeLaunchTemplate),
Tags: v1alpha1.MergeTags(ctx, options.Tags, map[string]string{fmt.Sprintf("kubernetes.io/cluster/%s", injection.GetOptions(ctx).ClusterName): "owned"}),
Tags: v1alpha1.MergeTags(ctx, options.Tags),
}},
})
if err != nil {
Expand Down
16 changes: 3 additions & 13 deletions pkg/cloudprovider/aws/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ var _ = Describe("Allocation", func() {

BeforeEach(func() {
provider = &v1alpha1.AWS{
InstanceProfile: "test-instance-profile",
InstanceProfile: "test-instance-profile",
SubnetSelector: map[string]string{"foo": "bar"},
SecurityGroupSelector: map[string]string{"foo": "bar"},
}
provisioner = ProvisionerWithProvider(&v1alpha5.Provisioner{ObjectMeta: metav1.ObjectMeta{Name: strings.ToLower(randomdata.SillyName())}}, provider)
provisioner.SetDefaults(ctx)
Expand Down Expand Up @@ -478,18 +480,6 @@ var _ = Describe("Allocation", func() {
})
})
Context("Defaulting", func() {
It("should default subnetSelector", func() {
provisioner.SetDefaults(ctx)
constraints, err := v1alpha1.Deserialize(&provisioner.Spec.Constraints)
Expect(err).ToNot(HaveOccurred())
Expect(constraints.SubnetSelector).To(Equal(map[string]string{"kubernetes.io/cluster/test-cluster": "*"}))
})
It("should default securityGroupSelector", func() {
provisioner.SetDefaults(ctx)
constraints, err := v1alpha1.Deserialize(&provisioner.Spec.Constraints)
Expect(err).ToNot(HaveOccurred())
Expect(constraints.SecurityGroupSelector).To(Equal(map[string]string{"kubernetes.io/cluster/test-cluster": "*"}))
})
It("should default requirements", func() {
provisioner.SetDefaults(ctx)
Expect(provisioner.Spec.Requirements.CapacityTypes().UnsortedList()).To(ConsistOf(v1alpha1.CapacityTypeOnDemand))
Expand Down
7 changes: 4 additions & 3 deletions website/content/en/docs/getting-started/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,10 @@ shapes. Karpenter makes scheduling and provisioning decisions based on pod
attributes such as labels and affinity. In other words, Karpenter eliminates
the need to manage many different node groups.

Create a default provisioner using the command below. This provisioner
configures instances to connect to your cluster's endpoint and discovers
resources like subnets and security groups using the cluster's name.
Create a default provisioner using the command below.
This provisioner uses `securityGroupSelector` and `subnetSelector` to discover resources used to launch nodes.
We applied the tag `karpenter.sh/discovery` in the `eksctl` command above.
Depending how these resources are shared between clusters, you may need to use different tagging schemes.

The `ttlSecondsAfterEmpty` value configures Karpenter to terminate empty nodes.
This behavior can be disabled by leaving the value undefined.
Expand Down

0 comments on commit b6ab892

Please sign in to comment.