more artisanal fixes
Most of these could have been refactored automatically but it wouldn't have been uglier. The unsophisticated tooling left lots of unnecessary struct -> pointer -> struct transitions. Kubernetes-commit: 76f85943787a5901a34a314a935712177edd2db0
This commit is contained in:
parent
96c320d500
commit
15efe80aa3
|
@ -121,8 +121,8 @@ func CheckEvictionSupport(clientset kubernetes.Interface) (string, error) {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Helper) makeDeleteOptions() *metav1.DeleteOptions {
|
func (d *Helper) makeDeleteOptions() metav1.DeleteOptions {
|
||||||
deleteOptions := &metav1.DeleteOptions{}
|
deleteOptions := metav1.DeleteOptions{}
|
||||||
if d.GracePeriodSeconds >= 0 {
|
if d.GracePeriodSeconds >= 0 {
|
||||||
gracePeriodSeconds := int64(d.GracePeriodSeconds)
|
gracePeriodSeconds := int64(d.GracePeriodSeconds)
|
||||||
deleteOptions.GracePeriodSeconds = &gracePeriodSeconds
|
deleteOptions.GracePeriodSeconds = &gracePeriodSeconds
|
||||||
|
@ -150,6 +150,8 @@ func (d *Helper) EvictPod(pod corev1.Pod, policyGroupVersion string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delOpts := d.makeDeleteOptions()
|
||||||
eviction := &policyv1beta1.Eviction{
|
eviction := &policyv1beta1.Eviction{
|
||||||
TypeMeta: metav1.TypeMeta{
|
TypeMeta: metav1.TypeMeta{
|
||||||
APIVersion: policyGroupVersion,
|
APIVersion: policyGroupVersion,
|
||||||
|
@ -159,8 +161,9 @@ func (d *Helper) EvictPod(pod corev1.Pod, policyGroupVersion string) error {
|
||||||
Name: pod.Name,
|
Name: pod.Name,
|
||||||
Namespace: pod.Namespace,
|
Namespace: pod.Namespace,
|
||||||
},
|
},
|
||||||
DeleteOptions: d.makeDeleteOptions(),
|
DeleteOptions: &delOpts,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remember to change change the URL manipulation func when Eviction's version change
|
// Remember to change change the URL manipulation func when Eviction's version change
|
||||||
return d.Client.PolicyV1beta1().Evictions(eviction.Namespace).Evict(eviction)
|
return d.Client.PolicyV1beta1().Evictions(eviction.Namespace).Evict(eviction)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue