Use ptr.To to retrieve intstr addresses

This uses the generic ptr.To in k8s.io/utils to replace functions and
code constructs which only serve to return pointers to intstr
values. Other uses of the deprecated pointer package are updated in
modified files.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
Stephen Kitt
2023-08-17 12:12:12 +02:00
parent 9068bec08e
commit aa89e6dc97
85 changed files with 499 additions and 641 deletions

View File

@@ -36,12 +36,9 @@ import (
api "k8s.io/kubernetes/pkg/apis/core"
corevalidation "k8s.io/kubernetes/pkg/apis/core/validation"
"k8s.io/kubernetes/pkg/features"
"k8s.io/utils/ptr"
)
func intStrAddr(intOrStr intstr.IntOrString) *intstr.IntOrString {
return &intOrStr
}
type statefulSetTweak func(ss *apps.StatefulSet)
func mkStatefulSet(template *api.PodTemplate, tweaks ...statefulSetTweak) apps.StatefulSet {
@@ -164,7 +161,7 @@ func tweakMaxUnavailable(mu intstr.IntOrString) statefulSetTweak {
if ss.Spec.UpdateStrategy.RollingUpdate == nil {
ss.Spec.UpdateStrategy.RollingUpdate = &apps.RollingUpdateStatefulSetStrategy{}
}
ss.Spec.UpdateStrategy.RollingUpdate.MaxUnavailable = intStrAddr(mu)
ss.Spec.UpdateStrategy.RollingUpdate.MaxUnavailable = ptr.To(mu)
}
}