cluster-api-provider-aws
cluster-api-provider-aws copied to clipboard
Support EC2 instance metadata options for the machine pools launch templates
/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
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.
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/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas 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
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/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas 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
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/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas 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: 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/staleis applied- After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied- After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closedYou 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.