Skip to content
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
12 changes: 12 additions & 0 deletions api/v1beta2/sparkapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ type SparkUIConfiguration struct {
// TlsHosts is useful If we need to declare SSL certificates to the ingress object
// +optional
IngressTLS []networkingv1.IngressTLS `json:"ingressTLS,omitempty"`
// UseIngressAgnosticMode when set to true, disables nginx-specific ingress path modifications
// (regex capture groups) and annotation injection (nginx.ingress.kubernetes.io/rewrite-target).
// This allows the ingress to work with any ingress controller like Traefik, HAProxy, etc.
// When false (default), the legacy nginx-specific behavior is used for backward compatibility.
// +optional
UseIngressAgnosticMode *bool `json:"useIngressAgnosticMode,omitempty"`
}

// DriverIngressConfiguration is for driver ingress specific configuration parameters.
Expand All @@ -333,6 +339,12 @@ type DriverIngressConfiguration struct {
// TlsHosts is useful If we need to declare SSL certificates to the ingress object
// +optional
IngressTLS []networkingv1.IngressTLS `json:"ingressTLS,omitempty"`
// UseIngressAgnosticMode when set to true, disables nginx-specific ingress path modifications
// (regex capture groups) and annotation injection (nginx.ingress.kubernetes.io/rewrite-target).
// This allows the ingress to work with any ingress controller like Traefik, HAProxy, etc.
// When false (default), the legacy nginx-specific behavior is used for backward compatibility.
// +optional
UseIngressAgnosticMode *bool `json:"useIngressAgnosticMode,omitempty"`
}

// ApplicationStateType represents the type of the current state of an application.
Expand Down
10 changes: 10 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 @@ -85,6 +85,9 @@ spec:
{{- with .Values.controller.uiIngress.annotations }}
- --ingress-annotations={{ . | toJson }}
{{- end }}
{{- if .Values.controller.uiIngress.useIngressAgnosticMode }}
- --use-ingress-agnostic-mode=true
{{- end }}
{{- end }}
{{- if .Values.controller.batchScheduler.enable }}
- --enable-batch-scheduler=true
Expand Down
54 changes: 29 additions & 25 deletions charts/spark-operator-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ controller:

# -- Feature gates to enable or disable specific features.
featureGates:
- name: PartialRestart
enabled: false
- name: LoadSparkDefaults
enabled: false
- name: PartialRestart
enabled: false
- name: LoadSparkDefaults
enabled: false

# -- The number of old history to retain to allow rollback.
revisionHistoryLimit: 10
Expand Down Expand Up @@ -125,6 +125,11 @@ controller:
annotations: {}
# key1: value1
# key2: value2
# -- When enabled, disables nginx-specific ingress path modifications (regex capture groups like `(/|$)(.*)`)
# and annotation injection (`nginx.ingress.kubernetes.io/rewrite-target`).
# This allows the ingress to work with any ingress controller like Traefik, HAProxy, Istio, OpenShift Routes, etc.
# Can be overridden per SparkApplication via `sparkUIOptions.useIngressAgnosticMode` or `driverIngressOptions[].useIngressAgnosticMode`.
useIngressAgnosticMode: false

batchScheduler:
# -- Specifies whether to enable batch scheduler for spark jobs scheduling.
Expand Down Expand Up @@ -166,10 +171,10 @@ controller:

# -- Volumes for controller pods.
volumes:
# Create a tmp directory to write Spark artifacts to for deployed Spark apps.
- name: tmp
emptyDir:
sizeLimit: 1Gi
# Create a tmp directory to write Spark artifacts to for deployed Spark apps.
- name: tmp
emptyDir:
sizeLimit: 1Gi

# -- Node selector for controller pods.
nodeSelector: {}
Expand Down Expand Up @@ -211,10 +216,10 @@ controller:

# -- Volume mounts for controller containers.
volumeMounts:
# Mount a tmp directory to write Spark artifacts to for deployed Spark apps.
- name: tmp
mountPath: "/tmp"
readOnly: false
# Mount a tmp directory to write Spark artifacts to for deployed Spark apps.
- name: tmp
mountPath: "/tmp"
readOnly: false

# -- Pod resource requests and limits for controller containers.
# Note, that each job submission will spawn a JVM within the controller pods using "/usr/local/openjdk-11/bin/java -Xmx128m".
Expand All @@ -236,7 +241,7 @@ controller:
runAsNonRoot: true
capabilities:
drop:
- ALL
- ALL
seccompProfile:
type: RuntimeDefault

