This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop rerunning create jobs on non-generation bumping updates
If an app is updated in such a way that the generation is not bumped (e.g. an annotation or label is add/removed/modified), then any job that is create-only would rerun if the generation of the app is 1. This change ensures that create-only jobs will not be rerun in this instance. Signed-off-by: Donnie Adams <[email protected]>
- Loading branch information
Showing
5 changed files
with
172 additions
and
3 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
pkg/controller/appdefinition/testdata/job/event-jobs-update-generation-one/existing.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
name: create-only | ||
namespace: app-created-namespace | ||
annotations: | ||
acorn.io/app-generation: "1" | ||
labels: | ||
acorn.io/app-name: app-name | ||
acorn.io/app-public-name: "app-name" | ||
acorn.io/app-namespace: app-namespace | ||
acorn.io/managed: "true" | ||
acorn.io/job-name: "create-only" | ||
--- | ||
kind: Job | ||
apiVersion: batch/v1 | ||
metadata: | ||
name: create-only | ||
namespace: app-created-namespace | ||
annotations: | ||
acorn.io/app-generation: "1" | ||
apply.acorn.io/prune: "false" | ||
apply.acorn.io/update: "true" | ||
labels: | ||
"acorn.io/app-namespace": "app-namespace" | ||
"acorn.io/app-name": "app-name" | ||
acorn.io/app-public-name: "app-name" | ||
"acorn.io/job-name": "create-only" | ||
"acorn.io/managed": "true" | ||
spec: | ||
backoffLimit: 1000 | ||
template: | ||
metadata: | ||
labels: | ||
"acorn.io/app-namespace": "app-namespace" | ||
"acorn.io/app-name": "app-name" | ||
acorn.io/app-public-name: "app-name" | ||
"acorn.io/job-name": "create-only" | ||
"acorn.io/managed": "true" | ||
annotations: | ||
acorn.io/app-generation: "1" | ||
acorn.io/container-spec: '{"events":["create"],"image":"create-only-image","probes":null}' | ||
spec: | ||
imagePullSecrets: | ||
- name: create-only-pull-1234567890ab | ||
restartPolicy: Never | ||
serviceAccountName: create-only | ||
enableServiceLinks: false | ||
terminationGracePeriodSeconds: 5 | ||
containers: | ||
- name: create-only | ||
image: "create-only-image" | ||
terminationMessagePath: "/run/secrets/output" | ||
env: | ||
- name: ACORN_EVENT | ||
value: "create" | ||
--- | ||
kind: Secret | ||
apiVersion: v1 | ||
metadata: | ||
name: create-only-pull-1234567890ab | ||
namespace: app-created-namespace | ||
labels: | ||
acorn.io/managed: "true" | ||
acorn.io/pull-secret: "true" | ||
type: "kubernetes.io/dockerconfigjson" | ||
data: | ||
".dockerconfigjson": eyJhdXRocyI6eyJpbmRleC5kb2NrZXIuaW8iOnsiYXV0aCI6Ik9nPT0ifX19 |
69 changes: 69 additions & 0 deletions
69
pkg/controller/appdefinition/testdata/job/event-jobs-update-generation-one/expected.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
`apiVersion: internal.acorn.io/v1 | ||
kind: AppInstance | ||
metadata: | ||
creationTimestamp: null | ||
generation: 1 | ||
name: app-name | ||
namespace: app-namespace | ||
uid: 1234567890abcdef | ||
spec: | ||
image: test | ||
status: | ||
appImage: | ||
buildContext: {} | ||
id: test | ||
imageData: {} | ||
vcs: {} | ||
appSpec: | ||
jobs: | ||
create-only: | ||
events: | ||
- create | ||
image: create-only-image | ||
metrics: {} | ||
probes: null | ||
delete-only: | ||
events: | ||
- delete | ||
image: delete-only-image | ||
metrics: {} | ||
probes: null | ||
stop-only: | ||
events: | ||
- stop | ||
image: stop-only-image | ||
metrics: {} | ||
probes: null | ||
update-only: | ||
events: | ||
- update | ||
image: update-only-image | ||
metrics: {} | ||
probes: null | ||
appStatus: | ||
jobs: | ||
create-only: | ||
createEventSucceeded: true | ||
skipped: true | ||
delete-only: | ||
skipped: true | ||
stop-only: | ||
skipped: true | ||
update-only: | ||
skipped: true | ||
columns: {} | ||
conditions: | ||
observedGeneration: 1 | ||
reason: Success | ||
status: "True" | ||
success: true | ||
type: defined | ||
defaults: {} | ||
namespace: app-created-namespace | ||
staged: | ||
appImage: | ||
buildContext: {} | ||
imageData: {} | ||
vcs: {} | ||
summary: {} | ||
` |
32 changes: 32 additions & 0 deletions
32
pkg/controller/appdefinition/testdata/job/event-jobs-update-generation-one/input.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
kind: AppInstance | ||
apiVersion: internal.acorn.io/v1 | ||
metadata: | ||
generation: 1 | ||
name: app-name | ||
namespace: app-namespace | ||
uid: 1234567890abcdef | ||
spec: | ||
image: test | ||
status: | ||
namespace: app-created-namespace | ||
appImage: | ||
id: test | ||
appSpec: | ||
jobs: | ||
delete-only: | ||
events: ["delete"] | ||
image: "delete-only-image" | ||
create-only: | ||
events: ["create"] | ||
image: "create-only-image" | ||
update-only: | ||
events: ["update"] | ||
image: "update-only-image" | ||
stop-only: | ||
events: ["stop"] | ||
image: "stop-only-image" | ||
appStatus: | ||
jobs: | ||
create-only: | ||
createEventSucceeded: true | ||
succeeded: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters