ServiceWeaver / weaver-kube

Run Service Weaver applications on vanilla Kubernetes.
Apache License 2.0
61 stars 19 forks source link

Added support for arbitrary container registry. #24

Closed mwhittaker closed 1 year ago

mwhittaker commented 1 year ago

Recall that weaver kube deploy needs to build and upload a container image to some registry. Before this PR, weaver kube deploy uploaded images to Docker Hub. In PR #21, @giautm suggested we add support for arbitrary container registries. This PR implements his idea.

Specifically, the user provides an image field inside the "kube" section of the config file. For example, given the following config file:

[serviceweaver]
binary = "./foo"

[kube]
registry = "my_username/foo"

weaver kube deploy will run docker push my_username/foo:TAG. The user can provide any registry that is compatible with docker push. Some examples:

Fixes #11.

spetrovic77 commented 1 year ago

I looked at Docker Hub and GCP Artifacts registry. They both have a concept of a "repo", but they aren't aligned. Here are what they both consider repos:

Docker Hub

spetrovic77/foo:tag1

GCP Artifacts Registry

us-west1-docker.pkg.dev/my-project/foo/foo:tag1

To make things worse, if I do docker push spetrovic77/bar:tag2, DockerHub will create the repo bar for me automatically, with the appropriate tag. If I do docker push us-west1-docker.pkg.dev/my-project/bar/bar:tag2, I get an error that the bar repository doesn't exist.

So to create a weaver-kube image, I need to pass in spetrovic77 for DockerHub, and us-west1-docker.pkg.dev/dingo-gke-dev/repo for Artifacts Registry. Then we append /weaver-kube:tag to both, and push. But those prefixes spetrovic77 and us-west1-docker.pkg.dev/dingo-gke-dev/repo don't both correspond to a registry or a repo.

Can we ask the user to pass in spetrovic77/foo and us-west1-docker.pkg.dev/dingo-gke-dev/foo/foo in the config. And we call it the "image". Then we just append :tag to it and push. WDYT?

mwhittaker commented 1 year ago

Ooooh nice. I like that a lot better. Let me make that change.