Merge pull request #120631 from liyuerich/ptrderef

Drop deprecated pointer package
This commit is contained in:
Kubernetes Prow Robot 2024-01-24 19:51:24 +01:00 committed by GitHub
commit fb1aea9a28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 7 deletions

View File

@ -24,7 +24,7 @@ import (
"k8s.io/kubernetes/pkg/api/pod"
"k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)
const (
@ -36,8 +36,8 @@ const (
func WarningsForJobSpec(ctx context.Context, path *field.Path, spec, oldSpec *batch.JobSpec) []string {
var warnings []string
if spec.CompletionMode != nil && *spec.CompletionMode == batch.IndexedCompletion {
completions := pointer.Int32Deref(spec.Completions, 0)
parallelism := pointer.Int32Deref(spec.Parallelism, 0)
completions := ptr.Deref(spec.Completions, 0)
parallelism := ptr.Deref(spec.Parallelism, 0)
if completions > completionsSoftLimit && parallelism > parallelismSoftLimitForUnlimitedCompletions {
msg := "In Indexed Jobs with a number of completions higher than 10^5 and a parallelism higher than 10^4, Kubernetes might not be able to track completedIndexes when a big number of indexes fail"
warnings = append(warnings, fmt.Sprintf("%s: %s", path, msg))

View File

@ -32,7 +32,7 @@ import (
apivalidation "k8s.io/kubernetes/pkg/apis/core/validation"
"k8s.io/kubernetes/pkg/apis/networking"
netutils "k8s.io/utils/net"
utilpointer "k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)
const (
@ -593,7 +593,7 @@ func validateIngressClassParametersReference(params *networking.IngressClassPara
return allErrs
}
scope := utilpointer.StringDeref(params.Scope, "")
scope := ptr.Deref(params.Scope, "")
if !supportedIngressClassParametersReferenceScopes.Has(scope) {
allErrs = append(allErrs, field.NotSupported(fldPath.Child("scope"), scope,

View File

@ -25,6 +25,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
utilpointer "k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)
type mockStrategy struct {
@ -295,10 +296,10 @@ func TestBeforeDelete(t *testing.T) {
t.Errorf("BeforeDelete() gotGracefulPending = %v, want %v", gotGracefulPending, tt.wantGracefulPending)
}
if !utilpointer.Int64Equal(tt.args.pod.DeletionGracePeriodSeconds, tt.wantDeletionGracePeriodSeconds) {
t.Errorf("metadata.DeletionGracePeriodSeconds = %v, want %v", utilpointer.Int64Deref(tt.args.pod.DeletionGracePeriodSeconds, 0), utilpointer.Int64Deref(tt.wantDeletionGracePeriodSeconds, 0))
t.Errorf("metadata.DeletionGracePeriodSeconds = %v, want %v", ptr.Deref(tt.args.pod.DeletionGracePeriodSeconds, 0), ptr.Deref(tt.wantDeletionGracePeriodSeconds, 0))
}
if !utilpointer.Int64Equal(tt.args.options.GracePeriodSeconds, tt.wantGracePeriodSeconds) {
t.Errorf("options.GracePeriodSeconds = %v, want %v", utilpointer.Int64Deref(tt.args.options.GracePeriodSeconds, 0), utilpointer.Int64Deref(tt.wantGracePeriodSeconds, 0))
t.Errorf("options.GracePeriodSeconds = %v, want %v", ptr.Deref(tt.args.options.GracePeriodSeconds, 0), ptr.Deref(tt.wantGracePeriodSeconds, 0))
}
})
}