Skip to content
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

Backend service creation ambigious #3

Open
dionjwa opened this issue Nov 1, 2019 · 2 comments
Open

Backend service creation ambigious #3

dionjwa opened this issue Nov 1, 2019 · 2 comments

Comments

@dionjwa
Copy link

dionjwa commented Nov 1, 2019

Great work! I'm setting up something similar, and I have a question about your setup.

The command gcloud compute backend-services list is used to get the backend service, however, it's very unclear where this gets created. There's a separate terraform resource for backend services, it's a little confusing. Can you elaborate a little where the creation of that part of the app happens?

@epiphone
Copy link
Owner

epiphone commented Nov 5, 2019

Yeah the setup is admittedly a bit convoluted! The way it works is something like this:

  1. In the initial CI run there's no backend service, so the K8S_BACKEND_SERVICE_NAME environment variable here evaluates to ""
  2. The environment variable is passed to Terraform as an input variable and is used to instantiate a load balancer in GCP
  3. After initializing the infra with Terraform, we apply the Kubernetes deployment
  4. Now in subsequent CI runs gcloud compute backend-services list points us to the backend service created by Terraform

So essentially it takes two CI runs to initialize this setup. This is due to the chicken-and-egg situation of needing to access the Kubernetes-created backend service to finish infra instantiation but not being able to apply Terraform without the infra.

Hope that makes any sense!

@dionjwa
Copy link
Author

dionjwa commented Nov 6, 2019

Thank you! That really helps, I appreciate it.

I'll leave it up to you to close this issue or leave it for others to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants