Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: manage PodDisruptionBudget for SparkApplication driver and executor #2326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions api/v1beta2/sparkapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1beta2
import (
corev1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
policyv1 "k8s.io/api/policy/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -549,6 +550,9 @@ type DriverSpec struct {
// PriorityClassName is the name of the PriorityClass for the driver pod.
// +optional
PriorityClassName *string `json:"priorityClassName,omitempty"`
// PodDisruptionBudgetSpec is the PodDisruptionBudget specification for the Spark Driver.
// +optional
PodDisruptionBudgetSpec *policyv1.PodDisruptionBudgetSpec `json:"podDisruptionBudgetSpec,omitempty"`
}

// ExecutorSpec is specification of the executor.
Expand Down Expand Up @@ -579,6 +583,9 @@ type ExecutorSpec struct {
// PriorityClassName is the name of the PriorityClass for the executor pod.
// +optional
PriorityClassName *string `json:"priorityClassName,omitempty"`
// PodDisruptionBudgetSpec is the PodDisruptionBudget specification for the Spark Executors.
// +optional
PodDisruptionBudgetSpec *policyv1.PodDisruptionBudgetSpec `json:"podDisruptionBudgetSpec,omitempty"`
}

// NamePath is a pair of a name and a path to which the named objects should be mounted to.
Expand Down
11 changes: 11 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2981,6 +2981,112 @@ spec:
NodeSelector is the Kubernetes node selector to be added to the driver and executor pods.
This field is mutually exclusive with nodeSelector at SparkApplication level (which will be deprecated).
type: object
podDisruptionBudgetSpec:
description: PodDisruptionBudgetSpec is the PodDisruptionBudget
specification for the Spark Driver.
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: |-
An eviction is allowed if at most "maxUnavailable" pods selected by
"selector" are unavailable after the eviction, i.e. even in absence of
the evicted pod. For example, one can prevent all voluntary evictions
by specifying 0. This is a mutually exclusive setting with "minAvailable".
x-kubernetes-int-or-string: true
minAvailable:
anyOf:
- type: integer
- type: string
description: |-
An eviction is allowed if at least "minAvailable" pods selected by
"selector" will still be available after the eviction, i.e. even in the
absence of the evicted pod. So for example you can prevent all voluntary
evictions by specifying "100%".
x-kubernetes-int-or-string: true
selector:
description: |-
Label query over pods whose evictions are managed by the disruption
budget.
A null selector will match no pods, while an empty ({}) selector will select
all pods within the namespace.
properties:
matchExpressions:
description: matchExpressions is a list of label selector
requirements. The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
unhealthyPodEvictionPolicy:
description: |-
UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods
should be considered for eviction. Current implementation considers healthy pods,
as pods that have status.conditions item with type="Ready",status="True".


Valid policies are IfHealthyBudget and AlwaysAllow.
If no policy is specified, the default behavior will be used,
which corresponds to the IfHealthyBudget policy.


IfHealthyBudget policy means that running pods (status.phase="Running"),
but not yet healthy can be evicted only if the guarded application is not
disrupted (status.currentHealthy is at least equal to status.desiredHealthy).
Healthy pods will be subject to the PDB for eviction.


AlwaysAllow policy means that all running pods (status.phase="Running"),
but not yet healthy are considered disrupted and can be evicted regardless
of whether the criteria in a PDB is met. This means perspective running
pods of a disrupted application might not get a chance to become healthy.
Healthy pods will be subject to the PDB for eviction.


Additional policies may be added in the future.
Clients making eviction decisions should disallow eviction of unhealthy pods
if they encounter an unrecognized policy in this field.


This field is beta-level. The eviction API uses this field when
the feature gate PDBUnhealthyPodEvictionPolicy is enabled (enabled by default).
type: string
type: object
podName:
description: |-
PodName is the name of the driver pod that the user creates. This is used for the
Expand Down Expand Up @@ -7767,6 +7873,112 @@ spec:
NodeSelector is the Kubernetes node selector to be added to the driver and executor pods.
This field is mutually exclusive with nodeSelector at SparkApplication level (which will be deprecated).
type: object
podDisruptionBudgetSpec:
description: PodDisruptionBudgetSpec is the PodDisruptionBudget
specification for the Spark Executors.
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: |-
An eviction is allowed if at most "maxUnavailable" pods selected by
"selector" are unavailable after the eviction, i.e. even in absence of
the evicted pod. For example, one can prevent all voluntary evictions
by specifying 0. This is a mutually exclusive setting with "minAvailable".
x-kubernetes-int-or-string: true
minAvailable:
anyOf:
- type: integer
- type: string
description: |-
An eviction is allowed if at least "minAvailable" pods selected by
"selector" will still be available after the eviction, i.e. even in the
absence of the evicted pod. So for example you can prevent all voluntary
evictions by specifying "100%".
x-kubernetes-int-or-string: true
selector:
description: |-
Label query over pods whose evictions are managed by the disruption
budget.
A null selector will match no pods, while an empty ({}) selector will select
all pods within the namespace.
properties:
matchExpressions:
description: matchExpressions is a list of label selector
requirements. The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
unhealthyPodEvictionPolicy:
description: |-
UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods
should be considered for eviction. Current implementation considers healthy pods,
as pods that have status.conditions item with type="Ready",status="True".


Valid policies are IfHealthyBudget and AlwaysAllow.
If no policy is specified, the default behavior will be used,
which corresponds to the IfHealthyBudget policy.


IfHealthyBudget policy means that running pods (status.phase="Running"),
but not yet healthy can be evicted only if the guarded application is not
disrupted (status.currentHealthy is at least equal to status.desiredHealthy).
Healthy pods will be subject to the PDB for eviction.


AlwaysAllow policy means that all running pods (status.phase="Running"),
but not yet healthy are considered disrupted and can be evicted regardless
of whether the criteria in a PDB is met. This means perspective running
pods of a disrupted application might not get a chance to become healthy.
Healthy pods will be subject to the PDB for eviction.


Additional policies may be added in the future.
Clients making eviction decisions should disallow eviction of unhealthy pods
if they encounter an unrecognized policy in this field.


This field is beta-level. The eviction API uses this field when
the feature gate PDBUnhealthyPodEvictionPolicy is enabled (enabled by default).
type: string
type: object
podSecurityContext:
description: PodSecurityContext specifies the PodSecurityContext
to apply.
Expand Down
Loading