GoogleCloudPlatform / k8s-multicluster-ingress

kubemci: Command line tool to configure L7 load balancers using multiple kubernetes clusters
Apache License 2.0
377 stars 68 forks source link

Support for backend buckets #214

Open process0 opened 5 years ago

process0 commented 5 years ago

Is there a way to define a route to a backend bucket on GCP using the MCI yaml file? I know I can edit the Load Balancer to add the route manually using the GCP web UI. I can also manually edit the URL maps file using gcloud and a file editor, but there is no nice way to automate this.

I suggest having bucketName and bucketCdn elements for the backend section. We could check for the existence of the cloud storage bucket, and create the backend bucket if it exists or fail if it does not exist.

spec:
  backend:
    serviceName: default-http-backend
    servicePort: 8080
  rules:
  - http:
      paths:
      - path: "/api/*"
        backend:
          serviceName: "api"
          servicePort: 3000
      - path: "/static/*"
        backend:
          bucketName: "api-assets"
          bucketCdn: true
nikhiljindal commented 5 years ago

MCI does not support this currently. We reuse the single cluster ingress spec and hence we will need to change that to add the bucket params as suggested here.

The workarounds you enumerated for using GCP Web UI or gcloud will work. Note that they will be overwritten anytime you run kubemci create again.

cagataygurturk commented 5 years ago

Hello @nikhiljindal , I am planning to add storage bucket storage support to kubemci. The design in my mind is like following:

apiVersion: v1
kind: Service
metadata:
  name: prod-static-bucket
  labels:
    app: djangoapp
  annotations:
    kubernetes.io/ingress.storage-bucket-name: "bucket_name"
spec:
  clusterIP: None
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: zoneprinter
  annotations:
    kubernetes.io/ingress.class: gce-multi-cluster
    kubernetes.io/ingress.global-static-ip-name: $ZP_KUBEMCI_IP
spec:
  rules:
  - http:
      paths:
      - path: "/static/*"
        backend:
          serviceName: prod-static-bucket
          servicePort: 3000 #Simply ignored

In addition, BackendConfig can be supported by kubemci to enable CDN for this endpoints.

What do you think?

nevelis commented 5 years ago

@cagataygurturk Heya, did you make any progress on this?

dinvlad commented 4 years ago

Any updates on this? Thanks