Skip to content

Commit 85fd5fd

Browse files
authored
Merge pull request #186 from atlassian/update-dependencies
Update dependencies to Kubernetes 1.18 Client
2 parents 443a25e + 4ad9733 commit 85fd5fd

File tree

17 files changed

+409
-166
lines changed

17 files changed

+409
-166
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cache:
1010

1111
go_import_path: github.com/atlassian/escalator
1212
go:
13-
- "1.13.x"
13+
- "1.14.x"
1414

1515
before_install:
1616
# install goreturns for linting

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.13 as builder
1+
FROM golang:1.14 as builder
22
WORKDIR /go/src/github.com/atlassian/escalator/
33
COPY go.mod go.sum ./
44
COPY cmd cmd

cmd/main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ import (
1313
"github.com/atlassian/escalator/pkg/controller"
1414
"github.com/atlassian/escalator/pkg/k8s"
1515
"github.com/atlassian/escalator/pkg/metrics"
16+
1617
"github.com/google/uuid"
1718
"github.com/pkg/errors"
1819
log "github.com/sirupsen/logrus"
1920
"gopkg.in/alecthomas/kingpin.v2"
21+
coordinationv1 "k8s.io/api/coordination/v1"
2022
coreV1 "k8s.io/api/core/v1"
2123
"k8s.io/apimachinery/pkg/runtime"
2224
"k8s.io/client-go/kubernetes"
@@ -38,8 +40,8 @@ var (
3840
leaderElectLeaseDuration = kingpin.Flag("leader-elect-lease-duration", "Leader election lease duration").Default("15s").Duration()
3941
leaderElectRenewDeadline = kingpin.Flag("leader-elect-renew-deadline", "Leader election renew deadline").Default("10s").Duration()
4042
leaderElectRetryPeriod = kingpin.Flag("leader-elect-retry-period", "Leader election retry period").Default("2s").Duration()
41-
leaderElectConfigNamespace = kingpin.Flag("leader-elect-config-namespace", "Leader election config map namespace").Default("kube-system").String()
42-
leaderElectConfigName = kingpin.Flag("leader-elect-config-name", "Leader election config map name").Default("escalator-leader-elect").String()
43+
leaderElectConfigNamespace = kingpin.Flag("leader-elect-config-namespace", "Leader election lease object namespace").Default("kube-system").String()
44+
leaderElectConfigName = kingpin.Flag("leader-elect-config-name", "Leader election lease object name").Default("escalator-leader-elect").String()
4345
)
4446

4547
// cloudProviderBuilder builds the requested cloud provider. aws, gce, etc
@@ -151,6 +153,9 @@ func awaitLeaderDeposed(leaderContext context.Context) {
151153
// startLeaderElection creates and starts the leader election
152154
func startLeaderElection(client kubernetes.Interface, resourceLockID string, config k8s.LeaderElectConfig) (context.Context, error) {
153155
eventsScheme := runtime.NewScheme()
156+
if err := coordinationv1.AddToScheme(eventsScheme); err != nil {
157+
return nil, err
158+
}
154159
if err := coreV1.AddToScheme(eventsScheme); err != nil {
155160
return nil, err
156161
}
@@ -162,7 +167,7 @@ func startLeaderElection(client kubernetes.Interface, resourceLockID string, con
162167
recorder := eventBroadcaster.NewRecorder(eventsScheme, coreV1.EventSource{Component: "escalator"})
163168

164169
// Create leader elector
165-
leaderElector, ctx, startedLeading, err := k8s.GetLeaderElector(context.Background(), config, client.CoreV1(), recorder, resourceLockID)
170+
leaderElector, ctx, startedLeading, err := k8s.GetLeaderElector(context.Background(), config, client.CoreV1(), client.CoordinationV1(), recorder, resourceLockID)
166171
if err != nil {
167172
return nil, err
168173
}

docs/best-practices-issues-gotchas.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
- Run Escalator with a low scan interval, for example 30 or 60 seconds. This will ensure Escalator is responsive
1515
enough during a spike in load or pods.
1616

17-
- Run Escalator with leader electon enabled, in a HA deployment (that is, >1 replica). Turn this behaviour on with
17+
- Run Escalator with leader election enabled, in a HA deployment (that is, >1 replica). Turn this behaviour on with
1818
`--leader-elect`, see the [Command line options](./configuration/command-line.md) docs for more info. You can also
19-
inspect the leader events with `kubectl describe configmap <configmapname>`, where the default ConfigMap name is
19+
inspect the leader events with `kubectl describe lease <lease-name>`, where the default Lease name is
2020
`escalator-leader-elect`.
2121

2222
## Common Issues & Gotchas

docs/configuration/command-line.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ Flags:
2626
--leader-elect-retry-period=2s
2727
Leader election retry period
2828
--leader-elect-config-namespace="kube-system"
29-
Leader election config map namespace
29+
Leader election lease object namespace
3030
--leader-elect-config-name="escalator-leader-elect"
31-
Leader election config map name
31+
Leader election lease object name
3232
```
3333

3434
## Options
@@ -121,8 +121,8 @@ Sets how long all the clients will wait in between attempts of any action.
121121

122122
### `--leader-elect-config-namespace`
123123

124-
Sets the namespace where the configmap used for locking will be created or looked for.
124+
Sets the namespace where the lease object used for locking will be created or looked for.
125125

126126
### `--leader-elect-config-name`
127127

128-
Sets the name of the configmap used for locking.
128+
Sets the name of the lease object used for locking.

docs/deployment/escalator-rbac.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,22 @@ rules:
3232
- get
3333
- delete
3434
- apiGroups:
35-
- ""
35+
- coordination.k8s.io
36+
resources:
37+
- leases
38+
verbs:
39+
- create
40+
- apiGroups:
41+
- coordination.k8s.io
3642
resourceNames:
3743
- escalator-leader-elect
3844
resources:
39-
- configmaps
45+
- leases
4046
verbs:
41-
- create
4247
- get
43-
- list
44-
- watch
4548
- update
49+
- patch
50+
- delete
4651
- apiGroups:
4752
- ""
4853
resources:

go.mod

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,35 @@
11
module github.com/atlassian/escalator
22

3-
go 1.13
3+
go 1.14
44

55
require (
6-
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
7-
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf
8-
github.com/aws/aws-sdk-go v1.25.40
9-
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
10-
github.com/davecgh/go-spew v1.1.1
11-
github.com/evanphx/json-patch v4.1.0+incompatible
12-
github.com/gogo/protobuf v1.2.1
13-
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef
14-
github.com/golang/protobuf v1.2.0
15-
github.com/google/btree v1.0.0
16-
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf
17-
github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c
18-
github.com/googleapis/gnostic v0.2.0
19-
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc
20-
github.com/hashicorp/golang-lru v0.5.0
21-
github.com/imdario/mergo v0.3.7
22-
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af
23-
github.com/json-iterator/go v1.1.5
24-
github.com/konsorten/go-windows-terminal-sequences v1.0.1
25-
github.com/matttproud/golang_protobuf_extensions v1.0.1
26-
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
27-
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742
28-
github.com/petar/GoLLRB v0.0.0-20130427215148-53be0d36a84c
29-
github.com/peterbourgon/diskv v2.0.1+incompatible
30-
github.com/pkg/errors v0.8.1
31-
github.com/pmezard/go-difflib v1.0.0
32-
github.com/prometheus/client_golang v0.9.2
33-
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
34-
github.com/prometheus/common v0.2.0
35-
github.com/prometheus/procfs v0.0.0-20190225181712-6ed1f7e10411
36-
github.com/sirupsen/logrus v1.3.0
37-
github.com/spf13/pflag v1.0.3
6+
github.com/101loops/bdd v0.0.0-20161224202746-3e71f58e2cc3 // indirect
7+
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
8+
github.com/aws/aws-sdk-go v1.30.7
9+
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
10+
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
11+
github.com/golang/protobuf v1.4.0 // indirect
12+
github.com/google/uuid v1.1.1
13+
github.com/googleapis/gnostic v0.4.0 // indirect
14+
github.com/hashicorp/golang-lru v0.5.4 // indirect
15+
github.com/imdario/mergo v0.3.9 // indirect
16+
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
17+
github.com/kr/pretty v0.2.0 // indirect
18+
github.com/pkg/errors v0.9.1
19+
github.com/prometheus/client_golang v1.5.1
20+
github.com/prometheus/procfs v0.0.11 // indirect
21+
github.com/sirupsen/logrus v1.5.0
3822
github.com/stephanos/clock v0.0.0-20161224195152-e4ec0ab5053e
39-
github.com/stretchr/testify v1.3.0
40-
golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b
41-
golang.org/x/net v0.0.0-20190225153610-fe579d43d832
42-
golang.org/x/oauth2 v0.0.0-20190220154721-9b3c75971fc9
43-
golang.org/x/sys v0.0.0-20190225065934-cc5685c2db12
44-
golang.org/x/text v0.3.0
45-
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
46-
google.golang.org/appengine v1.4.0
23+
github.com/stretchr/testify v1.5.1
24+
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 // indirect
25+
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect
26+
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
27+
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 // indirect
28+
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
29+
google.golang.org/appengine v1.6.5 // indirect
4730
gopkg.in/alecthomas/kingpin.v2 v2.2.6
48-
gopkg.in/inf.v0 v0.9.1
49-
gopkg.in/yaml.v2 v2.2.2
50-
k8s.io/api v0.0.0-20190111032252-67edc246be36
51-
k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93
52-
k8s.io/client-go v10.0.0+incompatible
53-
k8s.io/klog v0.2.0
54-
k8s.io/kube-openapi v0.0.0-20190225204428-d50a959ae76a
55-
k8s.io/kubernetes v1.13.3
56-
sigs.k8s.io/yaml v1.1.0
31+
k8s.io/api v0.18.1
32+
k8s.io/apimachinery v0.18.1
33+
k8s.io/client-go v0.18.1
34+
k8s.io/utils v0.0.0-20200414100711-2df71ebbae66 // indirect
5735
)

0 commit comments

Comments
 (0)