Expand Down Expand Up @@ -341,10 +346,10 @@ webhook:

# -- Volumes for webhook pods.
volumes:
# Create a dir for the webhook to generate its certificates in.
- name: serving-certs
emptyDir:
sizeLimit: 500Mi
# Create a dir for the webhook to generate its certificates in.
- name: serving-certs
emptyDir:
sizeLimit: 500Mi

# -- Node selector for webhook pods.
nodeSelector: {}
Expand Down Expand Up @@ -386,12 +391,11 @@ webhook:

# -- Volume mounts for webhook containers.
volumeMounts:
# Mount a dir for the webhook to generate its certificates in.
- name: serving-certs
mountPath: /etc/k8s-webhook-server/serving-certs
subPath: serving-certs
readOnly: false

# Mount a dir for the webhook to generate its certificates in.
- name: serving-certs
mountPath: /etc/k8s-webhook-server/serving-certs
subPath: serving-certs
readOnly: false

# -- Pod resource requests and limits for webhook pods.
resources: {}
Expand All @@ -410,7 +414,7 @@ webhook:
runAsNonRoot: true
capabilities:
drop:
- ALL
- ALL
seccompProfile:
type: RuntimeDefault

Expand All @@ -429,7 +433,7 @@ spark:
# Namespaces specified here will be watched in addition to those matching jobNamespaceSelector.
# Make sure the namespaces have already existed.
jobNamespaces:
- default
- default

