Skip to content

Commit

Permalink
Merge pull request #418 from rramkumar1/remove-legacy-health-checks
Browse files Browse the repository at this point in the history
Remove all code related to legacy health checks
  • Loading branch information
bowei authored Aug 14, 2018
2 parents 6583318 + 3d82410 commit 7079695
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 37 deletions.
6 changes: 4 additions & 2 deletions pkg/backends/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ func (s *backendSyncer) ensureBackendService(sp utils.ServicePort) error {
}
}

// Ensure health check for backend service exists. Note that hasLegacyHC
// will dictate whether we search for an existing legacy health check.
// Ensure health check for backend service exists.
hcLink, err := s.ensureHealthCheck(sp, hasLegacyHC)
if err != nil {
return err
Expand Down Expand Up @@ -170,6 +169,9 @@ func (s *backendSyncer) Shutdown() error {
}

func (s *backendSyncer) ensureHealthCheck(sp utils.ServicePort, hasLegacyHC bool) (string, error) {
if hasLegacyHC {
glog.Errorf("Backend %+v has legacy health check", sp.ID)
}
hc := s.healthChecker.New(sp)
if s.prober != nil {
probe, err := s.prober.GetProbe(sp)
Expand Down
13 changes: 0 additions & 13 deletions pkg/healthchecks/healthchecks.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,6 @@ func (h *HealthChecks) Get(name string, version meta.Version) (*HealthCheck, err
return NewHealthCheck(hc), err
}

// GetLegacy deletes legacy HTTP health checks
func (h *HealthChecks) GetLegacy(port int64) (*compute.HttpHealthCheck, error) {
name := h.namer.IGBackend(port)
return h.cloud.GetHttpHealthCheck(name)
}

// DeleteLegacy deletes legacy HTTP health checks
func (h *HealthChecks) DeleteLegacy(port int64) error {
name := h.namer.IGBackend(port)
glog.V(2).Infof("Deleting legacy HTTP health check %v", name)
return h.cloud.DeleteHttpHealthCheck(name)
}

// DefaultHealthCheck simply returns the default health check.
func DefaultHealthCheck(port int64, protocol annotations.AppProtocol) *HealthCheck {
httpSettings := computealpha.HTTPHealthCheck{Port: port}
Expand Down
20 changes: 0 additions & 20 deletions pkg/healthchecks/healthchecks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
"net/http"
"testing"

compute "google.golang.org/api/compute/v1"

"k8s.io/apimachinery/pkg/types"
"k8s.io/ingress-gce/pkg/annotations"
"k8s.io/ingress-gce/pkg/utils"
Expand Down Expand Up @@ -311,24 +309,6 @@ func TestHealthCheckUpdate(t *testing.T) {
}
}

func TestHealthCheckDeleteLegacy(t *testing.T) {
hcp := NewFakeHealthCheckProvider()
healthChecks := NewHealthChecker(hcp, "/", "/healthz", namer, defaultBackendSvc)

err := hcp.CreateHttpHealthCheck(&compute.HttpHealthCheck{
Name: namer.IGBackend(80),
})
if err != nil {
t.Fatalf("expected health check to be created, err: %v", err)
}

err = healthChecks.DeleteLegacy(80)
if err != nil {
t.Fatalf("expected health check to be deleted, err: %v", err)
}

}

func TestAlphaHealthCheck(t *testing.T) {
hcp := NewFakeHealthCheckProvider()
healthChecks := NewHealthChecker(hcp, "/", "/healthz", namer, defaultBackendSvc)
Expand Down
2 changes: 0 additions & 2 deletions pkg/healthchecks/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,4 @@ type HealthChecker interface {
Sync(hc *HealthCheck) (string, error)
Delete(name string) error
Get(name string, version meta.Version) (*HealthCheck, error)
GetLegacy(port int64) (*compute.HttpHealthCheck, error)
DeleteLegacy(port int64) error
}

0 comments on commit 7079695

Please sign in to comment.