mozmeao / infra

Mozilla Marketing Engineering and Operations Infrastructure
https://mozilla.github.io/meao/
Mozilla Public License 2.0
58 stars 12 forks source link

Bedrock's k8s based demo website deployments #1199

Open duallain opened 4 years ago

duallain commented 4 years ago

Goal - To make it so devs working on bedrock have the ability to spin up demo websites for specific versions of bedrock.

Requirements - (from the POV of users)

From the POV of the infra -

Implementation Intentions - (this is a best guess about how to do the work, but flexible) Once per cluster do -

Once per service do -

Notes - Reqs from @alexgibson

bookshelfdave commented 4 years ago

That website must have valid dns names,

how do we ensure that branch names turn into valid DNS names?

One alb per service

in the past with Voyager, we were able to use wildcard DNS and have all services share a single ELB. I think this is cheaper than dynamically creating new ALBs, which can rack up charges for un-pruned branches.

route53 domain for bedrock demos will be (X) (@metadave can you help me pick here?)

mozmar.org, ramzom.org are fine not moz.works

pmac commented 4 years ago

not moz.works

Why not? The old demos were at a moz.works domain. Doesn't matter to me really, just curious. That also reminds me, do we have mozmeao.org?

bookshelfdave commented 4 years ago

not moz.works Why not?

the Voyager controller automates DNS zone changes, so you have to give it full access to manage moz.works. I don't want Voyager accidentally messing with moz.works.

pmac commented 4 years ago

Also very much agreed about wildcard DNS and Certs if possible. I'll also just go on record one more time to suggest that bedrock is the only service for which we need these arbitrarily named demos, and that this all seems like a lot of work for little reward just so that we can use k8s for this. I'm still personally happier with the Dokku approach which keeps these things both off our prod infra and managed with easy scripts from GitLab. See the changes required here.

duallain commented 4 years ago

That website must have valid dns names,

how do we ensure that branch names turn into valid DNS names?

I think I'll probably just be opinionated about which branch names can build. Add a regex to reject slashes and dots and write that in the docs. Dashes and underscores ought to be ok I think.

One alb per service

in the past with Voyager, we were able to use wildcard DNS and have all services share a single ELB. I think this is cheaper than dynamically creating new ALBs, which can rack up charges for un-pruned branches.

I was thinking that bedrock should have one alb. All demos sites for bedrock can use that same alb. (service == bedrock in this context).

pmac commented 4 years ago

how do we ensure that branch names turn into valid DNS names?

GitLab will do that for us with the CI_COMMIT_REF_SLUG variable.

See docs for reference.

pmac commented 4 years ago

As I used here: https://github.com/mozilla/bedrock/compare/demo/dokku#diff-e23facd71a79c9a4069ba66ec2f6afeeR13

glogiotatidis commented 4 years ago

It feels that there's already a lot of work purred into implementing this in k8s and while close it's not ready yet, if I understand this correctly. I'll echo @pmac that this is only for bedrock. If it can be made into a generic k8s component maybe it's worth the extra time and effort.

combinedIngress code looks good btw.

duallain commented 4 years ago

I agree with you two. Too much work for just demo sites for sure. I think we should be able to reuse voyager/external dns with the full deployments of all services that are public facing. There's a bit of code somewhere in the infra-private repo (dns/aws/moz.works.tf) that we might be able to get rid of with this work. We'll also be able to upgrade to albs (which I've found to be a tiny bit more stable) and share the albs between bedrock/basket deployments (to save $$).

duallain commented 4 years ago

work required to finish everything up: