Description
What feature/behavior/change do you want?
I want to be able to update my kube-proxy to the latest versions using eksctl utils update-kube-proxy
. Currently we update it to major.minor.patch.build.1
where the major/minor/patch mirror your kubernetes version. Example:
- k8s cluster 1.21.1
eksctl utils update-kube-proxy
would updatekube-proxy
to have image version1.21.1.build.1
Problem
We hardcode in build.1
into our update logic. See #4091 for more context. The TLDR is that we don't have a way of discovering iof a build.X
exists, but we know for sure that build.1
exists, so we default to that. Its our "best effort" attempt to update the addon to the latest version.
Fix
We can update our logic to query the EKS Addons API to discover what the latest image version is. For example we already have sub command for querying:
eksctl utils describe-addon-versions --name kube-proxy --kubernetes-version 1.19
2021-10-15 10:45:58 [ℹ] describing addon versions for addon: kube-proxy
{
Addons: [{
AddonName: "kube-proxy",
AddonVersions: [{
AddonVersion: "v1.19.6-eksbuild.2",
Architecture: ["amd64","arm64"],
Compatibilities: [{
ClusterVersion: "1.19",
DefaultVersion: true,
PlatformVersions: ["eks.4+"]
}]
},{
AddonVersion: "v1.18.8-eksbuild.1",
Architecture: ["amd64","arm64"],
Compatibilities: [{
ClusterVersion: "1.19",
DefaultVersion: false,
PlatformVersions: ["eks.4+"]
}]
}],
Type: "networking"
}]
}
In the above we can see that v1.19.6-eksbuild.2
is the latest kube-proxy version for 1.19
, but if you were to run eksctl utils update-kube-proxy
against a 1.19
cluster we would only update it to v1.19.6-eksbuild.1
.
Lets update our code to query the addons API to discover the latest version, ensuring that we are always using the latest version.
Caveats
The addons API only exists for 1.18
and newer clusters, so we will have to maintain support for the old code path for older clusters.
Credit
thanks @suket22 for the suggestion 😄