-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Fix CoreDNS upgrade from v1.20 to v1.21 #4476
🐛 Fix CoreDNS upgrade from v1.20 to v1.21 #4476
Conversation
c3d4051
to
dbdb50e
Compare
/lgtm |
/hold Need more time for a review |
if clusterConfig.ImageRepository != "" { | ||
toImageRepository = fmt.Sprintf("%s/%s", clusterConfig.ImageRepository, coreDNSKey) | ||
toImageRepository = strings.TrimSuffix(clusterConfig.ImageRepository, "/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the trim suffix here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given that the image repository is provider by the user, and that down we are concatenating it with image name and tag, I thought that removing the suffix makes the concat operation more robust (it will work with the user providing "k8s.gcr.io" but also "k8s.gcr.io/")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we instead validate input and provide guidance to users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add validation and documentation as well (in another PR)
Nevertheless, I don't think this extra caution will hurt, but if you prefer I can remove it; it is not core to the fix we are discussing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know how kubeadm itself handles /
suffixes? (depending on how they are doing it, consistency might be a factor)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK kubeadm is not doing any validation on ImageTag/ImageRepository, nor we are doing in CAPI
Also kubeadm, is not involved in immutable upgrades.
I just thought it making the operation more robust, but happy to remove it if it is blocking this PR...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was just an idea, it's fine for me either way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we open a follow-up PR to add validation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding validation could have some implications. I opened an issue to discuss them #4482
} | ||
if clusterConfig.DNS.ImageRepository != "" { | ||
toImageRepository = fmt.Sprintf("%s/%s", clusterConfig.DNS.ImageRepository, coreDNSKey) | ||
toImageRepository = strings.TrimSuffix(clusterConfig.DNS.ImageRepository, "/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the trim suffix here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(see comment above)
// Handle the renaming of the upstream image from "k8s.gcr.io/coredns" to "k8s.gcr.io/coredns/coredns" | ||
toImageName := parsedImage.Name | ||
if toImageRepository == "k8s.gcr.io" && toImageName == "coredns" && targetMajorMinorPatch.GTE(semver.MustParse("1.8.0")) { | ||
toImageName = "coredns/coredns" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add some constants for these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to how kubeadm does it, probably add a comment which references the kubeadm upstream contant here https://github.com/kubernetes/kubernetes/blob/release-1.21/cmd/kubeadm/app/constants/constants.go#L331?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even better ^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constant added
I would avoid to link to the kubeadm code, because things can change there (e.g constant order was changed during v1.21); also, kubeadm is just adapting to what happen somewhere else
dbdb50e
to
4053458
Compare
/lgtm |
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/hold cancel
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
The upstream image for CoreDNS was renamed from 'k8s.gcr.io/coredns' to
k8s.gcr.io/coredns/coredns
, and this is impacting upgrades of workload clusters from v1.20 to v1.21.This PR makes KCP upgrades to account for this change.
Please note that:
); users relying on custom repository could continue to use
mrepo.io/coredns` as image name (no changes required).v
prefix on the ImageTag, but this should be taken care by the user when specifying the desired version in KCP.Which issue(s) this PR fixes:
Fixes #4463
/assign @vincepri
@sbueringer