Error when specifying multiple services in IngressRoute

I am trying to specify two services behind a router. This used to work perfectly fine in v1 :slight_smile:

Please help me to figure out if I am missing something.

My services

$ kubectl get svc -l app=test
NAME       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE
vikas-v1   ClusterIP   10.43.82.235    <none>        80/TCP    57s
vikas-v2   ClusterIP   10.43.113.218   <none>        80/TCP    57s
$

One service works fine

---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: app-test
  namespace: default
spec:
  entryPoints:
  - websecure
  tls: {}
  routes:
    - kind: Rule
      match: Host(`app-test.xx.yy`)
      services:
      - name: vikas-v1
        port: 80

Two services throws an exception

---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: app-test
  namespace: default
spec:
  entryPoints:
  - websecure
  tls: {}
  routes:
    - kind: Rule
      match: Host(`app-test.xx.yy`)
      services:
      - name: vikas-v1
        port: 80
      - name: vikas-v2
        port: 80

Error

time="2019-11-07T05:48:52Z" level=error msg="Error in Go routine: runtime error: invalid memory address or nil pointer dereference"
time="2019-11-07T05:48:52Z" level=error msg="Stack: goroutine 53 [running]:\nruntime/debug.Stack(0xc0000fc000, 0x24d0e85, 0x17)\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x9d\ngithub.com/containous/traefik/v2/pkg/safe.defaultRecoverGoroutine(0x209b8c0, 0x3ee5610)\n\t/go/src/github.com/containous/traefik/pkg/safe/routine.go:160 +0xb1\ngithub.com/containous/traefik/v2/pkg/safe.GoWithRecover.func1.1(0x25ab3a0)\n\t/go/src/github.com/containous/traefik/pkg/safe/routine.go:150 +0x57\npanic(0x209b8c0, 0x3ee5610)\n\t/usr/local/go/src/runtime/panic.go:679 +0x1b2\ngithub.com/containous/traefik/v2/pkg/metrics.OnConfigurationUpdate(0xc00088a3f0, 0xc00055b400, 0x5, 0x8)\n\t/go/src/github.com/containous/traefik/pkg/metrics/prometheus.go:232 +0x618\ngithub.com/containous/traefik/v2/pkg/server.(*Server).loadConfiguration(0xc0003b8000, 0x24bb87e, 0xd, 0xc000810560)\n\t/go/src/github.com/containous/traefik/pkg/server/server_configuration.go:59 +0x49a\ngithub.com/containous/traefik/v2/pkg/server.(*Server).listenConfigurations(0xc0003b8000, 0xc00047b5e0)\n\t/go/src/github.com/containous/traefik/pkg/server/server_configuration.go:249 +0x51\ngithub.com/containous/traefik/v2/pkg/server.(*Server).Start.func3(0xc00047b5e0)\n\t/go/src/github.com/containous/traefik/pkg/server/server.go:183 +0x34\ngithub.com/containous/traefik/v2/pkg/safe.(*Pool).Go.func1()\n\t/go/src/github.com/containous/traefik/pkg/safe/routine.go:90 +0x7b\ngithub.com/containous/traefik/v2/pkg/safe.GoWithRecover.func1(0x25ab3a0, 0xc00012b8c0)\n\t/go/src/github.com/containous/traefik/pkg/safe/routine.go:153 +0x57\ncreated by github.com/containous/traefik/v2/pkg/safe.GoWithRecover\n\t/go/src/github.com/containous/traefik/pkg/safe/routine.go:147 +0x49\n"

Fixed by https://github.com/containous/traefik/pull/5759

1 Like