mirror of
https://github.com/outbackdingo/kubernetes.git
synced 2026-01-27 10:19:35 +00:00
chore: depr. pointer pkg replacement for pkg/security and plugin/pkg
This commit is contained in:
@@ -22,7 +22,7 @@ import (
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func TestPodSecurityContextAccessor(t *testing.T) {
|
||||
@@ -278,8 +278,8 @@ func TestPodSecurityContextMutator(t *testing.T) {
|
||||
{
|
||||
modifiedSC := nonNilSC(tc.newSC())
|
||||
m := NewPodSecurityContextMutator(tc.newSC())
|
||||
modifiedSC.SeccompProfile = &api.SeccompProfile{Type: api.SeccompProfileTypeLocalhost, LocalhostProfile: pointer.String("verylocalhostey")}
|
||||
m.SetSeccompProfile(&api.SeccompProfile{Type: api.SeccompProfileTypeLocalhost, LocalhostProfile: pointer.String("verylocalhostey")})
|
||||
modifiedSC.SeccompProfile = &api.SeccompProfile{Type: api.SeccompProfileTypeLocalhost, LocalhostProfile: ptr.To("verylocalhostey")}
|
||||
m.SetSeccompProfile(&api.SeccompProfile{Type: api.SeccompProfileTypeLocalhost, LocalhostProfile: ptr.To("verylocalhostey")})
|
||||
if !reflect.DeepEqual(m.PodSecurityContext(), modifiedSC) {
|
||||
t.Errorf("%s: unexpected object:\n%s", k, diff.ObjectGoPrintSideBySide(modifiedSC, m.PodSecurityContext()))
|
||||
continue
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"testing"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
utilptr "k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func TestAddNoNewPrivileges(t *testing.T) {
|
||||
@@ -188,10 +188,10 @@ func TestDetermineEffectiveRunAsUser(t *testing.T) {
|
||||
},
|
||||
container: &v1.Container{
|
||||
SecurityContext: &v1.SecurityContext{
|
||||
RunAsUser: utilptr.Int64Ptr(1),
|
||||
RunAsUser: ptr.To[int64](1),
|
||||
},
|
||||
},
|
||||
wantRunAsUser: utilptr.Int64Ptr(1),
|
||||
wantRunAsUser: ptr.To[int64](1),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import (
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/networking"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func TestAdmission(t *testing.T) {
|
||||
@@ -134,30 +134,30 @@ func TestAdmission(t *testing.T) {
|
||||
classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
|
||||
classField: nil,
|
||||
classAnnotation: nil,
|
||||
expectedClass: utilpointer.String(defaultClass1.Name),
|
||||
expectedClass: ptr.To(defaultClass1.Name),
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "one default, no modification of Ingress with class field=''",
|
||||
classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
|
||||
classField: utilpointer.String(""),
|
||||
classField: ptr.To(""),
|
||||
classAnnotation: nil,
|
||||
expectedClass: utilpointer.String(""),
|
||||
expectedClass: ptr.To(""),
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "one default, no modification of Ingress with class field='foo'",
|
||||
classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
|
||||
classField: utilpointer.String("foo"),
|
||||
classField: ptr.To("foo"),
|
||||
classAnnotation: nil,
|
||||
expectedClass: utilpointer.String("foo"),
|
||||
expectedClass: ptr.To("foo"),
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "one default, no modification of Ingress with class annotation='foo'",
|
||||
classes: []*networkingv1.IngressClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
|
||||
classField: nil,
|
||||
classAnnotation: utilpointer.String("foo"),
|
||||
classAnnotation: ptr.To("foo"),
|
||||
expectedClass: nil,
|
||||
expectedError: nil,
|
||||
},
|
||||
@@ -166,15 +166,15 @@ func TestAdmission(t *testing.T) {
|
||||
classes: []*networkingv1.IngressClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
|
||||
classField: nil,
|
||||
classAnnotation: nil,
|
||||
expectedClass: utilpointer.String(defaultClass1.Name),
|
||||
expectedClass: ptr.To(defaultClass1.Name),
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "two defaults, no modification with Ingress with class field=''",
|
||||
classes: []*networkingv1.IngressClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
|
||||
classField: utilpointer.String(""),
|
||||
classField: ptr.To(""),
|
||||
classAnnotation: nil,
|
||||
expectedClass: utilpointer.String(""),
|
||||
expectedClass: ptr.To(""),
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
@@ -182,7 +182,7 @@ func TestAdmission(t *testing.T) {
|
||||
classes: []*networkingv1.IngressClass{defaultClassWithCreateTime1, defaultClassWithCreateTime2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
|
||||
classField: nil,
|
||||
classAnnotation: nil,
|
||||
expectedClass: utilpointer.String(defaultClassWithCreateTime1.Name),
|
||||
expectedClass: ptr.To(defaultClassWithCreateTime1.Name),
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/apis/storage"
|
||||
"k8s.io/kubernetes/pkg/auth/nodeidentifier"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func makeTestPod(namespace, name, node string, mirror bool) (*api.Pod, *corev1.Pod) {
|
||||
@@ -321,8 +321,8 @@ func Test_nodePlugin_Admit(t *testing.T) {
|
||||
Namespace: api.NamespaceNodeLease,
|
||||
},
|
||||
Spec: coordination.LeaseSpec{
|
||||
HolderIdentity: pointer.String("mynode"),
|
||||
LeaseDurationSeconds: pointer.Int32(40),
|
||||
HolderIdentity: ptr.To("mynode"),
|
||||
LeaseDurationSeconds: ptr.To[int32](40),
|
||||
RenewTime: &metav1.MicroTime{Time: time.Now()},
|
||||
},
|
||||
}
|
||||
@@ -332,8 +332,8 @@ func Test_nodePlugin_Admit(t *testing.T) {
|
||||
Namespace: "foo",
|
||||
},
|
||||
Spec: coordination.LeaseSpec{
|
||||
HolderIdentity: pointer.String("mynode"),
|
||||
LeaseDurationSeconds: pointer.Int32(40),
|
||||
HolderIdentity: ptr.To("mynode"),
|
||||
LeaseDurationSeconds: ptr.To[int32](40),
|
||||
RenewTime: &metav1.MicroTime{Time: time.Now()},
|
||||
},
|
||||
}
|
||||
@@ -343,8 +343,8 @@ func Test_nodePlugin_Admit(t *testing.T) {
|
||||
Namespace: api.NamespaceNodeLease,
|
||||
},
|
||||
Spec: coordination.LeaseSpec{
|
||||
HolderIdentity: pointer.String("mynode"),
|
||||
LeaseDurationSeconds: pointer.Int32(40),
|
||||
HolderIdentity: ptr.To("mynode"),
|
||||
LeaseDurationSeconds: ptr.To[int32](40),
|
||||
RenewTime: &metav1.MicroTime{Time: time.Now()},
|
||||
},
|
||||
}
|
||||
@@ -569,13 +569,13 @@ func Test_nodePlugin_Admit(t *testing.T) {
|
||||
configmappod.Spec.Volumes = []api.Volume{{VolumeSource: api.VolumeSource{ConfigMap: &api.ConfigMapVolumeSource{LocalObjectReference: api.LocalObjectReference{Name: "foo"}}}}}
|
||||
|
||||
ctbpod, _ := makeTestPod("ns", "myctbpod", "mynode", true)
|
||||
ctbpod.Spec.Volumes = []api.Volume{{VolumeSource: api.VolumeSource{Projected: &api.ProjectedVolumeSource{Sources: []api.VolumeProjection{{ClusterTrustBundle: &api.ClusterTrustBundleProjection{Name: pointer.String("foo")}}}}}}}
|
||||
ctbpod.Spec.Volumes = []api.Volume{{VolumeSource: api.VolumeSource{Projected: &api.ProjectedVolumeSource{Sources: []api.VolumeProjection{{ClusterTrustBundle: &api.ClusterTrustBundleProjection{Name: ptr.To("foo")}}}}}}}
|
||||
|
||||
pvcpod, _ := makeTestPod("ns", "mypvcpod", "mynode", true)
|
||||
pvcpod.Spec.Volumes = []api.Volume{{VolumeSource: api.VolumeSource{PersistentVolumeClaim: &api.PersistentVolumeClaimVolumeSource{ClaimName: "foo"}}}}
|
||||
|
||||
claimpod, _ := makeTestPod("ns", "myclaimpod", "mynode", true)
|
||||
claimpod.Spec.ResourceClaims = []api.PodResourceClaim{{Name: "myclaim", ResourceClaimName: pointer.String("myexternalclaim")}}
|
||||
claimpod.Spec.ResourceClaims = []api.PodResourceClaim{{Name: "myclaim", ResourceClaimName: ptr.To("myexternalclaim")}}
|
||||
|
||||
tests := []admitTestCase{
|
||||
// Mirror pods bound to us
|
||||
@@ -1789,7 +1789,7 @@ func Test_nodePlugin_Admit_OwnerReference(t *testing.T) {
|
||||
Kind: "Node",
|
||||
Name: "mynode",
|
||||
UID: "mynode-uid",
|
||||
Controller: pointer.BoolPtr(true),
|
||||
Controller: ptr.To(true),
|
||||
}
|
||||
invalidName := validOwner
|
||||
invalidName.Name = "other"
|
||||
@@ -1800,9 +1800,9 @@ func Test_nodePlugin_Admit_OwnerReference(t *testing.T) {
|
||||
invalidControllerNil := validOwner
|
||||
invalidControllerNil.Controller = nil
|
||||
invalidControllerFalse := validOwner
|
||||
invalidControllerFalse.Controller = pointer.BoolPtr(false)
|
||||
invalidControllerFalse.Controller = ptr.To(false)
|
||||
invalidBlockDeletion := validOwner
|
||||
invalidBlockDeletion.BlockOwnerDeletion = pointer.BoolPtr(true)
|
||||
invalidBlockDeletion.BlockOwnerDeletion = ptr.To(true)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -2163,7 +2163,7 @@ func TestAdmitResourceSlice(t *testing.T) {
|
||||
Name: "something",
|
||||
},
|
||||
Spec: resourceapi.ResourceSliceSpec{
|
||||
NodeName: pointer.String(nodename),
|
||||
NodeName: ptr.To(nodename),
|
||||
},
|
||||
}
|
||||
sliceOtherNode := &resourceapi.ResourceSlice{
|
||||
@@ -2171,7 +2171,7 @@ func TestAdmitResourceSlice(t *testing.T) {
|
||||
Name: "something",
|
||||
},
|
||||
Spec: resourceapi.ResourceSliceSpec{
|
||||
NodeName: pointer.String(nodename + "-other"),
|
||||
NodeName: ptr.To(nodename + "-other"),
|
||||
},
|
||||
}
|
||||
sliceNoNode := &resourceapi.ResourceSlice{
|
||||
|
||||
@@ -39,7 +39,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/apis/core"
|
||||
v1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||
podsecurityadmission "k8s.io/pod-security-admission/admission"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
|
||||
@@ -219,14 +219,14 @@ func BenchmarkVerifyNamespace(b *testing.B) {
|
||||
Kind: "ReplicaSet",
|
||||
Name: "myapp-123123",
|
||||
UID: types.UID("7610a7f4-8f80-4f88-95b5-6cefdd8e9dbd"),
|
||||
Controller: pointer.Bool(true),
|
||||
Controller: ptr.To(true),
|
||||
}
|
||||
ownerB := metav1.OwnerReference{
|
||||
APIVersion: "apps/v1",
|
||||
Kind: "ReplicaSet",
|
||||
Name: "myapp-234234",
|
||||
UID: types.UID("7610a7f4-8f80-4f88-95b5-as765as76f55"),
|
||||
Controller: pointer.Bool(true),
|
||||
Controller: ptr.To(true),
|
||||
}
|
||||
|
||||
// number of warnings printed for the entire namespace
|
||||
|
||||
@@ -38,7 +38,7 @@ import (
|
||||
podutil "k8s.io/kubernetes/pkg/api/pod"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/serviceaccount"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -485,7 +485,7 @@ func (s *Plugin) mountServiceAccountToken(serviceAccount *corev1.ServiceAccount,
|
||||
func TokenVolumeSource() *api.ProjectedVolumeSource {
|
||||
return &api.ProjectedVolumeSource{
|
||||
// explicitly set default value, see #104464
|
||||
DefaultMode: pointer.Int32(corev1.ProjectedVolumeSourceDefaultMode),
|
||||
DefaultMode: ptr.To[int32](corev1.ProjectedVolumeSourceDefaultMode),
|
||||
Sources: []api.VolumeProjection{
|
||||
{
|
||||
ServiceAccountToken: &api.ServiceAccountTokenProjection{
|
||||
|
||||
@@ -35,7 +35,7 @@ import (
|
||||
v1defaults "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
kubelet "k8s.io/kubernetes/pkg/kubelet/types"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func TestIgnoresNonCreate(t *testing.T) {
|
||||
@@ -200,7 +200,7 @@ func TestAssignsDefaultServiceAccountAndBoundTokenWithNoSecretTokens(t *testing.
|
||||
{ConfigMap: &api.ConfigMapProjection{LocalObjectReference: api.LocalObjectReference{Name: "kube-root-ca.crt"}, Items: []api.KeyToPath{{Key: "ca.crt", Path: "ca.crt"}}}},
|
||||
{DownwardAPI: &api.DownwardAPIProjection{Items: []api.DownwardAPIVolumeFile{{Path: "namespace", FieldRef: &api.ObjectFieldSelector{APIVersion: "v1", FieldPath: "metadata.namespace"}}}}},
|
||||
},
|
||||
DefaultMode: utilpointer.Int32(0644),
|
||||
DefaultMode: ptr.To[int32](0644),
|
||||
},
|
||||
},
|
||||
}}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
- k8s.io/kubernetes/pkg/fieldpath
|
||||
- k8s.io/kubernetes/pkg/util
|
||||
- k8s.io/api/core/v1
|
||||
- k8s.io/utils/pointer
|
||||
- k8s.io/utils/ptr
|
||||
- k8s.io/utils/net
|
||||
- k8s.io/klog
|
||||
|
||||
10
vendor/k8s.io/utils/pointer/OWNERS
generated
vendored
10
vendor/k8s.io/utils/pointer/OWNERS
generated
vendored
@@ -1,10 +0,0 @@
|
||||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
|
||||
approvers:
|
||||
- apelisse
|
||||
- stewart-yu
|
||||
- thockin
|
||||
reviewers:
|
||||
- apelisse
|
||||
- stewart-yu
|
||||
- thockin
|
||||
3
vendor/k8s.io/utils/pointer/README.md
generated
vendored
3
vendor/k8s.io/utils/pointer/README.md
generated
vendored
@@ -1,3 +0,0 @@
|
||||
# Pointer
|
||||
|
||||
This package provides some functions for pointer-based operations.
|
||||
249
vendor/k8s.io/utils/pointer/pointer.go
generated
vendored
249
vendor/k8s.io/utils/pointer/pointer.go
generated
vendored
@@ -1,249 +0,0 @@
|
||||
/*
|
||||
Copyright 2018 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.
|
||||
*/
|
||||
|
||||
// Deprecated: Use functions in k8s.io/utils/ptr instead: ptr.To to obtain
|
||||
// a pointer, ptr.Deref to dereference a pointer, ptr.Equal to compare
|
||||
// dereferenced pointers.
|
||||
package pointer
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
// AllPtrFieldsNil tests whether all pointer fields in a struct are nil. This is useful when,
|
||||
// for example, an API struct is handled by plugins which need to distinguish
|
||||
// "no plugin accepted this spec" from "this spec is empty".
|
||||
//
|
||||
// This function is only valid for structs and pointers to structs. Any other
|
||||
// type will cause a panic. Passing a typed nil pointer will return true.
|
||||
//
|
||||
// Deprecated: Use ptr.AllPtrFieldsNil instead.
|
||||
var AllPtrFieldsNil = ptr.AllPtrFieldsNil
|
||||
|
||||
// Int returns a pointer to an int.
|
||||
var Int = ptr.To[int]
|
||||
|
||||
// IntPtr is a function variable referring to Int.
|
||||
//
|
||||
// Deprecated: Use ptr.To instead.
|
||||
var IntPtr = Int // for back-compat
|
||||
|
||||
// IntDeref dereferences the int ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
var IntDeref = ptr.Deref[int]
|
||||
|
||||
// IntPtrDerefOr is a function variable referring to IntDeref.
|
||||
//
|
||||
// Deprecated: Use ptr.Deref instead.
|
||||
var IntPtrDerefOr = IntDeref // for back-compat
|
||||
|
||||
// Int32 returns a pointer to an int32.
|
||||
var Int32 = ptr.To[int32]
|
||||
|
||||
// Int32Ptr is a function variable referring to Int32.
|
||||
//
|
||||
// Deprecated: Use ptr.To instead.
|
||||
var Int32Ptr = Int32 // for back-compat
|
||||
|
||||
// Int32Deref dereferences the int32 ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
var Int32Deref = ptr.Deref[int32]
|
||||
|
||||
// Int32PtrDerefOr is a function variable referring to Int32Deref.
|
||||
//
|
||||
// Deprecated: Use ptr.Deref instead.
|
||||
var Int32PtrDerefOr = Int32Deref // for back-compat
|
||||
|
||||
// Int32Equal returns true if both arguments are nil or both arguments
|
||||
// dereference to the same value.
|
||||
var Int32Equal = ptr.Equal[int32]
|
||||
|
||||
// Uint returns a pointer to an uint
|
||||
var Uint = ptr.To[uint]
|
||||
|
||||
// UintPtr is a function variable referring to Uint.
|
||||
//
|
||||
// Deprecated: Use ptr.To instead.
|
||||
var UintPtr = Uint // for back-compat
|
||||
|
||||
// UintDeref dereferences the uint ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
var UintDeref = ptr.Deref[uint]
|
||||
|
||||
// UintPtrDerefOr is a function variable referring to UintDeref.
|
||||
//
|
||||
// Deprecated: Use ptr.Deref instead.
|
||||
var UintPtrDerefOr = UintDeref // for back-compat
|
||||
|
||||
// Uint32 returns a pointer to an uint32.
|
||||
var Uint32 = ptr.To[uint32]
|
||||
|
||||
// Uint32Ptr is a function variable referring to Uint32.
|
||||
//
|
||||
// Deprecated: Use ptr.To instead.
|
||||
var Uint32Ptr = Uint32 // for back-compat
|
||||
|
||||
// Uint32Deref dereferences the uint32 ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
var Uint32Deref = ptr.Deref[uint32]
|
||||
|
||||
// Uint32PtrDerefOr is a function variable referring to Uint32Deref.
|
||||
//
|
||||
// Deprecated: Use ptr.Deref instead.
|
||||
var Uint32PtrDerefOr = Uint32Deref // for back-compat
|
||||
|
||||
// Uint32Equal returns true if both arguments are nil or both arguments
|
||||
// dereference to the same value.
|
||||
var Uint32Equal = ptr.Equal[uint32]
|
||||
|
||||
// Int64 returns a pointer to an int64.
|
||||
var Int64 = ptr.To[int64]
|
||||
|
||||
// Int64Ptr is a function variable referring to Int64.
|
||||
//
|
||||
// Deprecated: Use ptr.To instead.
|
||||
var Int64Ptr = Int64 // for back-compat
|
||||
|
||||
// Int64Deref dereferences the int64 ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
var Int64Deref = ptr.Deref[int64]
|
||||
|
||||
// Int64PtrDerefOr is a function variable referring to Int64Deref.
|
||||
//
|
||||
// Deprecated: Use ptr.Deref instead.
|
||||
var Int64PtrDerefOr = Int64Deref // for back-compat
|
||||
|
||||
// Int64Equal returns true if both arguments are nil or both arguments
|
||||
// dereference to the same value.
|
||||
var Int64Equal = ptr.Equal[int64]
|
||||
|
||||
// Uint64 returns a pointer to an uint64.
|
||||
var Uint64 = ptr.To[uint64]
|
||||
|
||||
// Uint64Ptr is a function variable referring to Uint64.
|
||||
//
|
||||
// Deprecated: Use ptr.To instead.
|
||||
var Uint64Ptr = Uint64 // for back-compat
|
||||
|
||||
// Uint64Deref dereferences the uint64 ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
var Uint64Deref = ptr.Deref[uint64]
|
||||
|
||||
// Uint64PtrDerefOr is a function variable referring to Uint64Deref.
|
||||
//
|
||||
// Deprecated: Use ptr.Deref instead.
|
||||
var Uint64PtrDerefOr = Uint64Deref // for back-compat
|
||||
|
||||
// Uint64Equal returns true if both arguments are nil or both arguments
|
||||
// dereference to the same value.
|
||||
var Uint64Equal = ptr.Equal[uint64]
|
||||
|
||||
// Bool returns a pointer to a bool.
|
||||
var Bool = ptr.To[bool]
|
||||
|
||||
// BoolPtr is a function variable referring to Bool.
|
||||
//
|
||||
// Deprecated: Use ptr.To instead.
|
||||
var BoolPtr = Bool // for back-compat
|
||||
|
||||
// BoolDeref dereferences the bool ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
var BoolDeref = ptr.Deref[bool]
|
||||
|
||||
// BoolPtrDerefOr is a function variable referring to BoolDeref.
|
||||
//
|
||||
// Deprecated: Use ptr.Deref instead.
|
||||
var BoolPtrDerefOr = BoolDeref // for back-compat
|
||||
|
||||
// BoolEqual returns true if both arguments are nil or both arguments
|
||||
// dereference to the same value.
|
||||
var BoolEqual = ptr.Equal[bool]
|
||||
|
||||
// String returns a pointer to a string.
|
||||
var String = ptr.To[string]
|
||||
|
||||
// StringPtr is a function variable referring to String.
|
||||
//
|
||||
// Deprecated: Use ptr.To instead.
|
||||
var StringPtr = String // for back-compat
|
||||
|
||||
// StringDeref dereferences the string ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
var StringDeref = ptr.Deref[string]
|
||||
|
||||
// StringPtrDerefOr is a function variable referring to StringDeref.
|
||||
//
|
||||
// Deprecated: Use ptr.Deref instead.
|
||||
var StringPtrDerefOr = StringDeref // for back-compat
|
||||
|
||||
// StringEqual returns true if both arguments are nil or both arguments
|
||||
// dereference to the same value.
|
||||
var StringEqual = ptr.Equal[string]
|
||||
|
||||
// Float32 returns a pointer to a float32.
|
||||
var Float32 = ptr.To[float32]
|
||||
|
||||
// Float32Ptr is a function variable referring to Float32.
|
||||
//
|
||||
// Deprecated: Use ptr.To instead.
|
||||
var Float32Ptr = Float32
|
||||
|
||||
// Float32Deref dereferences the float32 ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
var Float32Deref = ptr.Deref[float32]
|
||||
|
||||
// Float32PtrDerefOr is a function variable referring to Float32Deref.
|
||||
//
|
||||
// Deprecated: Use ptr.Deref instead.
|
||||
var Float32PtrDerefOr = Float32Deref // for back-compat
|
||||
|
||||
// Float32Equal returns true if both arguments are nil or both arguments
|
||||
// dereference to the same value.
|
||||
var Float32Equal = ptr.Equal[float32]
|
||||
|
||||
// Float64 returns a pointer to a float64.
|
||||
var Float64 = ptr.To[float64]
|
||||
|
||||
// Float64Ptr is a function variable referring to Float64.
|
||||
//
|
||||
// Deprecated: Use ptr.To instead.
|
||||
var Float64Ptr = Float64
|
||||
|
||||
// Float64Deref dereferences the float64 ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
var Float64Deref = ptr.Deref[float64]
|
||||
|
||||
// Float64PtrDerefOr is a function variable referring to Float64Deref.
|
||||
//
|
||||
// Deprecated: Use ptr.Deref instead.
|
||||
var Float64PtrDerefOr = Float64Deref // for back-compat
|
||||
|
||||
// Float64Equal returns true if both arguments are nil or both arguments
|
||||
// dereference to the same value.
|
||||
var Float64Equal = ptr.Equal[float64]
|
||||
|
||||
// Duration returns a pointer to a time.Duration.
|
||||
var Duration = ptr.To[time.Duration]
|
||||
|
||||
// DurationDeref dereferences the time.Duration ptr and returns it if not nil, or else
|
||||
// returns def.
|
||||
var DurationDeref = ptr.Deref[time.Duration]
|
||||
|
||||
// DurationEqual returns true if both arguments are nil or both arguments
|
||||
// dereference to the same value.
|
||||
var DurationEqual = ptr.Equal[time.Duration]
|
||||
1
vendor/modules.txt
vendored
1
vendor/modules.txt
vendored
@@ -1180,7 +1180,6 @@ k8s.io/utils/keymutex
|
||||
k8s.io/utils/lru
|
||||
k8s.io/utils/net
|
||||
k8s.io/utils/path
|
||||
k8s.io/utils/pointer
|
||||
k8s.io/utils/ptr
|
||||
k8s.io/utils/strings
|
||||
k8s.io/utils/trace
|
||||
|
||||
Reference in New Issue
Block a user