From a9c6a869d805c38eedb94b3d66f7b816d60918b5 Mon Sep 17 00:00:00 2001 From: Christian Bianchi Date: Tue, 2 Apr 2024 14:45:35 +0200 Subject: [PATCH] Bump k8scc to fix issues with IMDS v2. (#3738) * Bump k8scc to fix issues with IMDS v2. * Bump k8scc to fix issues with IMDS v2. * Bump k8scc to fix issues with IMDS v2. --- CHANGELOG.md | 4 ++++ go.mod | 2 +- go.sum | 4 ++-- .../internal/cloudconfig/template/instance_health_check.go | 2 +- service/internal/cloudconfig/template/lifecycle_continue.go | 2 +- service/internal/cloudconfig/template/set-hostname.go | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00848fe8b3..54efdd8ba2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Bump k8scc to fix issues with IMDS v2. + ## [16.1.0] - 2024-03-04 ### Changed diff --git a/go.mod b/go.mod index 48dd2c2eb9..3437681ccc 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/giantswarm/certs/v4 v4.0.0 github.com/giantswarm/ipam v0.3.0 github.com/giantswarm/k8sclient/v7 v7.2.0 - github.com/giantswarm/k8scloudconfig/v18 v18.1.0 + github.com/giantswarm/k8scloudconfig/v18 v18.2.0 github.com/giantswarm/k8smetadata v0.24.0 github.com/giantswarm/kubelock/v4 v4.0.0 github.com/giantswarm/microendpoint v1.1.0 diff --git a/go.sum b/go.sum index 24a13c5d1d..d3b758827b 100644 --- a/go.sum +++ b/go.sum @@ -102,8 +102,8 @@ github.com/giantswarm/ipam v0.3.0 h1:QNb4k5Zu6nGsqJkAM7dLM1J6TiUP+LGjo9CPR+ewZBk github.com/giantswarm/ipam v0.3.0/go.mod h1:xG4cMEKwHlbE0aZ7x2H5j7o81U13LIStA73XCECdk+I= github.com/giantswarm/k8sclient/v7 v7.2.0 h1:twh4egNcuTJEH7R/hYVhs8nwEXPlr0u/o9CB1Kv9H9A= github.com/giantswarm/k8sclient/v7 v7.2.0/go.mod h1:kZGRtOqe4vAKXtWm69tsj2Q9CpWlwzpa1uP1lfDtjlE= -github.com/giantswarm/k8scloudconfig/v18 v18.1.0 h1:tV4QAt0f948Pg5+7bUxsTKJv3LczUOLhjtTcEeVxT+k= -github.com/giantswarm/k8scloudconfig/v18 v18.1.0/go.mod h1:gc4Yb9DHzaOR5wVZdP1bAcNHGNKv1a4qIhs6nHkotuU= +github.com/giantswarm/k8scloudconfig/v18 v18.2.0 h1:X2Vrn65OyNCSO/hoviNQ9h1dxEb3hBp5dD140IVPwDQ= +github.com/giantswarm/k8scloudconfig/v18 v18.2.0/go.mod h1:bt8DfLZRry6VD4UYpV2vkL8+NojjKikg4Jxh20fFDYA= github.com/giantswarm/k8smetadata v0.24.0 h1:mAIgH4W06qx8X5rV9QEtJhCJLn8DMXfTfNVZi5ROp4c= github.com/giantswarm/k8smetadata v0.24.0/go.mod h1:QiQAyaZnwco1U0lENLF0Kp4bSN4dIPwIlHWEvUo3ES8= github.com/giantswarm/kubelock/v4 v4.0.0 h1:qvFGOIlDthAD8r32WcorT8R4gp3c1dpnDbHuLsDU2ZA= diff --git a/service/internal/cloudconfig/template/instance_health_check.go b/service/internal/cloudconfig/template/instance_health_check.go index 44a90beb5e..1f24279d74 100644 --- a/service/internal/cloudconfig/template/instance_health_check.go +++ b/service/internal/cloudconfig/template/instance_health_check.go @@ -33,7 +33,7 @@ if test $(cut -d '.' -f1 /proc/uptime) -lt 900; then fi # AWS Metadata -export INSTANCEID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id 2> /dev/null) +export INSTANCEID=$(/opt/imds-client /latest/meta-data/instance-id) # Additional ENVs . /etc/network-environment diff --git a/service/internal/cloudconfig/template/lifecycle_continue.go b/service/internal/cloudconfig/template/lifecycle_continue.go index 87c79dc8b4..1575a7d63d 100644 --- a/service/internal/cloudconfig/template/lifecycle_continue.go +++ b/service/internal/cloudconfig/template/lifecycle_continue.go @@ -25,7 +25,7 @@ set -o nounset set -o pipefail # AWS Metadata -export INSTANCEID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id 2> /dev/null) +export INSTANCEID=$(/opt/imds-client /latest/meta-data/instance-id) # AWS Autoscaling Group Name export AUTOSCALINGGROUP=$(docker run --rm {{ .RegistryDomain }}/giantswarm/awscli:2.7.35 autoscaling describe-auto-scaling-instances --instance-ids=$INSTANCEID --query 'AutoScalingInstances[*].AutoScalingGroupName' --output text) diff --git a/service/internal/cloudconfig/template/set-hostname.go b/service/internal/cloudconfig/template/set-hostname.go index b6a24d1b72..b8e68dc1bb 100644 --- a/service/internal/cloudconfig/template/set-hostname.go +++ b/service/internal/cloudconfig/template/set-hostname.go @@ -10,7 +10,7 @@ Before=k8s-kubelet.service [Service] Type=oneshot RemainAfterExit=yes -ExecStart=/bin/bash -c "hostnamectl set-hostname $(curl http://169.254.169.254/latest/meta-data/local-hostname)" +ExecStart=/bin/bash -c "hostnamectl set-hostname $(/opt/imds-client /latest/meta-data/local-hostname)" [Install] WantedBy=multi-user.target