Skip to content

Commit

Permalink
Set endpoint to DRAIN instead of removing it
Browse files Browse the repository at this point in the history
  • Loading branch information
krhitesh7 committed Apr 21, 2024
1 parent 185b4ae commit a206b6e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/cache/v3/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package cache
import (
"context"
"fmt"
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"

Check failure on line 20 in pkg/cache/v3/simple.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed with `-extra` (gofumpt)

Check failure on line 20 in pkg/cache/v3/simple.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed with `-extra` (gofumpt)
endpoint "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
"github.com/envoyproxy/go-control-plane/pkg/resource/v3"
"strconv"
Expand Down Expand Up @@ -388,8 +389,11 @@ func (cache *snapshotCache) DeleteResources(ctx context.Context, _ string, typ s
for _, lbEndpoint := range cla.Endpoints[i].LbEndpoints {
if resourceToDelete == GetResourceName(lbEndpoint) {
didModify = true
cache.log.Infof("Removed endpoint %s", resourceToDelete)
continue
cache.log.Infof("Drain and remove endpoint %s", resourceToDelete)

// Set to UNHEALTHY/DRAINING and let Envoy gracefully remove them.
lbEndpoint.HealthStatus = core.HealthStatus_DRAINING
// continue
}
newEndpoints = append(newEndpoints, lbEndpoint)
}
Expand Down

0 comments on commit a206b6e

Please sign in to comment.