palladius / clouddeploy-platinum-path

Cloud Build + Cloud Deploy from the ground up
Apache License 2.0
7 stars 11 forks source link

[sol1] Currently supporting single cluster #21

Closed palladius closed 2 years ago

palladius commented 2 years ago

Talked to Alex who pointed out this cannot work in MC mode. Talked to Daniel who confirmed sol1 does NOT support MC.

I see three solutions:

  1. NOOP. do nothing and just update docs.
  2. Moved to DEV cluster where I actually DO have 2 targets and I can demonstrate that. Just need to add 4 pods to staging instead than to prod. Beware of the doppel-namespce though ;)
  3. Fix and make it MVC instead.
palladius commented 2 years ago

Tried solution1. My hope it would work just changing the Gateway provider (3bytes CL) didnt work. Here's the error

ricc@ricc:~/git/clouddeploy-platinum-path$ 🐼 bin/kubectl-canary describe gateway sol1-app01-eu-w1-xgw-mc
[...]
[CANA] Events:
[CANA] Type     Reason  Age                     From                   Message
[CANA] ----     ------  ----                    ----                   -------
[CANA] Warning  SYNC    26m (x5 over 3h20m)     mc-gateway-controller  failed to translate Gateway "default/sol1-app01-eu-w1-xgw-mc": error getting ServiceImportConfig gw-serve404.kube-system: serviceimportconfigs.net.gke.io "gw-serve404.kube-system" not found
[CANA] Warning  SYNC    8m13s (x8 over 3h4m)    mc-gateway-controller  failed to translate Gateway "default/sol1-app01-eu-w1-xgw-mc": error getting ServiceImportConfig sol1-app01-eu-w1-canary.default: serviceimportconfigs.net.gke.io "sol1-app01-eu-w1-canary.default" not found
[CANA] Warning  SYNC    3m36s (x28 over 3h18m)  mc-gateway-controller  failed to translate Gateway "default/sol1-app01-eu-w1-xgw-mc": error getting ServiceImportConfig sol1-app01-eu-w1-common-svc.default: serviceimportconfigs.net.gke.io "sol1-app01-eu-w1-common-svc.default" not found

So clearly I need to scopiazz the config from solution0:

(base) ricc@ricc:🏡~/git/clouddeploy-platinum-path$ rgrep -i serviceimport k8s/solution*
k8s/solution0/out/cluster1/cluster1-gateway-but-later.yaml:    # 90% of traffic to store-west-1 ServiceImport
k8s/solution0/out/cluster1/cluster1-gateway-but-later.yaml:      kind: ServiceImport
k8s/solution0/out/cluster1/cluster1-gateway-but-later.yaml:    # 10% of traffic to store-west-2 ServiceImport
k8s/solution0/out/cluster1/cluster1-gateway-but-later.yaml:      kind: ServiceImport
k8s/solution0/templates/cluster1/cluster1-gateway-but-later.template.yaml:    # 90% of traffic to store-west-1 ServiceImport
k8s/solution0/templates/cluster1/cluster1-gateway-but-later.template.yaml:      kind: ServiceImport
k8s/solution0/templates/cluster1/cluster1-gateway-but-later.template.yaml:    # 10% of traffic to store-west-2 ServiceImport
k8s/solution0/templates/cluster1/cluster1-gateway-but-later.template.yaml:      kind: ServiceImport
k8s/solution3-multi-cluster-ilb-setup/out/cluster1/cluster1-gateway-but-later.yaml:    # 90% of traffic to store-west-1 ServiceImport
k8s/solution3-multi-cluster-ilb-setup/out/cluster1/cluster1-gateway-but-later.yaml:      kind: ServiceImport
k8s/solution3-multi-cluster-ilb-setup/out/cluster1/cluster1-gateway-but-later.yaml:    # 10% of traffic to store-west-2 ServiceImport
k8s/solution3-multi-cluster-ilb-setup/out/cluster1/cluster1-gateway-but-later.yaml:      kind: ServiceImport
k8s/solution3-multi-cluster-ilb-setup/templates/cluster1/cluster1-gateway-but-later.template.yaml:    # 90% of traffic to store-west-1 ServiceImport
k8s/solution3-multi-cluster-ilb-setup/templates/cluster1/cluster1-gateway-but-later.template.yaml:      kind: ServiceImport
k8s/solution3-multi-cluster-ilb-setup/templates/cluster1/cluster1-gateway-but-later.template.yaml:    # 10% of traffic to store-west-2 ServiceImport
k8s/solution3-multi-cluster-ilb-setup/templates/cluster1/cluster1-gateway-but-later.template.yaml:      kind: ServiceImport
palladius commented 2 years ago

I tried to bring the ServiceImport from sol0:

###########################################################
# This is a K8S template for Solution1 with some variables.
# You cant kubectl apply this or you'll get errors.
#
# Vars:
#  APP_NAME: __APP_NAME__
#  PREFIX:   __PREFIX__   # contains appname and region as of now.
#  REGION:   __REGION__
#
# .. and so on. in general things with double underscore left and right as Im not a great sedder :)
###########################################################
kind: HTTPRoute
apiVersion: gateway.networking.k8s.io/v1alpha2
metadata:
  name: sol1-__PREFIX__
  labels:
    gateway: sol1-__PREFIX__-xgw-mc    # dmarzi_was: external-store-http
spec:
  parentRefs:
  - name: sol1-__PREFIX__-xgw-mc       # dmarzi_was: external-store-http
  hostnames:
  - "sol1-__APPNAME__.example.io"    # kept for easy curl/documented static commands :)
  - "sol1-__PREFIX__.example.io"     # bake in region as well... klets see which is best
  - "sol1-__APPNAME__.__MY_DOMAIN__" # being changed by script 12 into $MY_DOMAIN.
  - sol1-passepartout.example.io     # being lazy, so it ALWAYS works for troubleshooting reasons :)
  - passepartout.example.io          # being even lazier :)
  - www.example.io                   # now beat this :)
#   rules:
#   - backendRefs:
#     - name: sol1-__PREFIX__-common-svc # dmarzi_was: store-common-svc
#       port: 8080
# # While this might work, Im gonna remove this for now.
# #      weight: 90
#   - matches:
#     - path:
#         # the underscore is to signify this is a special path as I've seen often in appengine. This is order NOT to
#         # interfere with the app which could have a proper /prod/ route but probably not a /_justprod/ one.
#         value: /_justprod
#     backendRefs:
#     - name: sol1-__PREFIX__-prod
#       port: 8080
#   - matches:
#     - path:
#         value: /_justcanary
#     backendRefs:
#     - name: sol1-__PREFIX__-canary
#       port: 8080

  rules:
  - backendRefs:
    # 90% of traffic to store-west-1 ServiceImport
    - name: sol1-__PREFIX__-canary # dmarzi-app-web-01
      group: net.gke.io
      kind: ServiceImport
      port: 8080
      weight: 78
    # 10% of traffic to store-west-2 ServiceImport
    - name: sol1-__PREFIX__-prod   # dmarzi-app-web-02
      group: net.gke.io
      kind: ServiceImport
      port: 8080
      weight: 22
palladius commented 2 years ago

I understand that supporting single is WAI so i'm tempted to close this and open a new one where I refactor sol1 to support dev/staging (which is MUCH easier to test).

palladius commented 2 years ago

created https://github.com/palladius/clouddeploy-platinum-path/issues/22

i think i'll close this for now.