Merge pull request #113375 from atiratree/PodHealthyPolicy-api

api: add unhealthyPodEvictionPolicy for PDBs

Kubernetes-commit: cc704f97784c3359db4690b97201ebfe6b481869
This commit is contained in:
Kubernetes Publisher 2022-11-11 04:02:10 -08:00
commit cfd682c60b
5 changed files with 36 additions and 10 deletions

View File

@ -10610,6 +10610,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: selector
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector
- name: unhealthyPodEvictionPolicy
type:
scalar: string
- name: io.k8s.api.policy.v1.PodDisruptionBudgetStatus
map:
fields:
@ -10751,6 +10754,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: selector
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector
- name: unhealthyPodEvictionPolicy
type:
scalar: string
- name: io.k8s.api.policy.v1beta1.PodDisruptionBudgetStatus
map:
fields:

View File

@ -19,6 +19,7 @@ limitations under the License.
package v1
import (
policyv1 "k8s.io/api/policy/v1"
intstr "k8s.io/apimachinery/pkg/util/intstr"
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
@ -26,9 +27,10 @@ import (
// PodDisruptionBudgetSpecApplyConfiguration represents an declarative configuration of the PodDisruptionBudgetSpec type for use
// with apply.
type PodDisruptionBudgetSpecApplyConfiguration struct {
MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty"`
Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"`
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty"`
Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"`
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
UnhealthyPodEvictionPolicy *policyv1.UnhealthyPodEvictionPolicyType `json:"unhealthyPodEvictionPolicy,omitempty"`
}
// PodDisruptionBudgetSpecApplyConfiguration constructs an declarative configuration of the PodDisruptionBudgetSpec type for use with
@ -60,3 +62,11 @@ func (b *PodDisruptionBudgetSpecApplyConfiguration) WithMaxUnavailable(value int
b.MaxUnavailable = &value
return b
}
// WithUnhealthyPodEvictionPolicy sets the UnhealthyPodEvictionPolicy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the UnhealthyPodEvictionPolicy field is set to the value of the last call.
func (b *PodDisruptionBudgetSpecApplyConfiguration) WithUnhealthyPodEvictionPolicy(value policyv1.UnhealthyPodEvictionPolicyType) *PodDisruptionBudgetSpecApplyConfiguration {
b.UnhealthyPodEvictionPolicy = &value
return b
}

View File

@ -19,6 +19,7 @@ limitations under the License.
package v1beta1
import (
v1beta1 "k8s.io/api/policy/v1beta1"
intstr "k8s.io/apimachinery/pkg/util/intstr"
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
@ -26,9 +27,10 @@ import (
// PodDisruptionBudgetSpecApplyConfiguration represents an declarative configuration of the PodDisruptionBudgetSpec type for use
// with apply.
type PodDisruptionBudgetSpecApplyConfiguration struct {
MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty"`
Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"`
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty"`
Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"`
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
UnhealthyPodEvictionPolicy *v1beta1.UnhealthyPodEvictionPolicyType `json:"unhealthyPodEvictionPolicy,omitempty"`
}
// PodDisruptionBudgetSpecApplyConfiguration constructs an declarative configuration of the PodDisruptionBudgetSpec type for use with
@ -60,3 +62,11 @@ func (b *PodDisruptionBudgetSpecApplyConfiguration) WithMaxUnavailable(value int
b.MaxUnavailable = &value
return b
}
// WithUnhealthyPodEvictionPolicy sets the UnhealthyPodEvictionPolicy field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the UnhealthyPodEvictionPolicy field is set to the value of the last call.
func (b *PodDisruptionBudgetSpecApplyConfiguration) WithUnhealthyPodEvictionPolicy(value v1beta1.UnhealthyPodEvictionPolicyType) *PodDisruptionBudgetSpecApplyConfiguration {
b.UnhealthyPodEvictionPolicy = &value
return b
}

4
go.mod
View File

@ -24,7 +24,7 @@ require (
golang.org/x/term v0.1.0
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
google.golang.org/protobuf v1.28.1
k8s.io/api v0.0.0-20221110160654-5cb32024090c
k8s.io/api v0.0.0-20221111134724-3590edaeeded
k8s.io/apimachinery v0.0.0-20221108055230-fd8a60496be5
k8s.io/klog/v2 v2.80.1
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280
@ -59,6 +59,6 @@ require (
)
replace (
k8s.io/api => k8s.io/api v0.0.0-20221110160654-5cb32024090c
k8s.io/api => k8s.io/api v0.0.0-20221111134724-3590edaeeded
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20221108055230-fd8a60496be5
)

4
go.sum
View File

@ -476,8 +476,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20221110160654-5cb32024090c h1:8RFXHWLP8uF3qGxQMrnqaekwCbghJGoheMDvc9Q5WaI=
k8s.io/api v0.0.0-20221110160654-5cb32024090c/go.mod h1:j2jT1HZpNN4eUpl6xrwjWC1amreYNCdsevVdZMhBz5o=
k8s.io/api v0.0.0-20221111134724-3590edaeeded h1:zEajzE/qy2hPxVOHvnoEA1Llrfap/TN//rm7MsLzVxA=
k8s.io/api v0.0.0-20221111134724-3590edaeeded/go.mod h1:j2jT1HZpNN4eUpl6xrwjWC1amreYNCdsevVdZMhBz5o=
k8s.io/apimachinery v0.0.0-20221108055230-fd8a60496be5 h1:iFAMJ1evvrO6X7dS7EKujS6An+bp3u/dD6opu8rn0QA=
k8s.io/apimachinery v0.0.0-20221108055230-fd8a60496be5/go.mod h1:VXMmlsE7YRJ5vyAyWpkKIfFkEbDNpVs0ObpkuQf1WfM=
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=