Dynamic ingress backends


#1

I’m able to deploy the following manually to k8s:

deploy-100, service-100 => pod-100 (docker image tag 100)
deploy-101, service-101 => pod-101 (docker image tag 101)
deploy-102, service-102 => pod-102 (docker image tag 102)

ingress: webapp

webapp.company.com/v100 => service-100
webapp.company.com/v101 => service-101
webapp.company.com/v102 => service-102

Using a single ingress and host I can specify multiple backends+paths to access different versions of the same service (different docker images).

How could I do this in spinnaker? Each time I deploy the ingress the backend is replaced with the new version vs appending to the backend list.


#2

I’m using a jenkins job which calls kubectl patch --type json with add/del templates to manage the ingress:

[{
  "op": "add",
  "path": "/spec/rules/0/http/paths/-",
  "value": {
    "path": "KUBE_PATHNAME",
    "backend": {
      "serviceName": "KUBE_SERVNAME",
      "servicePort": 80
    }
  }
}]

[{
  "op": "remove",
  "path": "/spec/rules/0/http/paths/KUBE_PATH_INDEX"
}]