# -- Label selector to filter namespaces to watch.
# Supports standard Kubernetes label selector syntax (e.g., 'spark-operator=enabled,env in (prod,staging)').
Expand Down
13 changes: 8 additions & 5 deletions cmd/operator/controller/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ var (
defaultBatchScheduler string

// Spark web UI service and ingress
enableUIService bool
ingressClassName string
ingressURLFormat string
ingressTLS []networkingv1.IngressTLS
ingressAnnotations map[string]string
enableUIService bool
ingressClassName string
ingressURLFormat string
ingressTLS []networkingv1.IngressTLS
ingressAnnotations map[string]string
useIngressAgnosticMode bool

// Leader election
enableLeaderElection bool
Expand Down Expand Up @@ -172,6 +173,7 @@ func NewStartCommand() *cobra.Command {
command.Flags().StringVar(&ingressURLFormat, "ingress-url-format", "", "Ingress URL format.")
command.Flags().StringVar(&ingressTLSstring, "ingress-tls", "", "JSON format string for the default TLS config on the Spark UI ingresses. e.g. '[{\"hosts\":[\"*.example.com\"],\"secretName\":\"example-secret\"}]'. `ingressTLS` in the SparkApplication spec will override this value.")
command.Flags().StringVar(&ingressAnnotationsString, "ingress-annotations", "", "JSON format string for the default ingress annotations for the Spark UI ingresses. e.g. '[{\"cert-manager.io/cluster-issuer\": \"letsencrypt\"}]'. `ingressAnnotations` in the SparkApplication spec will override this value.")
command.Flags().BoolVar(&useIngressAgnosticMode, "use-ingress-agnostic-mode", false, "When enabled, disables nginx-specific ingress path modifications (regex capture groups) and annotation injection (nginx.ingress.kubernetes.io/rewrite-target). This allows the ingress to work with any ingress controller like Traefik, HAProxy, etc.")

command.Flags().BoolVar(&enableLeaderElection, "leader-election", false, "Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
Expand Down Expand Up @@ -450,6 +452,7 @@ func newSparkApplicationReconcilerOptions() sparkapplication.Options {
SparkApplicationMetrics: sparkApplicationMetrics,
SparkExecutorMetrics: sparkExecutorMetrics,
MaxTrackedExecutorPerApp: maxTrackedExecutorPerApp,
UseIngressAgnosticMode: useIngressAgnosticMode,
}
if enableBatchScheduler {
options.KubeSchedulerNames = kubeSchedulerNames
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5266,6 +5266,13 @@ spec:
description: ServiceType allows configuring the type of
the service. Defaults to ClusterIP.
type: string
useIngressAgnosticMode:
description: |-
UseIngressAgnosticMode when set to true, disables nginx-specific ingress path modifications
(regex capture groups) and annotation injection (nginx.ingress.kubernetes.io/rewrite-target).
This allows the ingress to work with any ingress controller like Traefik, HAProxy, etc.
When false (default), the legacy nginx-specific behavior is used for backward compatibility.
type: boolean
required:
- servicePort
- servicePortName
Expand Down Expand Up @@ -10565,6 +10572,13 @@ spec:
description: ServiceType allows configuring the type of the
service. Defaults to ClusterIP.
type: string
useIngressAgnosticMode:
description: |-
UseIngressAgnosticMode when set to true, disables nginx-specific ingress path modifications
(regex capture groups) and annotation injection (nginx.ingress.kubernetes.io/rewrite-target).
This allows the ingress to work with any ingress controller like Traefik, HAProxy, etc.
When false (default), the legacy nginx-specific behavior is used for backward compatibility.
type: boolean
type: object
sparkVersion:
description: SparkVersion is the version of Spark the application
Expand Down
14 changes: 14 additions & 0 deletions config/crd/bases/sparkoperator.k8s.io_sparkapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5211,6 +5211,13 @@ spec:
description: ServiceType allows configuring the type of the
service. Defaults to ClusterIP.
type: string
useIngressAgnosticMode:
description: |-
UseIngressAgnosticMode when set to true, disables nginx-specific ingress path modifications
(regex capture groups) and annotation injection (nginx.ingress.kubernetes.io/rewrite-target).
This allows the ingress to work with any ingress controller like Traefik, HAProxy, etc.
When false (default), the legacy nginx-specific behavior is used for backward compatibility.
type: boolean
required:
- servicePort
- servicePortName
Expand Down Expand Up @@ -10486,6 +10493,13 @@ spec:
description: ServiceType allows configuring the type of the service.
Defaults to ClusterIP.
type: string
useIngressAgnosticMode:
description: |-
UseIngressAgnosticMode when set to true, disables nginx-specific ingress path modifications
(regex capture groups) and annotation injection (nginx.ingress.kubernetes.io/rewrite-target).
This allows the ingress to work with any ingress controller like Traefik, HAProxy, etc.
When false (default), the legacy nginx-specific behavior is used for backward compatibility.
type: boolean
type: object
sparkVersion:
description: SparkVersion is the version of Spark the application
Expand Down
30 changes: 30 additions & 0 deletions docs/api-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,21 @@ map[string]string
<p>TlsHosts is useful If we need to declare SSL certificates to the ingress object</p>
</td>
</tr>
<tr>
<td>
<code>useIngressAgnosticMode</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>UseIngressAgnosticMode when set to true, disables nginx-specific ingress path modifications
(regex capture groups) and annotation injection (nginx.ingress.kubernetes.io/rewrite-target).
This allows the ingress to work with any ingress controller like Traefik, HAProxy, etc.
When false (default), the legacy nginx-specific behavior is used for backward compatibility.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="sparkoperator.k8s.io/v1beta2.DriverSpec">DriverSpec
Expand Down Expand Up @@ -3465,6 +3480,21 @@ map[string]string
<p>TlsHosts is useful If we need to declare SSL certificates to the ingress object</p>
</td>
</tr>
<tr>
<td>
<code>useIngressAgnosticMode</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>UseIngressAgnosticMode when set to true, disables nginx-specific ingress path modifications
(regex capture groups) and annotation injection (nginx.ingress.kubernetes.io/rewrite-target).
This allows the ingress to work with any ingress controller like Traefik, HAProxy, etc.
When false (default), the legacy nginx-specific behavior is used for backward compatibility.</p>
</td>
</tr>
</tbody>
</table>
<hr/>
Expand Down
6 changes: 6 additions & 0 deletions internal/controller/sparkapplication/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ type Options struct {
SparkExecutorMetrics *metrics.SparkExecutorMetrics

MaxTrackedExecutorPerApp int

// UseIngressAgnosticMode when set to true, disables nginx-specific ingress path modifications
// (regex capture groups) and annotation injection (nginx.ingress.kubernetes.io/rewrite-target).
// This allows the ingress to work with any ingress controller like Traefik, HAProxy, etc.
// Can be overridden per SparkApplication via sparkUIOptions.useIngressAgnosticMode.
UseIngressAgnosticMode bool
}

// Reconciler reconciles a SparkApplication object.
Expand Down
Loading