Skip to content

Commit

Permalink
Migrated leader election to lease API
Browse files Browse the repository at this point in the history
  • Loading branch information
NikhilSharmaWe committed May 31, 2022
1 parent a35bec6 commit e0c7be1
Show file tree
Hide file tree
Showing 10 changed files with 403 additions and 101 deletions.
4 changes: 2 additions & 2 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -865,11 +865,11 @@ func (ctrl *ProvisionController) Run(ctx context.Context) {
go ctrl.volumeStore.Run(ctx, DefaultThreadiness)

if ctrl.leaderElection {
rl, err := resourcelock.New("endpoints",
rl, err := resourcelock.New(resourcelock.EndpointsLeasesResourceLock,
ctrl.leaderElectionNamespace,
strings.Replace(ctrl.provisionerName, "/", "-", -1),
ctrl.client.CoreV1(),
nil,
ctrl.client.CoordinationV1(),
resourcelock.ResourceLockConfig{
Identity: ctrl.id,
EventRecorder: ctrl.eventRecorder,
Expand Down
13 changes: 5 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ go 1.16

require (
github.com/miekg/dns v1.1.29
github.com/onsi/ginkgo v1.12.0 // indirect
github.com/onsi/gomega v1.9.0 // indirect
github.com/prometheus/client_golang v1.5.1
github.com/prometheus/client_model v0.2.0
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
k8s.io/api v0.19.1
k8s.io/apimachinery v0.19.1
k8s.io/client-go v0.19.1
k8s.io/klog/v2 v2.3.0
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
k8s.io/api v0.24.0
k8s.io/apimachinery v0.24.0
k8s.io/client-go v0.24.0
k8s.io/klog/v2 v2.60.1
)
469 changes: 386 additions & 83 deletions go.sum

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions mount/mountinfo_linux.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux
// +build linux

/*
Expand Down
1 change: 1 addition & 0 deletions mount/mountinfo_unsupported.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build (!windows && !linux && !freebsd && !solaris) || (freebsd && !cgo) || (solaris && !cgo)
// +build !windows,!linux,!freebsd,!solaris freebsd,!cgo solaris,!cgo

/*
Expand Down
6 changes: 3 additions & 3 deletions repo-infra/verify/boilerplate/boilerplate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2015 The Kubernetes Authors.
#
Expand Down Expand Up @@ -181,8 +181,8 @@ def get_regexs():
# dates can be 2014, 2015, 2016, ..., CURRENT_YEAR, company holder names can be anything
years = range(2014, date.today().year + 1)
regexs["date"] = re.compile( '(%s)' % "|".join(map(lambda l: str(l), years)) )
# strip // +build \n\n build constraints
regexs["go_build_constraints"] = re.compile(r"^(// \+build.*\n)+\n", re.MULTILINE)
# strip (//go:build \n\n) and (// +build \n\n) build constraints
regexs["go_build_constraints"] = re.compile(r"^(//(go:| \+)build.*\n)+\n", re.MULTILINE)
# strip #!.* from shell scripts
regexs["shebang"] = re.compile(r"^(#!.*\n)\n*", re.MULTILINE)
return regexs
Expand Down
4 changes: 2 additions & 2 deletions repo-infra/verify/boilerplate/boilerplate_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2016 The Kubernetes Authors.
#
Expand Down Expand Up @@ -28,7 +28,7 @@ class TestBoilerplate(unittest.TestCase):
"""
Note: run this test from the hack/boilerplate directory.
$ python -m unittest boilerplate_test
$ python3 -m unittest boilerplate_test
"""

def test_boilerplate(self):
Expand Down
2 changes: 1 addition & 1 deletion repo-infra/verify/boilerplate/test/fail.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2015 The Kubernetes Authors.
#
Expand Down
2 changes: 1 addition & 1 deletion repo-infra/verify/boilerplate/test/pass.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2015 The Kubernetes Authors.
#
Expand Down
2 changes: 1 addition & 1 deletion repo-infra/verify/verify-boilerplate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ cleanup() {
}

pushd "${boilerDir}" >/dev/null
if ! python -m unittest boilerplate_test 2>"${unitTestOut}"; then
if ! python3 -m unittest boilerplate_test 2>"${unitTestOut}"; then
echo "boilerplate_test.py failed"
echo
cat "${unitTestOut}"
Expand Down

0 comments on commit e0c7be1

Please sign in to comment.