mirror of https://github.com/kubernetes/kops.git
AWS: set IMDS hop limit 1 on all new clusters
This commit is contained in:
parent
ecb56b49bb
commit
6caaff50cd
|
|
@ -288,8 +288,6 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.CloudupMode
|
|||
|
||||
if ig.Spec.InstanceMetadata != nil && ig.Spec.InstanceMetadata.HTTPPutResponseHopLimit != nil {
|
||||
lt.HTTPPutResponseHopLimit = ig.Spec.InstanceMetadata.HTTPPutResponseHopLimit
|
||||
} else if ig.IsControlPlane() && (b.Cluster.IsKubernetesLT("1.26") || !b.UseServiceAccountExternalPermissions()) {
|
||||
lt.HTTPPutResponseHopLimit = fi.PtrTo[int64](3)
|
||||
}
|
||||
|
||||
if ig.Spec.InstanceMetadata != nil && ig.Spec.InstanceMetadata.HTTPTokens != nil {
|
||||
|
|
|
|||
|
|
@ -878,17 +878,11 @@ func setupControlPlane(opt *NewClusterOptions, cluster *api.Cluster, zoneToSubne
|
|||
g.Spec.Zones = []string{zone}
|
||||
}
|
||||
|
||||
if cluster.IsKubernetesLT("1.27") {
|
||||
if cloudProvider == api.CloudProviderAWS {
|
||||
if cluster.IsKubernetesLT("1.27") && cloudProvider == api.CloudProviderAWS {
|
||||
g.Spec.InstanceMetadata = &api.InstanceMetadataOptions{
|
||||
HTTPPutResponseHopLimit: fi.PtrTo(int64(3)),
|
||||
HTTPTokens: fi.PtrTo("required"),
|
||||
}
|
||||
}
|
||||
if cluster.IsKubernetesGTE("1.26") && fi.ValueOf(cluster.Spec.IAM.UseServiceAccountExternalPermissions) {
|
||||
g.Spec.InstanceMetadata.HTTPPutResponseHopLimit = fi.PtrTo(int64(1))
|
||||
}
|
||||
}
|
||||
|
||||
g.Spec.MachineType = opt.ControlPlaneSize
|
||||
g.Spec.Image = opt.ControlPlaneImage
|
||||
|
|
|
|||
Loading…
Reference in New Issue