Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all code related to legacy health checks #418

Merged
merged 1 commit into from
Aug 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}