weaver icon indicating copy to clipboard operation
weaver copied to clipboard

GKE deployment ignores regions value in weaver.toml for serviceweaver-config cluster deployment

Open vpakhuchyi opened this issue 2 years ago • 3 comments

Hi folks! Thanks a lot for your efforts with ServiceWeaver!

I'm learning how to work with it and specifically to deploy it to GKE. Here is an example of my weaver.toml file:

[serviceweaver]
name = "project"
binary = "./project"

[gke]
project = "project"
account = "[email protected]"
regions = ["europe-west2"]
public_listener = [
  {name = "project", hostname = "project.com"},
]

["/.../project/components/A"]
A = "test"
B = "test"

["/.../project/components/B"]
A = "test"
B = "test"

When I run the GKE deployment I see the following line: Creating cluster serviceweaver-config in location us-central1... Done After all, in GCP console I see that serviceweaver-config cluster is deployed in us-central1 region.

My project's zone:

➜ $ gcloud config get compute/zone
europe-west2-a

Is it expected that serviceweaver-config is always deployed in us-central1 and ignores weaver.toml configuration? If yes - why it's needed?

Thanks in advance!

vpakhuchyi avatar Mar 29 '23 10:03 vpakhuchyi

Currently, yes, the config cluster is always us-central1: https://github.com/ServiceWeaver/weaver-gke/blob/d3d4b98803fe204c58ecdd7e26c552926d247f1e/internal/gke/gke.go#L68-L69

I'll let @spetrovic77 elaborate on this :)

mwhittaker avatar Mar 29 '23 15:03 mwhittaker

Thanks for filing the issue. What Michael said is correct.

A bit of background. GKE load-balancing libraries require configuration from a single cluster. This cluster needs to run somewhere, hence the need to pick a single region to run it in. We just happened to pick us-central1.

In addition to this configuration cluster, we additionally start application clusters in each region you specify in your TOML file, i.e., europe-west2 in your example.

Note that the configuration cluster is not on the request path for your application. It is used for configuring the load-balancers, for controling the rollouts of new application versions, and other centralized functionalities like that.

To help reduce the GKE costs for you in running this extra cluster, all of our GKE clusters run as bare-bones as possible.

spetrovic77 avatar Mar 29 '23 16:03 spetrovic77

Hi @mwhittaker @spetrovic77, thanks for the explanation.

I see that it doesn't affect the deployed application directly. However, I don't see any advantages of always picking the US region for the configuration cluster.

Even more, for example, talking about development environments, it's not always important to have multi-zonal or even multi-regional resources. It's much cheaper to keep everything in a single zone/region and expand it only in further environments (alpha, beta etc). After all, having the possibility to configure all clusters regions/zones can bring benefits.

vpakhuchyi avatar Mar 30 '23 11:03 vpakhuchyi

@vpakhuchyi , we fixed this a while ago. We don't create a config cluster anymore. We'll deploy the service weaver services in the first region where you deploy your application.

rgrandl avatar May 30 '24 16:05 rgrandl