Skip to content

Commit

Permalink
refactor webhook patching logic
Browse files Browse the repository at this point in the history
Signed-off-by: ImpSy <[email protected]>
  • Loading branch information
ImpSy committed Jan 28, 2025
1 parent b241103 commit 0473abd
Show file tree
Hide file tree
Showing 7 changed files with 266 additions and 500 deletions.
27 changes: 9 additions & 18 deletions api/v1beta2/sparkapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,15 @@ type SparkPodSpec struct {
// ShareProcessNamespace settings for the pod, following the Kubernetes specifications.
// +optional
ShareProcessNamespace *bool `json:"shareProcessNamespace,omitempty"`
// Lifecycle for running preStop or postStart commands
// +optional
Lifecycle *corev1.Lifecycle `json:"lifecycle,omitempty"`
// Ports settings for the pods, following the Kubernetes specifications.
// +optional
Ports []Port `json:"ports,omitempty"`
// PriorityClassName is the name of the PriorityClass for the pod.
// +optional
PriorityClassName *string `json:"priorityClassName,omitempty"`
}

// DriverSpec is specification of the driver.
Expand All @@ -528,9 +537,6 @@ type DriverSpec struct {
// GC settings or other logging.
// +optional
JavaOptions *string `json:"javaOptions,omitempty"`
// Lifecycle for running preStop or postStart commands
// +optional
Lifecycle *corev1.Lifecycle `json:"lifecycle,omitempty"`
// KubernetesMaster is the URL of the Kubernetes master used by the driver to manage executor pods and
// other Kubernetes resources. Default to https://kubernetes.default.svc.
// +optional
Expand All @@ -543,12 +549,6 @@ type DriverSpec struct {
// executors to connect to the driver.
// +optional
ServiceLabels map[string]string `json:"serviceLabels,omitempty"`
// Ports settings for the pods, following the Kubernetes specifications.
// +optional
Ports []Port `json:"ports,omitempty"`
// PriorityClassName is the name of the PriorityClass for the driver pod.
// +optional
PriorityClassName *string `json:"priorityClassName,omitempty"`
}

// ExecutorSpec is specification of the executor.
Expand All @@ -566,19 +566,10 @@ type ExecutorSpec struct {
// GC settings or other logging.
// +optional
JavaOptions *string `json:"javaOptions,omitempty"`
// Lifecycle for running preStop or postStart commands
// +optional
Lifecycle *corev1.Lifecycle `json:"lifecycle,omitempty"`
// DeleteOnTermination specify whether executor pods should be deleted in case of failure or normal termination.
// Maps to `spark.kubernetes.executor.deleteOnTermination` that is available since Spark 3.0.
// +optional
DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"`
// Ports settings for the pods, following the Kubernetes specifications.
// +optional
Ports []Port `json:"ports,omitempty"`
// PriorityClassName is the name of the PriorityClass for the executor pod.
// +optional
PriorityClassName *string `json:"priorityClassName,omitempty"`
}

// NamePath is a pair of a name and a path to which the named objects should be mounted to.
Expand Down
45 changes: 15 additions & 30 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 @@ -3187,7 +3187,7 @@ spec:
type: array
priorityClassName:
description: PriorityClassName is the name of the PriorityClass
for the driver pod.
for the pod.
type: string
schedulerName:
description: SchedulerName specifies the scheduler that will
Expand Down Expand Up @@ -7965,7 +7965,7 @@ spec:
type: array
priorityClassName:
description: PriorityClassName is the name of the PriorityClass
for the executor pod.
for the pod.
type: string
schedulerName:
description: SchedulerName specifies the scheduler that will
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/sparkoperator.k8s.io_sparkapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3135,7 +3135,7 @@ spec:
type: array
priorityClassName:
description: PriorityClassName is the name of the PriorityClass
for the driver pod.
for the pod.
type: string
schedulerName:
description: SchedulerName specifies the scheduler that will be
Expand Down Expand Up @@ -7883,7 +7883,7 @@ spec:
type: array
priorityClassName:
description: PriorityClassName is the name of the PriorityClass
for the executor pod.
for the pod.
type: string
schedulerName:
description: SchedulerName specifies the scheduler that will be
Expand Down
122 changes: 41 additions & 81 deletions docs/api-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,20 +572,6 @@ GC settings or other logging.</p>
</tr>
<tr>
<td>
<code>lifecycle</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#lifecycle-v1-core">
Kubernetes core/v1.Lifecycle
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Lifecycle for running preStop or postStart commands</p>
</td>
</tr>
<tr>
<td>
<code>kubernetesMaster</code><br/>
<em>
string
Expand Down Expand Up @@ -623,32 +609,6 @@ map[string]string
executors to connect to the driver.</p>
</td>
</tr>
<tr>
<td>
<code>ports</code><br/>
<em>
<a href="#sparkoperator.k8s.io/v1beta2.Port">
[]Port
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Ports settings for the pods, following the Kubernetes specifications.</p>
</td>
</tr>
<tr>
<td>
<code>priorityClassName</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>PriorityClassName is the name of the PriorityClass for the driver pod.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="sparkoperator.k8s.io/v1beta2.DriverState">DriverState
Expand Down Expand Up @@ -825,20 +785,6 @@ GC settings or other logging.</p>
</tr>
<tr>
<td>
<code>lifecycle</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#lifecycle-v1-core">
Kubernetes core/v1.Lifecycle
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Lifecycle for running preStop or postStart commands</p>
</td>
</tr>
<tr>
<td>
<code>deleteOnTermination</code><br/>
<em>
bool
Expand All @@ -850,32 +796,6 @@ bool
Maps to <code>spark.kubernetes.executor.deleteOnTermination</code> that is available since Spark 3.0.</p>
</td>
</tr>
<tr>
<td>
<code>ports</code><br/>
<em>
<a href="#sparkoperator.k8s.io/v1beta2.Port">
[]Port
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Ports settings for the pods, following the Kubernetes specifications.</p>
</td>
</tr>
<tr>
<td>
<code>priorityClassName</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>PriorityClassName is the name of the PriorityClass for the executor pod.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="sparkoperator.k8s.io/v1beta2.ExecutorState">ExecutorState
Expand Down Expand Up @@ -1103,7 +1023,7 @@ string
<h3 id="sparkoperator.k8s.io/v1beta2.Port">Port
</h3>
<p>
(<em>Appears on:</em><a href="#sparkoperator.k8s.io/v1beta2.DriverSpec">DriverSpec</a>, <a href="#sparkoperator.k8s.io/v1beta2.ExecutorSpec">ExecutorSpec</a>)
(<em>Appears on:</em><a href="#sparkoperator.k8s.io/v1beta2.SparkPodSpec">SparkPodSpec</a>)
</p>
<div>
<p>Port represents the port definition in the pods objects.</p>
Expand Down Expand Up @@ -3223,6 +3143,46 @@ bool
<p>ShareProcessNamespace settings for the pod, following the Kubernetes specifications.</p>
</td>
</tr>
<tr>
<td>
<code>lifecycle</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#lifecycle-v1-core">
Kubernetes core/v1.Lifecycle
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Lifecycle for running preStop or postStart commands</p>
</td>
</tr>
<tr>
<td>
<code>ports</code><br/>
<em>
<a href="#sparkoperator.k8s.io/v1beta2.Port">
[]Port
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Ports settings for the pods, following the Kubernetes specifications.</p>
</td>
</tr>
<tr>
<td>
<code>priorityClassName</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>PriorityClassName is the name of the PriorityClass for the pod.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="sparkoperator.k8s.io/v1beta2.SparkUIConfiguration">SparkUIConfiguration
Expand Down
Loading

0 comments on commit 0473abd

Please sign in to comment.