-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Use crane for image loader instead of skopeo
- Loading branch information
1 parent
838d231
commit 8567f90
Showing
4 changed files
with
73 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
def get_image(name: str, repository: str = None): | ||
""" | ||
Get the image name from the target registry given a full image name. | ||
""" | ||
|
||
if repository is None: | ||
return repository | ||
|
||
new_image_name = name | ||
if name.startswith("docker.io/calico"): | ||
new_image_name = name.replace("docker.io/calico/", f"{repository}/calico-") | ||
if name.startswith("docker.io/k8scloudprovider"): | ||
new_image_name = name.replace("docker.io/k8scloudprovider", repository) | ||
if name.startswith("k8s.gcr.io/sig-storage"): | ||
new_image_name = name.replace("k8s.gcr.io/sig-storage", repository) | ||
if new_image_name.startswith(f"{repository}/livenessprobe"): | ||
return new_image_name.replace("livenessprobe", "csi-livenessprobe") | ||
if new_image_name.startswith("k8s.gcr.io/coredns"): | ||
return new_image_name.replace("k8s.gcr.io/coredns", repository) | ||
if ( | ||
new_image_name.startswith("k8s.gcr.io/etcd") | ||
or new_image_name.startswith("k8s.gcr.io/kube-") | ||
or new_image_name.startswith("k8s.gcr.io/pause") | ||
): | ||
return new_image_name.replace("k8s.gcr.io", repository) | ||
|
||
assert new_image_name.startswith(repository) is True | ||
return new_image_name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters