solo-io / gloo

The Feature-rich, Kubernetes-native, Next-Generation API Gateway Built on Envoy
https://docs.solo.io/
Apache License 2.0
4.08k stars 438 forks source link

Gloo pod panics with empty static.hosts upstream configured in failoverscheme as primary #6374

Open huzlak opened 2 years ago

huzlak commented 2 years ago

Gloo Edge Version

1.10.x

Kubernetes Version

1.23.x

Describe the bug

Having VirtualService point to upstream with empty static.hosts configuration causes the gloo pod to panic on upstream validation when the upstream is primary target of a failoverscheme.

Steps to reproduce the bug

  1. Setup 2 glooe clusters and register them for federation.
  2. enable failover and apply following steps in local(mgmt) cluster
  3. Configure static upstream with empty static.hosts and virtualservice routing to the upstream
    
    apiVersion: gloo.solo.io/v1
    kind: Upstream
    metadata:
    name: custom-service-blue-10000
    namespace: gloo-system
    spec:
    healthChecks:
    - healthyThreshold: 1
    httpHealthCheck:
      path: /health
    interval: 1s
    timeout: 1s
    unhealthyThreshold: 1
    static:
    hosts:
    ---
    apiVersion: gateway.solo.io/v1
    kind: VirtualService
    metadata:
    name: vs
    namespace: gloo-system
    spec:
    virtualHost:
    routes:
      - matchers:
          - prefix: /
        routeAction:
          single:
            upstream:
              name: custom-service-blue-10000
              namespace: gloo-system
5. Apply failoverscheme pointing to the misconfigured upstream:

kubectl apply -f - <<EOF apiVersion: fed.solo.io/v1 kind: FailoverScheme metadata: finalizers:

goroutine 554 [running]: github.com/solo-io/solo-projects/projects/gloo/pkg/plugins/failover.(failoverPluginImpl).ProcessUpstream(0xc001a43050, 0x4c52cf0, 0xc00300efc0, 0xc0017b8700, 0xc002eb89c0, 0xc002f3dc00, 0x0, 0x0) /workspace/solo-projects/projects/gloo/pkg/plugins/failover/plugin.go:137 +0x74a github.com/solo-io/gloo/projects/gloo/pkg/translator.(translatorInstance).computeCluster(0xc002db6e58, 0x4c52cf0, 0xc00300efc0, 0xc0017b8700, 0xc002eb89c0, 0xc00300ecc0, 0xc00300ec90, 0x0) /go/pkg/mod/github.com/solo-io/gloo@v1.10.10/projects/gloo/pkg/translator/clusters.go:65 +0x22f github.com/solo-io/gloo/projects/gloo/pkg/translator.(translatorInstance).computeClusters(0xc002db6e58, 0x4c52cf0, 0xc00300ee40, 0xc0017b8700, 0xc00300ec90, 0xc00300ecc0, 0xc002de6300, 0x0, 0x0, 0x0, ...) /go/pkg/mod/github.com/solo-io/gloo@v1.10.10/projects/gloo/pkg/translator/clusters.go:47 +0x39f github.com/solo-io/gloo/projects/gloo/pkg/translator.(translatorInstance).translateClusterSubsystemComponents(0xc002db6e58, 0x4c52cf0, 0xc00300e9c0, 0xc0017b8700, 0xc002de6300, 0xc00300ec90, 0x0, 0x0, 0x0, 0x0, ...) /go/pkg/mod/github.com/solo-io/gloo@v1.10.10/projects/gloo/pkg/translator/translator.go:163 +0x436 github.com/solo-io/gloo/projects/gloo/pkg/translator.(translatorInstance).Translate(0xc002db6e58, 0x4c52cf0, 0xc00300e9c0, 0xc0017b8700, 0xc002de6300, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /go/pkg/mod/github.com/solo-io/gloo@v1.10.10/projects/gloo/pkg/translator/translator.go:119 +0x4f6 github.com/solo-io/gloo/projects/gloo/pkg/translator.(translatorFactory).Translate(0xc0017af4d0, 0x4c52cf0, 0xc00300e630, 0xc0017b8700, 0xc002de6300, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /go/pkg/mod/github.com/solo-io/gloo@v1.10.10/projects/gloo/pkg/translator/translator.go:79 +0x27f github.com/solo-io/gloo/projects/gloo/pkg/validation.(validator).Validate(0xc001bc9200, 0x4c52cf0, 0xc00300e630, 0xc002ea6a80, 0x0, 0x0, 0x0) /go/pkg/mod/github.com/solo-io/gloo@v1.10.10/projects/gloo/pkg/validation/server.go:192 +0x472 github.com/solo-io/gloo/projects/gloo/pkg/validation.(validationServer).Validate(0xc000c0dfb0, 0x4c52cf0, 0xc002ee42d0, 0xc002ea6a80, 0x0, 0x0, 0x0) /go/pkg/mod/github.com/solo-io/gloo@v1.10.10/projects/gloo/pkg/validation/server.go:350 +0xe2 github.com/solo-io/gloo/projects/gloo/pkg/api/grpc/validation._GlooValidationService_Validate_Handler(0x4348640, 0xc000c0dfb0, 0x4c52cf0, 0xc002ee42d0, 0xc002e14f00, 0x0, 0x0, 0x0, 0x0, 0x0) /go/pkg/mod/github.com/solo-io/gloo@v1.10.10/projects/gloo/pkg/api/grpc/validation/gloo_validation.pb.go:2621 +0x3d9 google.golang.org/grpc.(Server).processUnaryRPC(0xc000a3f880, 0x4c6c0f8, 0xc002363980, 0xc002e85d40, 0xc001c1fa40, 0x66787a0, 0x0, 0x0, 0x0) /go/pkg/mod/google.golang.org/grpc@v1.42.0/server.go:1282 +0x105d google.golang.org/grpc.(Server).handleStream(0xc000a3f880, 0x4c6c0f8, 0xc002363980, 0xc002e85d40, 0x0) /go/pkg/mod/google.golang.org/grpc@v1.42.0/server.go:1616 +0x9f9 google.golang.org/grpc.(Server).serveStreams.func1.2(0xc002e7abb0, 0xc000a3f880, 0x4c6c0f8, 0xc002363980, 0xc002e85d40) /go/pkg/mod/google.golang.org/grpc@v1.42.0/server.go:921 +0xf4 created by google.golang.org/grpc.(Server).serveStreams.func1 /go/pkg/mod/google.golang.org/grpc@v1.42.0/server.go:919 +0x2c5



### Expected Behavior

I'd expect an error message logged, but pod would continue to run

### Additional Context

_No response_
github-actions[bot] commented 4 months ago

This issue has been marked as stale because of no activity in the last 180 days. It will be closed in the next 180 days unless it is tagged "no stalebot" or other activity occurs.