Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
eea2092
pkg/cvo/sync_worker: Generalize CancelError to ContextError
wking May 28, 2020
adf8fd6
pkg/cvo/sync_worker: Do not treat "All errors were context errors..."…
wking May 28, 2020
99f6ba5
Merge pull request #378 from openshift-cherrypick-robot/cherry-pick-3…
openshift-merge-robot Jun 3, 2020
202578a
Expand supported set of probe field mutations
ironcladlou Jun 15, 2020
40ec7e4
Merge pull request #389 from openshift-cherrypick-robot/cherry-pick-3…
openshift-merge-robot Jun 19, 2020
2326bcc
Bug 1855577: Updating the golang.org/x/text version to v0.3.3
LalatenduMohanty Jul 14, 2020
dc662b7
pkg/cvo: Set NoDesiredImage reason when desired.Image is empty
wking May 27, 2020
f00e20f
pkg/cvo/status: Raise Operator leveling grace-period to 20 minutes
wking Jul 31, 2020
b0f92e5
Merge pull request #427 from wking/raise-operator-leveling-timeout-4.5
openshift-merge-robot Aug 19, 2020
9713dc5
Merge pull request #409 from openshift-cherrypick-robot/cherry-pick-4…
openshift-merge-robot Aug 20, 2020
55ff603
pkg/start: Drop the internal EnableMetrics
wking Apr 15, 2020
d257c32
pkg/cvo/metrics: Graceful server shutdown
wking Apr 15, 2020
f8774c0
pkg/start: Register metrics directly
wking Apr 15, 2020
d8ca134
pkg/cvo/egress: Pull HTTPS/Proxy egress into separate file
wking Apr 21, 2020
905b305
pkg/start: Release leader lease on graceful shutdown
wking Aug 3, 2020
c8af639
pkg/start/start_integration_test: Do not assume "deleted" for ConfigM…
wking Aug 5, 2020
c8f99b2
pkg/start: Fill in deferred HandleCrash
wking Aug 6, 2020
a42bfb7
cmd/start: Include the version in the outgoing log line
wking Aug 25, 2020
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
Prev Previous commit
Next Next commit
pkg/start/start_integration_test: Do not assume "deleted" for ConfigM…
…ap lock release

From the godocs:

  $ grep -A5 '// HolderIdentity' vendor/k8s.io/client-go/tools/leaderelection/resourcelock/interface.go
    // HolderIdentity is the ID that owns the lease. If empty, no one owns this lease and
    // all callers may acquire. Versions of this library prior to Kubernetes 1.14 will not
    // attempt to acquire leases with empty identities and will wait for the full lease
    // interval to expire before attempting to reacquire. This value is set to empty when
    // a client voluntarily steps down.
    HolderIdentity       string      `json:"holderIdentity"`

The previous assumption that the release would involve ConfigMap
deletion was born with the test in 2b81f47 (cvo: Release our leader
lease when we are gracefully terminated, 2019-01-16, #87).

Cherry picked from dd09c3f (#424), around conflicts due to the lack
of Context pivots in 4.5.
  • Loading branch information
wking committed Aug 27, 2020
commit c8af6398088d8e6d7259664d066b7ffdc57d4676
18 changes: 9 additions & 9 deletions pkg/start/start_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ func TestIntegrationCVO_gracefulStepDown(t *testing.T) {

// wait until the lock record exists
err = wait.PollImmediate(200*time.Millisecond, 60*time.Second, func() (bool, error) {
_, err := kc.CoreV1().ConfigMaps(ns).Get(ns, metav1.GetOptions{})
_, _, err := lock.Get()
if err != nil {
if errors.IsNotFound(err) {
return false, nil
Expand All @@ -548,26 +548,26 @@ func TestIntegrationCVO_gracefulStepDown(t *testing.T) {
t.Fatalf("no leader election events found in\n%#v", events.Items)
}

t.Logf("after the context is closed, the lock record should be deleted quickly")
t.Logf("after the context is closed, the lock should be released quickly")
cancel()
startTime := time.Now()
var endTime time.Time
// the lock should be deleted immediately
err = wait.PollImmediate(100*time.Millisecond, 10*time.Second, func() (bool, error) {
_, err := kc.CoreV1().ConfigMaps(ns).Get(ns, metav1.GetOptions{})
if errors.IsNotFound(err) {
endTime = time.Now()
return true, nil
}
electionRecord, _, err := lock.Get()
if err != nil {
if errors.IsNotFound(err) {
return false, nil
}
return false, err
}
return false, nil
endTime = time.Now()
return electionRecord.HolderIdentity == "", nil
})
if err != nil {
t.Fatal(err)
}
t.Logf("lock deleted in %s", endTime.Sub(startTime))
t.Logf("lock released in %s", endTime.Sub(startTime))

select {
case <-time.After(time.Second):
Expand Down