mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: update kubernetes dep to 1.24.0
As kubernetes 1.24.0 is released, updating kubernetes dependencies to 1.24.0 updates: #3086 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
fc1529f268
commit
c4f79d455f
10
vendor/k8s.io/utils/clock/clock.go
generated
vendored
10
vendor/k8s.io/utils/clock/clock.go
generated
vendored
@ -63,6 +63,16 @@ type WithDelayedExecution interface {
|
||||
AfterFunc(d time.Duration, f func()) Timer
|
||||
}
|
||||
|
||||
// WithTickerAndDelayedExecution allows for injecting fake or real clocks
|
||||
// into code that needs Ticker and AfterFunc functionality
|
||||
type WithTickerAndDelayedExecution interface {
|
||||
WithTicker
|
||||
// AfterFunc executes f in its own goroutine after waiting
|
||||
// for d duration and returns a Timer whose channel can be
|
||||
// closed by calling Stop() on the Timer.
|
||||
AfterFunc(d time.Duration, f func()) Timer
|
||||
}
|
||||
|
||||
// Ticker defines the Ticker interface.
|
||||
type Ticker interface {
|
||||
C() <-chan time.Time
|
||||
|
9
vendor/k8s.io/utils/clock/testing/fake_clock.go
generated
vendored
9
vendor/k8s.io/utils/clock/testing/fake_clock.go
generated
vendored
@ -239,7 +239,8 @@ func (f *FakeClock) Sleep(d time.Duration) {
|
||||
|
||||
// IntervalClock implements clock.PassiveClock, but each invocation of Now steps the clock forward the specified duration.
|
||||
// IntervalClock technically implements the other methods of clock.Clock, but each implementation is just a panic.
|
||||
// See SimpleIntervalClock for an alternative that only has the methods of PassiveClock.
|
||||
//
|
||||
// Deprecated: See SimpleIntervalClock for an alternative that only has the methods of PassiveClock.
|
||||
type IntervalClock struct {
|
||||
Time time.Time
|
||||
Duration time.Duration
|
||||
@ -282,9 +283,9 @@ func (*IntervalClock) Tick(d time.Duration) <-chan time.Time {
|
||||
|
||||
// NewTicker has no implementation yet and is omitted.
|
||||
// TODO: make interval clock use FakeClock so this can be implemented.
|
||||
//func (*IntervalClock) NewTicker(d time.Duration) clock.Ticker {
|
||||
// panic("IntervalClock doesn't implement NewTicker")
|
||||
//}
|
||||
func (*IntervalClock) NewTicker(d time.Duration) clock.Ticker {
|
||||
panic("IntervalClock doesn't implement NewTicker")
|
||||
}
|
||||
|
||||
// Sleep is unimplemented, will panic.
|
||||
func (*IntervalClock) Sleep(d time.Duration) {
|
||||
|
31
vendor/k8s.io/utils/pointer/pointer.go
generated
vendored
31
vendor/k8s.io/utils/pointer/pointer.go
generated
vendored
@ -19,6 +19,7 @@ package pointer
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
)
|
||||
|
||||
// AllPtrFieldsNil tests whether all pointer fields in a struct are nil. This is useful when,
|
||||
@ -184,7 +185,7 @@ func StringEqual(a, b *string) bool {
|
||||
return *a == *b
|
||||
}
|
||||
|
||||
// Float32 returns a pointer to the a float32.
|
||||
// Float32 returns a pointer to a float32.
|
||||
func Float32(i float32) *float32 {
|
||||
return &i
|
||||
}
|
||||
@ -214,7 +215,7 @@ func Float32Equal(a, b *float32) bool {
|
||||
return *a == *b
|
||||
}
|
||||
|
||||
// Float64 returns a pointer to the a float64.
|
||||
// Float64 returns a pointer to a float64.
|
||||
func Float64(i float64) *float64 {
|
||||
return &i
|
||||
}
|
||||
@ -243,3 +244,29 @@ func Float64Equal(a, b *float64) bool {
|
||||
}
|
||||
return *a == *b
|
||||
}
|
||||
|
||||
// Duration returns a pointer to a time.Duration.
|
||||
func Duration(d time.Duration) *time.Duration {
|
||||
return &d
|
||||
}
|
||||
|
||||
// DurationDeref dereferences the time.Duration ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
func DurationDeref(ptr *time.Duration, def time.Duration) time.Duration {
|
||||
if ptr != nil {
|
||||
return *ptr
|
||||
}
|
||||
return def
|
||||
}
|
||||
|
||||
// DurationEqual returns true if both arguments are nil or both arguments
|
||||
// dereference to the same value.
|
||||
func DurationEqual(a, b *time.Duration) bool {
|
||||
if (a == nil) != (b == nil) {
|
||||
return false
|
||||
}
|
||||
if a == nil {
|
||||
return true
|
||||
}
|
||||
return *a == *b
|
||||
}
|
||||
|
82
vendor/k8s.io/utils/strings/slices/slices.go
generated
vendored
Normal file
82
vendor/k8s.io/utils/strings/slices/slices.go
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
Copyright 2021 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package slices defines various functions useful with slices of string type.
|
||||
// The goal is to be as close as possible to
|
||||
// https://github.com/golang/go/issues/45955. Ideal would be if we can just
|
||||
// replace "stringslices" if the "slices" package becomes standard.
|
||||
package slices
|
||||
|
||||
// Equal reports whether two slices are equal: the same length and all
|
||||
// elements equal. If the lengths are different, Equal returns false.
|
||||
// Otherwise, the elements are compared in index order, and the
|
||||
// comparison stops at the first unequal pair.
|
||||
func Equal(s1, s2 []string) bool {
|
||||
if len(s1) != len(s2) {
|
||||
return false
|
||||
}
|
||||
for i, n := range s1 {
|
||||
if n != s2[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Filter appends to d each element e of s for which keep(e) returns true.
|
||||
// It returns the modified d. d may be s[:0], in which case the kept
|
||||
// elements will be stored in the same slice.
|
||||
// if the slices overlap in some other way, the results are unspecified.
|
||||
// To create a new slice with the filtered results, pass nil for d.
|
||||
func Filter(d, s []string, keep func(string) bool) []string {
|
||||
for _, n := range s {
|
||||
if keep(n) {
|
||||
d = append(d, n)
|
||||
}
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// Contains reports whether v is present in s.
|
||||
func Contains(s []string, v string) bool {
|
||||
return Index(s, v) >= 0
|
||||
}
|
||||
|
||||
// Index returns the index of the first occurrence of v in s, or -1 if
|
||||
// not present.
|
||||
func Index(s []string, v string) int {
|
||||
// "Contains" may be replaced with "Index(s, v) >= 0":
|
||||
// https://github.com/golang/go/issues/45955#issuecomment-873377947
|
||||
for i, n := range s {
|
||||
if n == v {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// Functions below are not in https://github.com/golang/go/issues/45955
|
||||
|
||||
// Clone returns a new clone of s.
|
||||
func Clone(s []string) []string {
|
||||
// https://github.com/go101/go101/wiki/There-is-not-a-perfect-way-to-clone-slices-in-Go
|
||||
if s == nil {
|
||||
return nil
|
||||
}
|
||||
c := make([]string, len(s))
|
||||
copy(c, s)
|
||||
return c
|
||||
}
|
Reference in New Issue
Block a user