Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7442156
FEATURE: add cli argument to modify controller workqueue ratelimiter …
ImpSy Sep 29, 2024
03d54ab
Fix ingress capability discovery (#2201)
jacobsalway Sep 29, 2024
81189b1
Bump github.com/aws/aws-sdk-go-v2 from 1.30.5 to 1.31.0 (#2207)
dependabot[bot] Sep 29, 2024
3c9d28a
Bump golang.org/x/net from 0.28.0 to 0.29.0 (#2205)
dependabot[bot] Sep 29, 2024
0b73dd7
Bump github.com/docker/docker from 27.0.3+incompatible to 27.1.1+inco…
dependabot[bot] Sep 29, 2024
f421bcc
Bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.58.3 to 1.63.3 (#…
dependabot[bot] Sep 30, 2024
1212dcb
Update integration test workflow and add golangci lint check (#2197)
ChenYi015 Oct 8, 2024
7d94431
Bump github.com/aws/aws-sdk-go-v2 from 1.31.0 to 1.32.0 (#2229)
dependabot[bot] Oct 8, 2024
0a501ad
Bump cloud.google.com/go/storage from 1.43.0 to 1.44.0 (#2228)
dependabot[bot] Oct 8, 2024
b60cf31
Bump manusa/actions-setup-minikube from 2.11.0 to 2.12.0 (#2226)
dependabot[bot] Oct 8, 2024
c95c508
Bump golang.org/x/time from 0.6.0 to 0.7.0 (#2227)
dependabot[bot] Oct 8, 2024
6331cb7
fix: imagePullPolicy was ignored (#2222)
missedone Oct 8, 2024
4ff1825
fix: spark-submission failed due to lack of permission by user `spark…
missedone Oct 8, 2024
7e14adb
Bump github.com/aws/aws-sdk-go-v2/config from 1.27.33 to 1.27.42 (#2231)
dependabot[bot] Oct 8, 2024
8df3376
Bump github.com/prometheus/client_golang from 1.19.1 to 1.20.4 (#2204)
dependabot[bot] Oct 8, 2024
ef7d84f
Remove `cap_net_bind_service` from image (#2216)
jacobsalway Oct 8, 2024
3d752be
fix: webhook panics due to logging (#2232)
ChenYi015 Oct 10, 2024
625117d
Add check for generating manifests and code (#2234)
ChenYi015 Oct 10, 2024
451c68d
Spark Operator Official Release v2.0.2
ChenYi015 Oct 10, 2024
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
103 changes: 81 additions & 22 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,80 @@ concurrency:
cancel-in-progress: true

jobs:
build-api-docs:
code-check:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: The API documentation hasn't changed
- name: Run go mod tidy
run: |
make build-api-docs
if ! git diff --quiet -- docs/api-docs.md; then
echo "Need to re-run 'make build-api-docs' and commit the changes"
git diff -- docs/api-docs.md;
go mod tidy
if ! git diff --quiet; then
echo "Please run 'go mod tidy' and commit the changes."
git diff
false
fi

build-sparkctl:
- name: Generate code
run: |
make generate
if ! git diff --quiet; then
echo "Need to re-run 'make generate' and commit the changes."
git diff
false
fi

- name: Run go fmt check
run: |
make go-fmt
if ! git diff --quiet; then
echo "Need to re-run 'make go-fmt' and commit the changes."
git diff
false
fi

- name: Run go vet check
run: |
make go-vet
if ! git diff --quiet; then
echo "Need to re-run 'make go-vet' and commit the changes."
git diff
false
fi

- name: Run golangci-lint
run: |
make go-lint

build-api-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: build sparkctl
run: make build-sparkctl
- name: Build API docs
run: |
make build-api-docs
if ! git diff --quiet; then
echo "Need to re-run 'make build-api-docs' and commit the changes."
git diff
false
fi

build-spark-operator:
runs-on: ubuntu-latest
Expand All @@ -63,18 +104,28 @@ jobs:
with:
go-version-file: go.mod

- name: Run go fmt check
run: make go-fmt

- name: Run go vet check
run: make go-vet

- name: Run unit tests
- name: Run go unit tests
run: make unit-test

- name: Build Spark operator
run: make build-operator

build-sparkctl:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Build sparkctl
run: make build-sparkctl

build-helm-chart:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -103,6 +154,18 @@ jobs:
- name: Set up chart-testing
uses: helm/[email protected]

- name: Generate manifests
run: |
make manifests
if ! git diff --quiet; then
echo "Need to re-run 'make manifests' and commit the changes."
git diff
false
fi

- name: Detect CRDs drift between chart and manifest
run: make detect-crds-drift

- name: Run chart-testing (list-changed)
id: list-changed
env:
Expand All @@ -119,22 +182,18 @@ jobs:
BRANCH: ${{ steps.get_branch.outputs.BRANCH }}
run: ct lint --check-version-increment=false --target-branch $BRANCH

- name: Detect CRDs drift between chart and manifest
if: steps.list-changed.outputs.changed == 'true'
run: make detect-crds-drift

- name: Produce the helm documentation
if: steps.list-changed.outputs.changed == 'true'
run: |
make helm-docs
if ! git diff --quiet -- charts/spark-operator-chart/README.md; then
echo "Need to re-run 'make helm-docs' and commit the changes"
echo "Need to re-run 'make helm-docs' and commit the changes."
false
fi

- name: setup minikube
if: steps.list-changed.outputs.changed == 'true'
uses: manusa/actions-setup-minikube@v2.11.0
uses: manusa/actions-setup-minikube@v2.12.0
with:
minikube version: v1.33.0
kubernetes version: v1.30.0
Expand Down
89 changes: 58 additions & 31 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,66 @@
run:
deadline: 5m
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 1m

linters:
# Enable specific linters.
# https://golangci-lint.run/usage/linters/#enabled-by-default
enable:
- revive
- gci
- depguard
- godot
- testifylint
- unconvert
# Detects places where loop variables are copied.
- copyloopvar
# Checks for duplicate words in the source code.
- dupword
# Tool for detection of FIXME, TODO and other comment keywords.
# - godox
# Check import statements are formatted according to the 'goimport' command.
- goimports
# Enforces consistent import aliases.
- importas
# Find code that shadows one of Go's predeclared identifiers.
- predeclared
# Check that struct tags are well aligned.
- tagalign
# Remove unnecessary type conversions.
- unconvert
# Checks Go code for unused constants, variables, functions and types.
- unused

issues:
exclude-rules:
# Disable errcheck linter for test files.
- path: _test.go
linters:
- errcheck
# Which dirs to exclude: issues from them won't be reported.
# Can use regexp here: `generated.*`, regexp is applied on full path,
# including the path prefix if one is set.
# Default dirs are skipped independently of this option's value (see exclude-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work on Windows.
# Default: []
exclude-dirs:
- sparkctl
# Maximum issues count per one linter.
# Set to 0 to disable.
# Default: 50
max-issues-per-linter: 50
# Maximum count of issues with the same text.
# Set to 0 to disable.
# Default: 3
max-same-issues: 3

linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/kubeflow/spark-operator)
depguard:
Main:
files:
- $all
- "!$test"
listMode: Lax
deny:
reflect: Please don't use reflect package
Test:
files:
- $test
listMode: Lax
deny:
reflect: Please don't use reflect package
importas:
# List of aliases
alias:
- pkg: k8s.io/api/admissionregistration/v1
alias: admissionregistrationv1
- pkg: k8s.io/api/apps/v1
alias: appsv1
- pkg: k8s.io/api/batch/v1
alias: batchv1
- pkg: k8s.io/api/core/v1
alias: corev1
- pkg: k8s.io/api/extensions/v1beta1
alias: extensionsv1beta1
- pkg: k8s.io/api/networking/v1
alias: networkingv1
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: sigs.k8s.io/controller-runtime
alias: ctrl
9 changes: 2 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ FROM golang:1.23.1 AS builder

WORKDIR /workspace

RUN apt-get update \
&& apt-get install -y libcap2-bin \
&& rm -rf /var/lib/apt/lists/*

RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=go.mod,target=go.mod \
--mount=type=bind,source=go.sum,target=go.sum \
Expand All @@ -36,7 +32,6 @@ ARG TARGETARCH
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=cache,target="/root/.cache/go-build" \
CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on make build-operator
RUN setcap 'cap_net_bind_service=+ep' /workspace/bin/spark-operator

FROM ${SPARK_IMAGE}

Expand All @@ -46,9 +41,9 @@ RUN apt-get update \
&& apt-get install -y tini \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /etc/k8s-webhook-server/serving-certs && \
RUN mkdir -p /etc/k8s-webhook-server/serving-certs /home/spark && \
chmod -R g+rw /etc/k8s-webhook-server/serving-certs && \
chown -R spark /etc/k8s-webhook-server/serving-certs
chown -R spark /etc/k8s-webhook-server/serving-certs /home/spark

USER spark

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ KIND_VERSION ?= v0.23.0
ENVTEST_VERSION ?= release-0.18
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION ?= 1.29.3
GOLANGCI_LINT_VERSION ?= v1.57.2
GOLANGCI_LINT_VERSION ?= v1.61.0
GEN_CRD_API_REFERENCE_DOCS_VERSION ?= v0.3.0
HELM_VERSION ?= v3.15.3
HELM_UNITTEST_VERSION ?= 0.5.1
Expand Down Expand Up @@ -136,13 +136,13 @@ go-vet: ## Run go vet against code.
@echo "Running go vet..."
go vet ./...

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter.
.PHONY: go-lint
go-lint: golangci-lint ## Run golangci-lint linter.
@echo "Running golangci-lint run..."
$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes.
.PHONY: go-lint-fix
go-lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes.
@echo "Running golangci-lint run --fix..."
$(GOLANGCI_LINT) run --fix

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.0.1
v2.0.2
4 changes: 2 additions & 2 deletions api/v1beta1/sparkapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ type SparkApplicationSpec struct {
// spark-submit.
// Optional.
SparkConf map[string]string `json:"sparkConf,omitempty"`
// HadoopConf carries user-specified Hadoop configuration properties as they would use the the "--conf" option
// in spark-submit. The SparkApplication controller automatically adds prefix "spark.hadoop." to Hadoop
// HadoopConf carries user-specified Hadoop configuration properties as they would use the "--conf" option
// in spark-submit. The SparkApplication controller automatically adds prefix "spark.hadoop." to Hadoop
// configuration properties.
// Optional.
HadoopConf map[string]string `json:"hadoopConf,omitempty"`
Expand Down
1 change: 0 additions & 1 deletion api/v1beta2/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func SetSparkApplicationDefaults(app *SparkApplication) {
}

func setDriverSpecDefaults(spec *DriverSpec, sparkConf map[string]string) {

if _, exists := sparkConf["spark.driver.cores"]; !exists && spec.Cores == nil {
spec.Cores = new(int32)
*spec.Cores = 1
Expand Down
1 change: 0 additions & 1 deletion api/v1beta2/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ func TestSetSparkApplicationDefaultsOnFailureRestartPolicyShouldSetDefaultValueF
}

func TestSetSparkApplicationDefaultsDriverSpecDefaults(t *testing.T) {

//Case1: Driver config not set.
app := &SparkApplication{
Spec: SparkApplicationSpec{},
Expand Down
1 change: 0 additions & 1 deletion api/v1beta2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ limitations under the License.
*/

// +k8s:deepcopy-gen=package,register
// go:generate controller-gen crd:trivialVersions=true paths=. output:dir=.

// Package v1beta2 is the v1beta2 version of the API.
// +groupName=sparkoperator.k8s.io
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta2/sparkapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ type SparkApplicationSpec struct {
// spark-submit.
// +optional
SparkConf map[string]string `json:"sparkConf,omitempty"`
// HadoopConf carries user-specified Hadoop configuration properties as they would use the the "--conf" option
// in spark-submit. The SparkApplication controller automatically adds prefix "spark.hadoop." to Hadoop
// HadoopConf carries user-specified Hadoop configuration properties as they would use the "--conf" option
// in spark-submit. The SparkApplication controller automatically adds prefix "spark.hadoop." to Hadoop
// configuration properties.
// +optional
HadoopConf map[string]string `json:"hadoopConf,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions charts/spark-operator-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ name: spark-operator

description: A Helm chart for Spark on Kubernetes operator.

version: 2.0.1
version: 2.0.2

appVersion: 2.0.1
appVersion: 2.0.2

keywords:
- apache spark
Expand Down
Loading