Skip to content

Commit c0e48b0

Browse files
liangyuanpengjingczhang
authored andcommitted
pkg/registry: drop pointer wrapper functions.
The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <[email protected]>
1 parent 275d178 commit c0e48b0

File tree

7 files changed

+159
-160
lines changed

7 files changed

+159
-160
lines changed

pkg/registry/batch/cronjob/strategy_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"k8s.io/apiserver/pkg/registry/rest"
2525
"k8s.io/kubernetes/pkg/apis/batch"
2626
api "k8s.io/kubernetes/pkg/apis/core"
27-
"k8s.io/utils/pointer"
27+
"k8s.io/utils/ptr"
2828
)
2929

3030
var (
@@ -38,20 +38,20 @@ var (
3838
validCronjobSpec = batch.CronJobSpec{
3939
Schedule: "5 5 * * ?",
4040
ConcurrencyPolicy: batch.AllowConcurrent,
41-
TimeZone: pointer.String("Asia/Shanghai"),
41+
TimeZone: ptr.To("Asia/Shanghai"),
4242
JobTemplate: batch.JobTemplateSpec{
4343
Spec: batch.JobSpec{
4444
Template: validPodTemplateSpec,
4545
CompletionMode: completionModePtr(batch.IndexedCompletion),
46-
Completions: pointer.Int32(10),
47-
Parallelism: pointer.Int32(10),
46+
Completions: ptr.To[int32](10),
47+
Parallelism: ptr.To[int32](10),
4848
},
4949
},
5050
}
5151
cronjobSpecWithTZinSchedule = batch.CronJobSpec{
5252
Schedule: "CRON_TZ=UTC 5 5 * * ?",
5353
ConcurrencyPolicy: batch.AllowConcurrent,
54-
TimeZone: pointer.String("Asia/DoesNotExist"),
54+
TimeZone: ptr.To("Asia/DoesNotExist"),
5555
JobTemplate: batch.JobTemplateSpec{
5656
Spec: batch.JobSpec{
5757
Template: validPodTemplateSpec,

pkg/registry/batch/job/storage/storage_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ limitations under the License.
1717
package storage
1818

1919
import (
20-
"k8s.io/utils/pointer"
2120
"testing"
2221

22+
"k8s.io/utils/ptr"
23+
2324
batchv1 "k8s.io/api/batch/v1"
2425
corev1 "k8s.io/api/core/v1"
2526
"k8s.io/apimachinery/pkg/apis/meta/internalversion"
@@ -138,7 +139,7 @@ func TestCreate(t *testing.T) {
138139
// invalid (empty selector)
139140
&batch.Job{
140141
Spec: batch.JobSpec{
141-
ManualSelector: pointer.Bool(false),
142+
ManualSelector: ptr.To(false),
142143
Completions: validJob.Spec.Completions,
143144
Selector: &metav1.LabelSelector{},
144145
Template: validJob.Spec.Template,

0 commit comments

Comments
 (0)