cluster-api-provider-aws icon indicating copy to clipboard operation
cluster-api-provider-aws copied to clipboard

Support EC2 instance metadata options for the machine pools launch templates

Open ionutbalutoiu opened this issue 2 years ago • 3 comments
trafficstars

/kind feature

Describe the solution you'd like

The PR https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/4037 added support for metadata options in the AWSMachine & AWSMachineTemplate specs. We need to have these EC2 metadata options configurable for machine pools as well.

These options are available via launch template settings for machine pools.

Machine pools (unmanaged or managed) have the following awsLaunchTemplate spec field:

  • https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/b4596fc1f975d15f8a12896f42586f97bc1144bf/exp/api/v1beta2/awsmachinepool_types.go#L64-L66
  • https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/b4596fc1f975d15f8a12896f42586f97bc1144bf/exp/api/v1beta2/awsmanagedmachinepool_types.go#L148-L152

This is the common piece of code creates the launch template for the machine pools: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/b4596fc1f975d15f8a12896f42586f97bc1144bf/pkg/cloud/services/ec2/launchtemplate.go#L379-L420

In the function, there is a struct (of type ec2.RequestLaunchTemplateData) as returned by the helper function: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/b4596fc1f975d15f8a12896f42586f97bc1144bf/pkg/cloud/services/ec2/launchtemplate.go#L444-L504

all we need to do is to set MetadataOptions on the launch template to be created:

data.MetadataOptions = &ec2.LaunchTemplateInstanceMetadataOptionsRequest{
	HttpEndpoint:            &httpEndpoint,
	HttpPutResponseHopLimit: &httpPutResponseHopLimit,
	HttpTokens:              &httpTokens,
	InstanceMetadataTags:    &instanceMetadataTags,
}

And this would allow us to use the metadata configuration options as documented in the cluster-api-aws docs with launch templates for the machine pools.

Environment:

  • Cluster-api-provider-aws version: v2.1.4
  • Kubernetes version: (use kubectl version): v1.26.5-eks-c12679a
  • OS (e.g. from /etc/os-release): Amazon EKS optimized Amazon Linux 1.26

ionutbalutoiu avatar Jul 01 '23 10:07 ionutbalutoiu

This issue is currently awaiting triage.

If CAPA/CAPI contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jul 01 '23 10:07 k8s-ci-robot

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 23 '24 16:01 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Feb 22 '24 16:02 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Mar 23 '24 17:03 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Mar 23 '24 17:03 k8s-ci-robot