@@ -47,7 +47,7 @@ import (
47
47
"k8s.io/kubernetes/pkg/volume/emptydir"
48
48
volumetest "k8s.io/kubernetes/pkg/volume/testing"
49
49
"k8s.io/kubernetes/pkg/volume/util"
50
- utilptr "k8s.io/utils/pointer "
50
+ "k8s.io/utils/ptr "
51
51
)
52
52
53
53
func TestCollectDataWithSecret (t * testing.T ) {
@@ -260,7 +260,7 @@ func TestCollectDataWithSecret(t *testing.T) {
260
260
Name : tc .name ,
261
261
}
262
262
263
- source := makeProjection (tc .name , utilptr . Int32Ptr (tc .mode ), "secret" )
263
+ source := makeProjection (tc .name , ptr. To [ int32 ] (tc .mode ), "secret" )
264
264
source .Sources [0 ].Secret .Items = tc .mappings
265
265
source .Sources [0 ].Secret .Optional = & tc .optional
266
266
@@ -509,7 +509,7 @@ func TestCollectDataWithConfigMap(t *testing.T) {
509
509
Name : tc .name ,
510
510
}
511
511
512
- source := makeProjection (tc .name , utilptr . Int32Ptr (tc .mode ), "configMap" )
512
+ source := makeProjection (tc .name , ptr. To [ int32 ] (tc .mode ), "configMap" )
513
513
source .Sources [0 ].ConfigMap .Items = tc .mappings
514
514
source .Sources [0 ].ConfigMap .Optional = & tc .optional
515
515
@@ -683,7 +683,7 @@ func TestCollectDataWithDownwardAPI(t *testing.T) {
683
683
684
684
for _ , tc := range cases {
685
685
t .Run (tc .name , func (t * testing.T ) {
686
- source := makeProjection ("" , utilptr . Int32Ptr (tc .mode ), "downwardAPI" )
686
+ source := makeProjection ("" , ptr. To [ int32 ] (tc .mode ), "downwardAPI" )
687
687
source .Sources [0 ].DownwardAPI .Items = tc .volumeFile
688
688
689
689
client := fake .NewSimpleClientset (tc .pod )
@@ -743,7 +743,7 @@ func TestCollectDataWithServiceAccountToken(t *testing.T) {
743
743
{
744
744
name : "good service account" ,
745
745
audience : "https://example.com" ,
746
- defaultMode : utilptr . Int32Ptr (0644 ),
746
+ defaultMode : ptr. To [ int32 ] (0644 ),
747
747
path : "token" ,
748
748
expiration : & minute ,
749
749
@@ -754,7 +754,7 @@ func TestCollectDataWithServiceAccountToken(t *testing.T) {
754
754
{
755
755
name : "good service account other path" ,
756
756
audience : "https://example.com" ,
757
- defaultMode : utilptr . Int32Ptr (0644 ),
757
+ defaultMode : ptr. To [ int32 ] (0644 ),
758
758
path : "other-token" ,
759
759
expiration : & minute ,
760
760
wantPayload : map [string ]util.FileProjection {
@@ -763,7 +763,7 @@ func TestCollectDataWithServiceAccountToken(t *testing.T) {
763
763
},
764
764
{
765
765
name : "good service account defaults audience" ,
766
- defaultMode : utilptr . Int32Ptr (0644 ),
766
+ defaultMode : ptr. To [ int32 ] (0644 ),
767
767
path : "token" ,
768
768
expiration : & minute ,
769
769
@@ -773,7 +773,7 @@ func TestCollectDataWithServiceAccountToken(t *testing.T) {
773
773
},
774
774
{
775
775
name : "good service account defaults expiration" ,
776
- defaultMode : utilptr . Int32Ptr (0644 ),
776
+ defaultMode : ptr. To [ int32 ] (0644 ),
777
777
path : "token" ,
778
778
779
779
wantPayload : map [string ]util.FileProjection {
@@ -787,21 +787,21 @@ func TestCollectDataWithServiceAccountToken(t *testing.T) {
787
787
},
788
788
{
789
789
name : "fsUser != nil" ,
790
- defaultMode : utilptr . Int32Ptr (0644 ),
791
- fsUser : utilptr . Int64Ptr (1000 ),
790
+ defaultMode : ptr. To [ int32 ] (0644 ),
791
+ fsUser : ptr. To [ int64 ] (1000 ),
792
792
path : "token" ,
793
793
wantPayload : map [string ]util.FileProjection {
794
794
"token" : {
795
795
Data : []byte ("test_projected_namespace:foo:3600:[https://api]" ),
796
796
Mode : 0600 ,
797
- FsUser : utilptr . Int64Ptr (1000 ),
797
+ FsUser : ptr. To [ int64 ] (1000 ),
798
798
},
799
799
},
800
800
},
801
801
{
802
802
name : "fsGroup != nil" ,
803
- defaultMode : utilptr . Int32Ptr (0644 ),
804
- fsGroup : utilptr . Int64Ptr (1000 ),
803
+ defaultMode : ptr. To [ int32 ] (0644 ),
804
+ fsGroup : ptr. To [ int64 ] (1000 ),
805
805
path : "token" ,
806
806
wantPayload : map [string ]util.FileProjection {
807
807
"token" : {
@@ -812,15 +812,15 @@ func TestCollectDataWithServiceAccountToken(t *testing.T) {
812
812
},
813
813
{
814
814
name : "fsUser != nil && fsGroup != nil" ,
815
- defaultMode : utilptr . Int32Ptr (0644 ),
816
- fsGroup : utilptr . Int64Ptr (1000 ),
817
- fsUser : utilptr . Int64Ptr (1000 ),
815
+ defaultMode : ptr. To [ int32 ] (0644 ),
816
+ fsGroup : ptr. To [ int64 ] (1000 ),
817
+ fsUser : ptr. To [ int64 ] (1000 ),
818
818
path : "token" ,
819
819
wantPayload : map [string ]util.FileProjection {
820
820
"token" : {
821
821
Data : []byte ("test_projected_namespace:foo:3600:[https://api]" ),
822
822
Mode : 0600 ,
823
- FsUser : utilptr . Int64Ptr (1000 ),
823
+ FsUser : ptr. To [ int64 ] (1000 ),
824
824
},
825
825
},
826
826
},
@@ -904,12 +904,12 @@ func TestCollectDataWithClusterTrustBundle(t *testing.T) {
904
904
Sources : []v1.VolumeProjection {
905
905
{
906
906
ClusterTrustBundle : & v1.ClusterTrustBundleProjection {
907
- Name : utilptr . String ("foo" ),
907
+ Name : ptr . To ("foo" ),
908
908
Path : "bundle.pem" ,
909
909
},
910
910
},
911
911
},
912
- DefaultMode : utilptr . Int32 (0644 ),
912
+ DefaultMode : ptr. To [ int32 ] (0644 ),
913
913
},
914
914
bundles : []runtime.Object {
915
915
& certificatesv1alpha1.ClusterTrustBundle {
@@ -934,7 +934,7 @@ func TestCollectDataWithClusterTrustBundle(t *testing.T) {
934
934
Sources : []v1.VolumeProjection {
935
935
{
936
936
ClusterTrustBundle : & v1.ClusterTrustBundleProjection {
937
- SignerName : utilptr . String ("foo.example/bar" ), // Note: fake client doesn't understand selection by signer name.
937
+ SignerName : ptr . To ("foo.example/bar" ), // Note: fake client doesn't understand selection by signer name.
938
938
LabelSelector : & metav1.LabelSelector {
939
939
MatchLabels : map [string ]string {
940
940
"key" : "non-value" , // Note: fake client doesn't actually act on label selectors.
@@ -944,7 +944,7 @@ func TestCollectDataWithClusterTrustBundle(t *testing.T) {
944
944
},
945
945
},
946
946
},
947
- DefaultMode : utilptr . Int32 (0644 ),
947
+ DefaultMode : ptr. To [ int32 ] (0644 ),
948
948
},
949
949
bundles : []runtime.Object {
950
950
& certificatesv1alpha1.ClusterTrustBundle {
@@ -973,12 +973,12 @@ func TestCollectDataWithClusterTrustBundle(t *testing.T) {
973
973
Sources : []v1.VolumeProjection {
974
974
{
975
975
ClusterTrustBundle : & v1.ClusterTrustBundleProjection {
976
- Name : utilptr . String ("foo" ),
976
+ Name : ptr . To ("foo" ),
977
977
Path : "bundle.pem" ,
978
978
},
979
979
},
980
980
},
981
- DefaultMode : utilptr . Int32 (0600 ),
981
+ DefaultMode : ptr. To [ int32 ] (0600 ),
982
982
},
983
983
bundles : []runtime.Object {
984
984
& certificatesv1alpha1.ClusterTrustBundle {
@@ -1400,7 +1400,7 @@ func makeVolumeSpec(volumeName, name string, defaultMode int32) *v1.Volume {
1400
1400
return & v1.Volume {
1401
1401
Name : volumeName ,
1402
1402
VolumeSource : v1.VolumeSource {
1403
- Projected : makeProjection (name , utilptr . Int32Ptr (defaultMode ), "secret" ),
1403
+ Projected : makeProjection (name , ptr. To [ int32 ] (defaultMode ), "secret" ),
1404
1404
},
1405
1405
}
1406
1406
}
0 commit comments