-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat: simplify and generalise get_image() #405
base: main
Are you sure you want to change the base?
Changes from all commits
f50c228
94a3018
a2cb02c
c4b76e1
31874a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,31 +56,11 @@ def get_image(name: str, repository: str = None): | |
if not repository: | ||
return name | ||
|
||
new_image_name = name | ||
if name.startswith("docker.io/calico"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are all of these hardcoded rules still needed here? I'm thinking they should error out if they are specified incorrectly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR removes all of the hardcoded rules that are not a simple replacement. The remaining ones do not conform to that pattern and as I understand it need to remain for compatibility with the registry/repository structure expected elsewhere in atmosphere(?). @mnaser may be able to give some more context on why things are like this. |
||
new_image_name = name.replace("docker.io/calico/", f"{repository}/calico/") | ||
return name.replace("docker.io/calico/", f"{repository}/calico/") | ||
if name.startswith("quay.io/cilium"): | ||
new_image_name = name.replace("quay.io/cilium/", f"{repository}/cilium/") | ||
if name.startswith("docker.io/k8scloudprovider"): | ||
new_image_name = name.replace("docker.io/k8scloudprovider", repository) | ||
if name.startswith("registry.k8s.io/sig-storage"): | ||
new_image_name = name.replace("registry.k8s.io/sig-storage", repository) | ||
if name.startswith("registry.k8s.io/provider-os"): | ||
new_image_name = name.replace("registry.k8s.io/provider-os", repository) | ||
if name.startswith("gcr.io/k8s-staging-sig-storage"): | ||
new_image_name = name.replace("gcr.io/k8s-staging-sig-storage", repository) | ||
if new_image_name.startswith(f"{repository}/livenessprobe"): | ||
return new_image_name.replace("livenessprobe", "csi-livenessprobe") | ||
if new_image_name.startswith("registry.k8s.io/coredns"): | ||
return new_image_name.replace("registry.k8s.io/coredns", repository) | ||
if new_image_name.startswith("registry.k8s.io/autoscaling"): | ||
return new_image_name.replace("registry.k8s.io/autoscaling", repository) | ||
if ( | ||
new_image_name.startswith("registry.k8s.io/etcd") | ||
or new_image_name.startswith("registry.k8s.io/kube-") | ||
or new_image_name.startswith("registry.k8s.io/pause") | ||
): | ||
return new_image_name.replace("registry.k8s.io", repository) | ||
return name.replace("quay.io/cilium/", f"{repository}/cilium/") | ||
if name.startswith(f"{repository}/livenessprobe"): | ||
return name.replace("livenessprobe", "csi-livenessprobe") | ||
|
||
assert new_image_name.startswith(repository) is True | ||
return new_image_name | ||
return repository + "/" + name.split("/")[-1] |
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.
instead of keeping this code, could we supply a default manifest that's equivalent so people don't have to look into two different places (code and manifest) to figure this out?
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.
That would extend the scope of this PR as we would have to keep the default manifest in the source tree, manage its installation to a known location and then load it by default. I am conscious that we are making very little progress toward getting this merged so would like to keep the scope contained.
An extracted default manifest would be missing the images found through running kubeadm so I think that this might need more consideration, and should probably be a follow-up PR if anyone were wanting to do that work.