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 {
|
if ig.Spec.InstanceMetadata != nil && ig.Spec.InstanceMetadata.HTTPPutResponseHopLimit != nil {
|
||||||
lt.HTTPPutResponseHopLimit = ig.Spec.InstanceMetadata.HTTPPutResponseHopLimit
|
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 {
|
if ig.Spec.InstanceMetadata != nil && ig.Spec.InstanceMetadata.HTTPTokens != nil {
|
||||||
|
|
|
||||||
|
|
@ -878,15 +878,9 @@ func setupControlPlane(opt *NewClusterOptions, cluster *api.Cluster, zoneToSubne
|
||||||
g.Spec.Zones = []string{zone}
|
g.Spec.Zones = []string{zone}
|
||||||
}
|
}
|
||||||
|
|
||||||
if cluster.IsKubernetesLT("1.27") {
|
if cluster.IsKubernetesLT("1.27") && cloudProvider == api.CloudProviderAWS {
|
||||||
if cloudProvider == api.CloudProviderAWS {
|
g.Spec.InstanceMetadata = &api.InstanceMetadataOptions{
|
||||||
g.Spec.InstanceMetadata = &api.InstanceMetadataOptions{
|
HTTPTokens: fi.PtrTo("required"),
|
||||||
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))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue