diff --git a/pkg/cloudprovider/aws/instance.go b/pkg/cloudprovider/aws/instance.go index 93d65cc65f69..bd2f3202cd31 100644 --- a/pkg/cloudprovider/aws/instance.go +++ b/pkg/cloudprovider/aws/instance.go @@ -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"}), }, }, } diff --git a/pkg/cloudprovider/aws/launchtemplate.go b/pkg/cloudprovider/aws/launchtemplate.go index 72a12d5b5dd9..9291127585d1 100644 --- a/pkg/cloudprovider/aws/launchtemplate.go +++ b/pkg/cloudprovider/aws/launchtemplate.go @@ -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 { diff --git a/pkg/cloudprovider/aws/suite_test.go b/pkg/cloudprovider/aws/suite_test.go index 147889ac454d..a99f3a0ae3e3 100644 --- a/pkg/cloudprovider/aws/suite_test.go +++ b/pkg/cloudprovider/aws/suite_test.go @@ -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) diff --git a/website/content/en/docs/getting-started/_index.md b/website/content/en/docs/getting-started/_index.md index 1ed812db573e..1c9a91a3a275 100644 --- a/website/content/en/docs/getting-started/_index.md +++ b/website/content/en/docs/getting-started/_index.md @@ -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.