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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user