Skip to content

Commit

Permalink
affinity, memory limit, healthcheck library, refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
SCBbestof committed Jan 29, 2018
1 parent c4cb6b5 commit ead686e
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 24 deletions.
2 changes: 1 addition & 1 deletion cache.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

import fthealth "github.com/Financial-Times/go-fthealth/v1a"
import fthealth "github.com/Financial-Times/go-fthealth/v1_1"

type cachedHealth struct {
toWriteToCache chan fthealth.CheckResult
Expand Down
14 changes: 10 additions & 4 deletions cachingController.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
fthealth "github.com/Financial-Times/go-fthealth/v1a"
fthealth "github.com/Financial-Times/go-fthealth/v1_1"
"math"
"reflect"
"time"
Expand Down Expand Up @@ -74,10 +74,16 @@ func (c *healthCheckController) scheduleCheck(mService measuredService, refreshP

// run check
serviceToBeChecked := mService.service
checkResult := fthealth.RunCheck(serviceToBeChecked.name,

var checks []fthealth.Check
checks = append(checks, newServiceHealthCheck(serviceToBeChecked, c.healthCheckService))

checkResult := fthealth.RunCheck(fthealth.HealthCheck{
serviceToBeChecked.name,
serviceToBeChecked.name,
fmt.Sprintf("Checks the health of %v", serviceToBeChecked.name),
true,
newServiceHealthCheck(serviceToBeChecked, c.healthCheckService)).Checks[0]
checks,
}).Checks[0]

checkResult.Ack = serviceToBeChecked.ack

Expand Down
2 changes: 1 addition & 1 deletion checkerService.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
fthealth "github.com/Financial-Times/go-fthealth/v1a"
fthealth "github.com/Financial-Times/go-fthealth/v1_1"
"io/ioutil"
"net/http"
)
Expand Down
9 changes: 7 additions & 2 deletions controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
fthealth "github.com/Financial-Times/go-fthealth/v1a"
fthealth "github.com/Financial-Times/go-fthealth/v1_1"
"sort"
"sync"
"time"
Expand Down Expand Up @@ -122,7 +122,12 @@ func (c *healthCheckController) runServiceChecksByServiceNames(services map[stri
checks = append(checks, check)
}

healthChecks := fthealth.RunCheck("Forced check run", "", true, checks...).Checks
healthChecks := fthealth.RunCheck(fthealth.HealthCheck{
"aggregate-healthcheck",
"Aggregate Healthcheck",
"Forced check run",
checks,
}).Checks

wg := sync.WaitGroup{}
for i := range healthChecks {
Expand Down
2 changes: 1 addition & 1 deletion controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"errors"
"fmt"
fthealth "github.com/Financial-Times/go-fthealth/v1a"
fthealth "github.com/Financial-Times/go-fthealth/v1_1"
"github.com/stretchr/testify/assert"
"net/http"
"os"
Expand Down
2 changes: 1 addition & 1 deletion graphiteFeeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"errors"
"fmt"
fthealth "github.com/Financial-Times/go-fthealth/v1a"
fthealth "github.com/Financial-Times/go-fthealth/v1_1"
"net"
"strings"
"time"
Expand Down
2 changes: 1 addition & 1 deletion graphiteFeeder_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
fthealth "github.com/Financial-Times/go-fthealth/v1a"
fthealth "github.com/Financial-Times/go-fthealth/v1_1"
"github.com/stretchr/testify/assert"
"net"
"testing"
Expand Down
6 changes: 3 additions & 3 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"encoding/json"
"fmt"
fthealth "github.com/Financial-Times/go-fthealth/v1a"
fthealth "github.com/Financial-Times/go-fthealth/v1_1"
"html/template"
"net/http"
"net/url"
Expand Down Expand Up @@ -420,7 +420,7 @@ func populateIndividualServiceChecks(checks []fthealth.CheckResult, pathPrefix s
AddOrRemoveAckPath: addOrRemoveAckPath,
AddOrRemoveAckPathName: addOrRemoveAckPathName,
AckMessage: individualCheck.Ack,
Output: individualCheck.Output,
Output: individualCheck.CheckOutput,
}

indiviualServiceChecks = append(indiviualServiceChecks, hc)
Expand Down Expand Up @@ -451,7 +451,7 @@ func populateIndividualPodChecks(checks []fthealth.CheckResult, pathPrefix strin
LastUpdated: check.LastUpdated.Format(timeLayout),
MoreInfoPath: getIndividualPodHealthcheckURL("", pathPrefix, podName),
AckMessage: check.Ack,
Output: check.Output,
Output: check.CheckOutput,
}

indiviualServiceChecks = append(indiviualServiceChecks, hc)
Expand Down
2 changes: 1 addition & 1 deletion handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"errors"
"fmt"
fthealth "github.com/Financial-Times/go-fthealth/v1a"
fthealth "github.com/Financial-Times/go-fthealth/v1_1"
"github.com/stretchr/testify/assert"
"net/http"
"net/http/httptest"
Expand Down
10 changes: 10 additions & 0 deletions helm/upp-aggregate-healthcheck/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ spec:
app: {{ .Values.service.name }}
visualize: "true"
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- {{ .Values.service.name }}
topologyKey: "kubernetes.io/hostname"
containers:
- name: {{ .Values.service.name }}
image: "{{ .Values.image.repository }}:{{ .Chart.Version }}"
Expand Down
4 changes: 3 additions & 1 deletion helm/upp-aggregate-healthcheck/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ image:
repository: coco/upp-aggregate-healthcheck
pullPolicy: IfNotPresent
resources:
requests:
memory: 128Mi
limits:
memory: 256Mi
memory: 512Mi
env:
PATH_PREFIX: ""
categories:
Expand Down
10 changes: 8 additions & 2 deletions podController.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"errors"
"fmt"
fthealth "github.com/Financial-Times/go-fthealth/v1a"
fthealth "github.com/Financial-Times/go-fthealth/v1_1"
"io/ioutil"
"net/http"
"sort"
Expand Down Expand Up @@ -52,7 +52,13 @@ func (c *healthCheckController) runPodChecksFor(serviceName string) ([]fthealth.
checks = append(checks, check)
}

healthChecks := fthealth.RunCheck("Forced check run", "", true, checks...).Checks
healthChecks := fthealth.RunCheck(fthealth.HealthCheck{
"aggregate-healthcheck",
"Aggregate Healthcheck",
"Forced check run",
checks,
}).Checks

wg := sync.WaitGroup{}
for i := range healthChecks {
wg.Add(1)
Expand Down
12 changes: 6 additions & 6 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"revisionTime": "2016-09-08T22:39:53Z"
},
{
"checksumSHA1": "FUhczVSvt/VQAlWfzATo1YLez2E=",
"path": "github.com/Financial-Times/go-fthealth/v1a",
"revision": "f9074331b3ab48bca0e6d0afc211a673d88ac925",
"revisionTime": "2016-06-16T09:04:59Z",
"version": "0.1.0",
"versionExact": "0.1.0"
"checksumSHA1": "G8lW8pPVLieqh/MTJZkvI/i/WyM=",
"path": "github.com/Financial-Times/go-fthealth/v1_1",
"revision": "1b007e2b37b7936dfb6671fa17e5a29fd35a08ea",
"revisionTime": "2017-12-04T12:48:31Z",
"version": "0.4.0",
"versionExact": "0.4.0"
},
{
"checksumSHA1": "9Ob5JNGzi/pGXYMuHclig69IHPk=",
Expand Down

0 comments on commit ead686e

Please sign in to comment.