Skip to content

Commit 91c499d

Browse files
Bug 1856714: Adding checks for rescued tasks during reconciliation (#3727)
* Rescue reconciliation * Add changelog fragment * Update links in doc * Pin docker to fix CI
1 parent 4dd9248 commit 91c499d

File tree

7 files changed

+25
-5
lines changed

7 files changed

+25
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
### Additions
2121

2222
- Add "panic" level for --zap-stacktrace-level (allows "debug", "info", "error", "panic"). ([#3040](https://github.com/operator-framework/operator-sdk/pull/3040))
23-
- The `operator-sdk` binary has a new CLI workflow and project layout for scaffolding Go operators that is aligned with Kubebuilder's CLI and project layout. See the new [Quickstart Guide](https://sdk.operatorframework.io/docs/golang/quickstart/) and the new [CLI reference](https://v0-19-x.sdk.operatorframework.io/docs/new-cli/) for more details. ([#3190](https://github.com/operator-framework/operator-sdk/pull/3190))
23+
The `operator-sdk` binary has a new CLI workflow and project layout for scaffolding Go operators that is aligned with Kubebuilder's CLI and project layout. See the new [Quickstart Guide](https://sdk.operatorframework.io/docs/building-operators/golang/quickstart/) and the new [CLI reference](https://v0-19-x.sdk.operatorframework.io/docs/new-cli/) for more details. ([#3190](https://github.com/operator-framework/operator-sdk/pull/3190))
2424
- `bundle validate` can now use a containerd image ("none") tool to unpack images, removing the need for an external image tool like docker/podman. ([#3222](https://github.com/operator-framework/operator-sdk/pull/3222))
2525
- The SDK `scorecard` command adds a new test image, scorecard-test-kuttl, that allows end users to write and execute kuttl based tests. ([#3278](https://github.com/operator-framework/operator-sdk/pull/3278))
2626
- Add "--olm-namespace" flag to olm subcommands (install, uninstall) to allow users to specify the namespace where olm is to be installed or uninstalled. ([#3300](https://github.com/operator-framework/operator-sdk/pull/3300))
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
entries:
2+
- description: >
3+
Stop reconciling tasks when the event raised is a rescue in Ansible-based Operators.
4+
More info: [Bugzilla 1856714](https://bugzilla.redhat.com/show_bug.cgi?id=1856714)
5+
6+
kind: "bugfix"
7+
8+
breaking: false

cmd/operator-sdk/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func main() {
4646
if operatorType == projutil.OperatorTypeGo {
4747
depMsg := "Operator SDK has a new CLI and project layout that is aligned with Kubebuilder.\n" +
4848
"See `operator-sdk init -h` and the following doc on how to scaffold a new project:\n" +
49-
"https://sdk.operatorframework.io/docs/golang/quickstart/\n" +
49+
"https://v0-19-x.sdk.operatorframework.io/docs/golang/quickstart/\n" +
5050
"To migrate existing projects to the new layout see:\n" +
5151
"https://sdk.operatorframework.io/docs/golang/migration/project_migration_guide/\n"
5252
projutil.PrintDeprecationWarning(depMsg)

hack/tests/e2e-ansible-molecule.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trap_add 'rm -rf $TMPDIR' EXIT
1313
pip3 install --user pyasn1==0.4.7 pyasn1-modules==0.2.6 idna==2.8 ipaddress==1.0.22
1414
pip3 install --user molecule==3.0.2
1515
pip3 install --user ansible-lint yamllint
16-
pip3 install --user docker openshift jmespath
16+
pip3 install --user docker==4.2.2 openshift jmespath
1717
ansible-galaxy collection install community.kubernetes
1818

1919
deploy_prereqs() {

internal/util/projutil/project_util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ func CheckGoModules() error {
315315
}
316316
if !goModOn {
317317
return fmt.Errorf(`using go modules requires GO111MODULE="on", "auto", or unset.` +
318-
` More info: https://sdk.operatorframework.io/docs/golang/quickstart/#a-note-on-dependency-management`)
318+
` More info: https://v0-19-x.sdk.operatorframework.io/docs/golang/quickstart/#a-note-on-dependency-management`)
319319
}
320320
return nil
321321
}

pkg/ansible/controller/reconcile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (r *AnsibleOperatorReconciler) Reconcile(request reconcile.Request) (reconc
186186
return reconcile.Result{}, err
187187
}
188188
}
189-
if event.Event == eventapi.EventRunnerOnFailed && !event.IgnoreError() {
189+
if event.Event == eventapi.EventRunnerOnFailed && !event.IgnoreError() && !event.Rescued() {
190190
failureMessages = append(failureMessages, event.GetFailedPlaybookMessage())
191191
}
192192
}

pkg/ansible/runner/eventapi/types.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,15 @@ func (je JobEvent) IgnoreError() bool {
122122
}
123123
return false
124124
}
125+
126+
// Rescued - Detects whether or not a task was rescued
127+
func (je JobEvent) Rescued() bool {
128+
if rescued, contains := je.EventData["rescued"]; contains {
129+
for _, v := range rescued.(map[string]interface{}) {
130+
if int(v.(float64)) == 1 {
131+
return true
132+
}
133+
}
134+
}
135+
return false
136+
}

0 commit comments

Comments
 (0)