Skip to content

Commit

Permalink
Prepare Release: v2.14.1 (#6004)
Browse files Browse the repository at this point in the history
* bump golang

Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* chore: build with keda-tools:1.22.5 (#5971)

* chore: build with keda-tools:1.22.5
to resolve CVE-2024-24790, CVE-2024-24789, and CVE-2024-24791
bump github.com/Azure/azure-sdk-for-go/sdk/azidentity to resolve CVE-2024-35255

Signed-off-by: Paul Yu <paul.d.yu@gmail.com>

* chore: use go install instead of go get and replacing deprecated tools

Signed-off-by: Paul Yu <paul.d.yu@gmail.com>

* chore: vendor dependency cleanup

Signed-off-by: Paul Yu <paul.d.yu@gmail.com>

* Update missing references to 1.21

Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

---------

Signed-off-by: Paul Yu <paul.d.yu@gmail.com>
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>
Co-authored-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es>
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* [BUG-5922] Report failing ScaledJob triggers in status (#5916)

Signed-off-by: Josef Karasek <josef@kedify.io>
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* [BUG-5656] Annotate Jobs with parent ScaledJob generation (#5876)

* Annotate Jobs with parent ScaledJob generation

Signed-off-by: Josef Karasek <josef@kedify.io>

* fix tests

Signed-off-by: Josef Karasek <josef@kedify.io>

* fix lint

Signed-off-by: Josef Karasek <josef@kedify.io>

* fix log message

Signed-off-by: Josef Karasek <josef@kedify.io>

* update changelog

Signed-off-by: Josef Karasek <josef@kedify.io>

* update changelog

Signed-off-by: Josef Karasek <josef@kedify.io>

* update changelog

Signed-off-by: Josef Karasek <josef@kedify.io>

---------

Signed-off-by: Josef Karasek <josef@kedify.io>
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
Co-authored-by: Zbynek Roubalik <zroubalik@gmail.com>
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* fix: `+srv` mongodb url scheme parsing bug (#5773)

This commit fixs issue #5760. where OP was facing problem with +srv schema

Signed-off-by: Rishikesh Betigeri <53863619+Rishikesh01@users.noreply.github.com>
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* fix: issue when GitHub organization contains more than 30 repos (#5746)

Signed-off-by: Simon Kobler <github@kobler.me>
Signed-off-by: Simon Kobler <32038731+KoblerS@users.noreply.github.com>
Co-authored-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es>
Co-authored-by: Simon Kobler <github@kobler.me>
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* Fix scaler leak during cache refresh (#5807)

Signed-off-by: Guillaume Jacquet <guillaume.jacquet@gmail.com>
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* Prepare release v2.14.1

Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* add missing change

Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* update changelog

Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* fix: e2e test regex check tag (#5831)

Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* Validate regex before building image for e2e test (#5783)

* added regex pre check before building image

Signed-off-by: Yaxhveer <yaxhcod@gmail.com>

* updated changelog

Signed-off-by: Yaxhveer <yaxhcod@gmail.com>

* refactored

Signed-off-by: Yaxhveer <yaxhcod@gmail.com>

* corrected

Signed-off-by: Yaxhveer <yaxhcod@gmail.com>

* corrected changelog

Signed-off-by: Yaxhveer <yaxhcod@gmail.com>

* updated the workflow

Signed-off-by: Yaxhveer <yaxhcod@gmail.com>

* updated the workflow

Signed-off-by: Yaxhveer <yaxhcod@gmail.com>

---------

Signed-off-by: Yaxhveer <yaxhcod@gmail.com>
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* fix some pending tasks

Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>

* use AAD-Pod-Identity always

Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl>

* use AAD-Pod-Identity always

Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl>

---------

Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>
Signed-off-by: Paul Yu <paul.d.yu@gmail.com>
Signed-off-by: Josef Karasek <josef@kedify.io>
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
Signed-off-by: Rishikesh Betigeri <53863619+Rishikesh01@users.noreply.github.com>
Signed-off-by: Simon Kobler <github@kobler.me>
Signed-off-by: Simon Kobler <32038731+KoblerS@users.noreply.github.com>
Signed-off-by: Guillaume Jacquet <guillaume.jacquet@gmail.com>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: Yaxhveer <yaxhcod@gmail.com>
Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl>
Co-authored-by: Paul Yu <paul.d.yu@gmail.com>
Co-authored-by: Josef Karasek <josef@kedify.io>
Co-authored-by: Zbynek Roubalik <zroubalik@gmail.com>
Co-authored-by: Rishikesh <53863619+Rishikesh01@users.noreply.github.com>
Co-authored-by: Simon Kobler <32038731+KoblerS@users.noreply.github.com>
Co-authored-by: Simon Kobler <github@kobler.me>
Co-authored-by: Guillaume Jacquet <guillaume.jacquet@gmail.com>
Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
Co-authored-by: Yashveer <101015836+Yaxhveer@users.noreply.github.com>
  • Loading branch information
10 people authored Jul 31, 2024
1 parent 6681d5e commit 10840ef
Show file tree
Hide file tree
Showing 122 changed files with 10,270 additions and 4,687 deletions.
52 changes: 19 additions & 33 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

FROM golang:1.21.9
FROM golang:1.21.12

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -16,41 +16,32 @@ ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

ENV GO111MODULE=auto

# Configure apt, install packages and tools
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog unzip 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install git iproute2 procps lsb-release \
#
# Install gocode-gomod
&& go get -x -d github.com/stamblerre/gocode 2>&1 \
&& go build -o gocode-gomod github.com/stamblerre/gocode \
&& mv gocode-gomod $GOPATH/bin/ \
#
# Install Go tools
&& go get -u -v \
github.com/mdempsky/gocode \
github.com/uudashr/gopkgs/cmd/gopkgs \
github.com/ramya-rao-a/go-outline \
github.com/acroca/go-symbols \
github.com/godoctor/godoctor \
golang.org/x/tools/cmd/gorename \
github.com/rogpeppe/godef \
github.com/zmb3/gogetdoc \
github.com/haya14busa/goplay/cmd/goplay \
github.com/sqs/goreturns \
github.com/josharian/impl \
github.com/davidrjenni/reftools/cmd/fillstruct \
github.com/fatih/gomodifytags \
github.com/cweill/gotests/... \
golang.org/x/tools/cmd/goimports \
golang.org/x/lint/golint \
github.com/alecthomas/gometalinter 2>&1 \
github.com/mgechev/revive \
github.com/derekparker/delve/cmd/dlv 2>&1 \
&& go install github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest \
&& go install github.com/ramya-rao-a/go-outline@latest \
&& go install github.com/acroca/go-symbols@latest \
&& go install github.com/godoctor/godoctor@latest \
&& go install golang.org/x/tools/cmd/gorename@latest \
&& go install github.com/rogpeppe/godef@latest \
&& go install github.com/zmb3/gogetdoc@latest \
&& go install github.com/haya14busa/goplay/cmd/goplay@latest \
&& go install github.com/sqs/goreturns@latest \
&& go install github.com/josharian/impl@latest \
&& go install github.com/davidrjenni/reftools/cmd/fillstruct@latest \
&& go install github.com/fatih/gomodifytags@latest \
&& go install github.com/cweill/gotests/...@latest \
&& go install golang.org/x/tools/cmd/goimports@latest \
&& go install golang.org/x/lint/golint@latest \
&& go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest \
&& go install github.com/mgechev/revive@latest \
&& go install github.com/go-delve/delve/cmd/dlv@latest \
&& go install honnef.co/go/tools/cmd/staticcheck@latest \
&& go install golang.org/x/tools/gopls@latest \
# Protocol Buffer Compiler
Expand All @@ -61,8 +52,6 @@ RUN apt-get update \
&& mv $HOME/.local/bin/protoc /usr/local/bin/protoc \
&& mv $HOME/.local/include/ /usr/local/bin/include/ \
&& protoc --version \
# Install golangci-lint
&& curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
Expand Down Expand Up @@ -91,9 +80,6 @@ RUN apt-get update \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Enable go modules
ENV GO111MODULE=on

ENV OPERATOR_RELEASE_VERSION=v1.26.0
RUN ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac) \
&& OS=$(uname | awk '{print tolower($0)}') \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
id-token: write # needed for signing the images with GitHub OIDC Token **not production ready**

# keda-tools is built from github.com/test-tools/tools/Dockerfile
container: ghcr.io/kedacore/keda-tools:1.21.9
container: ghcr.io/kedacore/keda-tools:1.21.12
steps:
- name: Check out code
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4
Expand Down
40 changes: 38 additions & 2 deletions .github/workflows/pr-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
needs: triage
runs-on: ubuntu-latest
name: Build images
container: ghcr.io/kedacore/keda-tools:1.21.9
container: ghcr.io/kedacore/keda-tools:1.21.12
if: needs.triage.outputs.run-e2e == 'true'
steps:
- name: Set status in-progress
Expand All @@ -93,6 +93,42 @@ jobs:
gh pr checkout ${{ needs.triage.outputs.pr_num }}
git checkout ${{ needs.triage.outputs.commit_sha }}
- name: Run regex checks
id: regex-validation
continue-on-error: true
env:
COMMENT_BODY: ${{ github.event.comment.body }}
run: |
MESSAGE="$COMMENT_BODY"
REGEX='/run-e2e (.+)'
if [[ "$MESSAGE" =~ $REGEX ]]
then
export E2E_TEST_REGEX="$(echo ${BASH_REMATCH[1]} | head -1)"
fi
make e2e-regex-check
- name: React to comment with failure
uses: dkershner6/reaction-action@v2
if: steps.regex-validation.outcome != 'success'
with:
token: ${{ secrets.GITHUB_TOKEN }}
commentId: ${{ github.event.comment.id }}
reaction: "-1"

- name: Set status failure
uses: LouisBrunner/checks-action@6b626ffbad7cc56fd58627f774b9067e6118af23 # v2
if: steps.regex-validation.outcome != 'success'
with:
token: ${{ secrets.GITHUB_TOKEN }}
sha: ${{ needs.triage.outputs.commit_sha }}
name: ${{ env.E2E_CHECK_NAME }}
conclusion: failure
details_url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

- name: Exit on failure
if: steps.regex-validation.outcome != 'success'
run: exit 1

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand All @@ -112,7 +148,7 @@ jobs:
needs: [triage, build-test-images]
runs-on: e2e
name: Execute e2e tests
container: ghcr.io/kedacore/keda-tools:1.21.9
container: ghcr.io/kedacore/keda-tools:1.21.12
if: needs.triage.outputs.run-e2e == 'true'
steps:
- name: Set status in-progress
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
validate:
name: validate - ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
container: ghcr.io/kedacore/keda-tools:1.21.9
container: ghcr.io/kedacore/keda-tools:1.21.12
strategy:
matrix:
include:
Expand Down Expand Up @@ -73,9 +73,9 @@ jobs:
validate-dockerfiles:
name: validate-dockerfiles - ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
container: ghcr.io/kedacore/keda-tools:1.21.9
container: ghcr.io/kedacore/keda-tools:1.21.12
strategy:
matrix:
matrix:
include:
- runner: ARM64
name: arm64
Expand Down Expand Up @@ -104,9 +104,9 @@ jobs:
validate-dev-container:
name: Validate dev-container - ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
container: ghcr.io/kedacore/keda-tools:1.21.9
container: ghcr.io/kedacore/keda-tools:1.21.12
strategy:
matrix:
matrix:
include:
- runner: ARM64
name: arm64
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
id-token: write # needed for signing the images with GitHub OIDC Token **not production ready**

# keda-tools is built from github.com/test-tools/tools/Dockerfile
container: ghcr.io/kedacore/keda-tools:1.21.9
container: ghcr.io/kedacore/keda-tools:1.21.12
steps:
- name: Check out code
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis-codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
codeQl:
name: Analyze CodeQL Go
runs-on: ubuntu-latest
container: ghcr.io/kedacore/keda-tools:1.21.9
container: ghcr.io/kedacore/keda-tools:1.21.12
if: (github.actor != 'dependabot[bot]')
steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/template-main-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Run e2e test
runs-on: ARM64
# keda-tools is built from github.com/test-tools/tools/Dockerfile
container: ghcr.io/kedacore/keda-tools:1.21.9
container: ghcr.io/kedacore/keda-tools:1.21.12
concurrency: e2e-tests
steps:
- name: Check out code
Expand Down
40 changes: 9 additions & 31 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio
## History

- [Unreleased](#unreleased)
- [v2.14.1](#v2141)
- [v2.14.0](#v2140)
- [v2.13.1](#v2131)
- [v2.13.0](#v2130)
Expand Down Expand Up @@ -50,41 +51,18 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio
- [v1.1.0](#v110)
- [v1.0.0](#v100)

## Unreleased

### New

- TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX))

#### Experimental

Here is an overview of all new **experimental** features:

- TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX))

### Improvements

- TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX))
## v2.14.1

### Fixes

- TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX))

### Deprecations

You can find all deprecations in [this overview](https://github.com/kedacore/keda/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Abreaking-change) and [join the discussion here](https://github.com/kedacore/keda/discussions/categories/deprecations).

New deprecation(s):

- TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX))

### Breaking Changes

- TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX))

### Other
- **General**: Do not delete running Jobs on KEDA restart ([#5656](https://github.com/kedacore/keda/issues/5656))
- **General**: Fix CVE-2024-24790, CVE-2024-24789, and CVE-2024-24791 in stdlib. ([#5971](https://github.com/kedacore/keda/pull/5971))
- **General**: Fix CVE-2024-35255 in github.com/Azure/azure-sdk-for-go/sdk/azidentity ([#5971](https://github.com/kedacore/keda/pull/5971))
- **General**: Fix CVE-2024-6104 in github.com/hashicorp/go-retryablehttp ([#5971](https://github.com/kedacore/keda/pull/5971))
- **General**: Fix ScaledJob ignores failing trigger(s) error ([#5922](https://github.com/kedacore/keda/issues/5922))- **General**: Scalers are properly closed after being refreshed ([#5806](https://github.com/kedacore/keda/issues/5806))
- **GitHub Scaler**: Fixed pagination, fetching repository list ([#5738](https://github.com/kedacore/keda/issues/5738))
- **MongoDB Scaler**: MongoDB url parses correctly `+srv` scheme ([#5760](https://github.com/kedacore/keda/issues/5760))

- TODO ([#XXX](https://github.com/kedacore/keda/issues/XXX))

## v2.14.0

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/keda-tools:1.21.9 AS builder
FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/keda-tools:1.21.12 AS builder

ARG BUILD_VERSION=main
ARG GIT_COMMIT=HEAD
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.adapter
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the adapter binary
FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/keda-tools:1.21.9 AS builder
FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/keda-tools:1.21.12 AS builder

ARG BUILD_VERSION=main
ARG GIT_COMMIT=HEAD
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.webhooks
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/keda-tools:1.21.9 AS builder
FROM --platform=$BUILDPLATFORM ghcr.io/kedacore/keda-tools:1.21.12 AS builder

ARG BUILD_VERSION=main
ARG GIT_COMMIT=HEAD
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ scale-node-pool: az-login ## Scale nodepool.
--resource-group $(TF_AZURE_RESOURCE_GROUP) \
--node-count $(NODE_POOL_SIZE)

.PHONY: e2e-regex-check
e2e-regex-check:
go run -tags e2e ./tests/run-all.go regex-check

.PHONY: e2e-test
e2e-test: get-cluster-context ## Run e2e tests against Azure cluster.
TERMINFO=/etc/terminfo
Expand Down Expand Up @@ -268,15 +272,15 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
deploy: install ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && \
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda=${IMAGE_CONTROLLER} && \
if [ "$(AZURE_RUN_AAD_POD_IDENTITY_TESTS)" = true ]; then \
if [ "$(AZURE_RUN_WORKLOAD_IDENTITY_TESTS)" = true ]; then \
$(KUSTOMIZE) edit add label --force aadpodidbinding:keda; \
fi && \
if [ "$(AZURE_RUN_WORKLOAD_IDENTITY_TESTS)" = true ]; then \
$(KUSTOMIZE) edit add label --force azure.workload.identity/use:true; \
fi
cd config/metrics-server && \
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda-metrics-apiserver=${IMAGE_ADAPTER} && \
if [ "$(AZURE_RUN_AAD_POD_IDENTITY_TESTS)" = true ]; then \
if [ "$(AZURE_RUN_WORKLOAD_IDENTITY_TESTS)" = true ]; then \
$(KUSTOMIZE) edit add label --force aadpodidbinding:keda; \
fi
if [ "$(AZURE_RUN_WORKLOAD_IDENTITY_TESTS)" = true ]; then \
Expand Down
38 changes: 26 additions & 12 deletions controllers/keda/scaledjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,22 +279,36 @@ func (r *ScaledJobReconciler) deletePreviousVersionScaleJobs(ctx context.Context
return "Cannot get list of Jobs owned by this scaledJob", err
}

if len(jobs.Items) > 0 {
logger.Info("RolloutStrategy: immediate, Deleting jobs owned by the previous version of the scaledJob", "numJobsToDelete", len(jobs.Items))
jobIndexes := make([]int, 0, len(jobs.Items))
scaledJobGeneration := strconv.FormatInt(scaledJob.Generation, 10)
for i, job := range jobs.Items {
if jobGen, ok := job.Annotations["scaledjob.keda.sh/generation"]; !ok {
// delete Jobs that don't have the generation annotation
jobIndexes = append(jobIndexes, i)
} else if jobGen != scaledJobGeneration {
// delete Jobs that have a different generation annotation
jobIndexes = append(jobIndexes, i)
}
}
for _, job := range jobs.Items {
job := job

propagationPolicy := metav1.DeletePropagationBackground
if scaledJob.Spec.Rollout.PropagationPolicy == "foreground" {
propagationPolicy = metav1.DeletePropagationForeground
}
err = r.Client.Delete(ctx, &job, client.PropagationPolicy(propagationPolicy))
if err != nil {
return "Not able to delete job: " + job.Name, err
if len(jobIndexes) == 0 {
logger.Info("RolloutStrategy: immediate, No jobs owned by the previous version of the scaledJob")
} else {
logger.Info("RolloutStrategy: immediate, Deleting jobs owned by the previous version of the scaledJob", "numJobsToDelete", len(jobIndexes))
for _, index := range jobIndexes {
job := jobs.Items[index]

propagationPolicy := metav1.DeletePropagationBackground
if scaledJob.Spec.Rollout.PropagationPolicy == "foreground" {
propagationPolicy = metav1.DeletePropagationForeground
}
err = r.Client.Delete(ctx, &job, client.PropagationPolicy(propagationPolicy))
if err != nil {
return "Not able to delete job: " + job.Name, err
}
}
return fmt.Sprintf("RolloutStrategy: immediate, deleted jobs owned by the previous version of the scaleJob: %d jobs deleted", len(jobIndexes)), nil
}
return fmt.Sprintf("RolloutStrategy: immediate, deleted jobs owned by the previous version of the scaleJob: %d jobs deleted", len(jobs.Items)), nil
}
return fmt.Sprintf("RolloutStrategy: %s", scaledJob.Spec.RolloutStrategy), nil
}
Expand Down
Loading

0 comments on commit 10840ef

Please sign in to comment.