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

support multiple namespaces #1955

Merged
merged 2 commits into from
Apr 11, 2024
Merged
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
13 changes: 12 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: "0"
fetch-depth: '0'

- name: The API should not change once published
run: |
if ! git diff --quiet origin/master -- pkg/apis/sparkoperator.k8s.io/v1beta1; then
echo "sparkoperator.k8s.io/v1beta1 api has changed"
false
fi
if ! git diff --quiet origin/master -- pkg/apis/sparkoperator.k8s.io/v1beta2; then
echo "sparkoperator.k8s.io/v1beta2 api has changed"
false
fi

- name: The API documentation hasn't changed
run: |
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ jobs:
skip: ${{ steps.skip-check.outputs.skip }}
version: ${{ steps.skip-check.outputs.VERSION_TAG }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Check if build should be skipped
id: skip-check
run: |
Expand Down Expand Up @@ -48,6 +52,9 @@ jobs:
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
echo "SCOPE=${platform//\//-}" >> $GITHUB_ENV

- name: Set up QEMU
timeout-minutes: 1
Expand All @@ -69,8 +76,8 @@ jobs:
with:
context: .
platforms: ${{ matrix.platform }}
cache-to: type=gha,mode=max
cache-from: type=gha
cache-to: type=gha,mode=max,scope=${{ env.SCOPE }}
cache-from: type=gha,scope=${{ env.SCOPE }}
push: true
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
Expand All @@ -81,7 +88,7 @@ jobs:
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
Expand All @@ -95,8 +102,9 @@ jobs:
- name: Download digests
uses: actions/download-artifact@v4
with:
name: digests
pattern: digests-*
path: /tmp/digests
merge-multiple: true
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
Expand All @@ -108,8 +116,9 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
Expand Down
6 changes: 3 additions & 3 deletions charts/spark-operator-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: v2
name: spark-operator
description: A Helm chart for Spark on Kubernetes operator
version: 1.2.1
appVersion: v1beta2-1.3.8-3.5.0
version: 1.2.2
appVersion: v1beta2-1.4.0-3.5.0
keywords:
- spark
home: https://github.com/GoogleCloudPlatform/spark-on-k8s-operator
home: https://github.com/kubeflow/spark-operator
maintainers:
- name: yuchaoran2011
email: [email protected]
4 changes: 2 additions & 2 deletions charts/spark-operator-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A Helm chart for Spark on Kubernetes operator

## Introduction

This chart bootstraps a [Kubernetes Operator for Apache Spark](https://github.com/GoogleCloudPlatform/spark-on-k8s-operator) deployment using the [Helm](https://helm.sh) package manager.
This chart bootstraps a [Kubernetes Operator for Apache Spark](https://github.com/kubeflow/spark-operator) deployment using the [Helm](https://helm.sh) package manager.

## Prerequisites

Expand Down Expand Up @@ -126,7 +126,7 @@ All charts linted successfully
| serviceAccounts.sparkoperator.create | bool | `true` | Create a service account for the operator |
| serviceAccounts.sparkoperator.name | string | `""` | Optional name for the operator service account |
| sidecars | list | `[]` | Sidecar containers |
| sparkJobNamespace | string | `""` | Set this if running spark jobs in a different namespace than the operator |
| sparkJobNamespaces | list | `[]` | List of namespaces where to run spark jobs, operator namespace is included only when list of namespaces is empty |
| tolerations | list | `[]` | List of node taints to tolerate |
| uiService.enable | bool | `true` | Enable UI service creation for Spark application |
| volumeMounts | list | `[]` | |
Expand Down
7 changes: 5 additions & 2 deletions charts/spark-operator-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

# In the post-install hook, the token corresponding to the operator service account
# is used to authenticate with the Kubernetes API server to install the secret bundle.

{{- $jobNamespaces := .Values.sparkJobNamespaces | default (list .Release.Namespace) }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -59,7 +60,9 @@ spec:
args:
- -v={{ .Values.logLevel }}
- -logtostderr
- -namespace={{ .Values.sparkJobNamespace }}
{{- if le (len $jobNamespaces) 1 }}
- -namespace={{ index $jobNamespaces 0 }}
{{- end }}
- -enable-ui-service={{ .Values.uiService.enable}}
- -ingress-url-format={{ .Values.ingressUrlFormat }}
- -controller-threads={{ .Values.controllerThreads }}
Expand Down
18 changes: 11 additions & 7 deletions charts/spark-operator-chart/templates/spark-rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{{- if or .Values.rbac.create .Values.rbac.createRole }}
{{- $jobNamespaces := .Values.sparkJobNamespaces | default (list .Release.Namespace) }}
{{- range $jobNamespace := $jobNamespaces }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: spark-role
namespace: {{ default .Release.Namespace .Values.sparkJobNamespace }}
namespace: {{ $jobNamespace }}
labels:
{{- include "spark-operator.labels" . | nindent 4 }}
{{- include "spark-operator.labels" $ | nindent 4 }}
rules:
- apiGroups:
- ""
Expand All @@ -32,20 +35,21 @@ rules:
verbs:
- "*"
---

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: spark
namespace: {{ default .Release.Namespace .Values.sparkJobNamespace }}
namespace: {{ $jobNamespace }}
labels:
{{- include "spark-operator.labels" . | nindent 4 }}
{{- include "spark-operator.labels" $ | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "spark.serviceAccountName" . }}
namespace: {{ default .Release.Namespace .Values.sparkJobNamespace }}
name: {{ include "spark.serviceAccountName" $ }}
namespace: {{ $jobNamespace }}
roleRef:
kind: Role
name: spark-role
namespace: {{ $jobNamespace }}
apiGroup: rbac.authorization.k8s.io
{{- end }}
{{- end }}
13 changes: 8 additions & 5 deletions charts/spark-operator-chart/templates/spark-serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{{- if .Values.serviceAccounts.spark.create }}
{{- range $sparkJobNamespace := .Values.sparkJobNamespaces | default (list .Release.Namespace) }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "spark.serviceAccountName" . }}
namespace: {{ default .Release.Namespace .Values.sparkJobNamespace }}
{{- with .Values.serviceAccounts.spark.annotations }}
name: {{ include "spark.serviceAccountName" $ }}
namespace: {{ $sparkJobNamespace }}
{{- with $.Values.serviceAccounts.spark.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{ toYaml $ | indent 4 }}
{{- end }}
labels:
{{- include "spark-operator.labels" . | nindent 4 }}
{{- include "spark-operator.labels" $ | nindent 4 }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/spark-operator-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ serviceAccounts:
# -- Optional annotations for the operator service account
annotations: {}

# -- Set this if running spark jobs in a different namespace than the operator
sparkJobNamespace: ""
# -- List of namespaces where to run spark jobs, operator namespace is included only when list of namespaces is empty
sparkJobNamespaces: []

# -- Operator concurrency, higher values might increase memory usage
controllerThreads: 10
Expand Down
Loading