From 65a08649ec3b63ac4be68a5adc2ff0697e869660 Mon Sep 17 00:00:00 2001 From: Venkat Ramaraju Date: Wed, 5 Aug 2020 07:21:35 -0700 Subject: [PATCH 1/7] Rescue reconciliation --- pkg/ansible/controller/reconcile.go | 2 +- pkg/ansible/runner/eventapi/types.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/ansible/controller/reconcile.go b/pkg/ansible/controller/reconcile.go index 62aa3c540b..25b977e96c 100644 --- a/pkg/ansible/controller/reconcile.go +++ b/pkg/ansible/controller/reconcile.go @@ -186,7 +186,7 @@ func (r *AnsibleOperatorReconciler) Reconcile(request reconcile.Request) (reconc return reconcile.Result{}, err } } - if event.Event == eventapi.EventRunnerOnFailed && !event.IgnoreError() { + if event.Event == eventapi.EventRunnerOnFailed && !event.IgnoreError() && !event.Rescued() { failureMessages = append(failureMessages, event.GetFailedPlaybookMessage()) } } diff --git a/pkg/ansible/runner/eventapi/types.go b/pkg/ansible/runner/eventapi/types.go index f8098da3e8..d0ba259e7b 100644 --- a/pkg/ansible/runner/eventapi/types.go +++ b/pkg/ansible/runner/eventapi/types.go @@ -122,3 +122,15 @@ func (je JobEvent) IgnoreError() bool { } return false } + +// Rescued - Detects whether or not a task was rescued +func (je JobEvent) Rescued() bool { + if rescued, contains := je.EventData["rescued"]; contains { + for _, v := range rescued.(map[string]interface{}) { + if int(v.(float64)) == 1 { + return true + } + } + } + return false +} From 80faea66a308703d99d0029f20f5e52b05507c76 Mon Sep 17 00:00:00 2001 From: Venkat Ramaraju Date: Wed, 12 Aug 2020 10:21:40 -0700 Subject: [PATCH 2/7] Changelog fragment file --- changelog/fragments/00-template.yaml | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/changelog/fragments/00-template.yaml b/changelog/fragments/00-template.yaml index 44f68b5ba6..ed7c440c71 100644 --- a/changelog/fragments/00-template.yaml +++ b/changelog/fragments/00-template.yaml @@ -1,5 +1,3 @@ -# entries is a list of entries to include in -# release notes and/or the migration guide entries: - description: > Description is the line that shows up in the CHANGELOG. This @@ -7,30 +5,6 @@ entries: the YAML string '>' operator means you can write your entry multiple lines and it will still be parsed as a single line. - # kind is one of: - # - addition - # - change - # - deprecation - # - removal - # - bugfix - kind: "" + kind: "addition" - # Is this a breaking change? breaking: false - - # NOTE: ONLY USE `pull_request_override` WHEN ADDING THIS - # FILE FOR A PREVIOUSLY MERGED PULL_REQUEST! - # - # The generator auto-detects the PR number from the commit - # message in which this file was originally added. - # - # What is the pull request number (without the "#")? - # pull_request_override: 0 - - - # Migration can be defined to automatically add a section to - # the migration guide. This is required for breaking changes. - migration: - header: Header text for the migration section - body: > - Body of the migration section. From c6f5ba89b4119f5e8fab78d7dc6457941c49adab Mon Sep 17 00:00:00 2001 From: Venkat Ramaraju Date: Wed, 12 Aug 2020 10:37:42 -0700 Subject: [PATCH 3/7] Changes --- changelog/fragments/00-template.yaml | 28 ++++++++++++++++++- .../fragments/rescue-reconciliation.yaml | 8 ++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 changelog/fragments/rescue-reconciliation.yaml diff --git a/changelog/fragments/00-template.yaml b/changelog/fragments/00-template.yaml index ed7c440c71..44f68b5ba6 100644 --- a/changelog/fragments/00-template.yaml +++ b/changelog/fragments/00-template.yaml @@ -1,3 +1,5 @@ +# entries is a list of entries to include in +# release notes and/or the migration guide entries: - description: > Description is the line that shows up in the CHANGELOG. This @@ -5,6 +7,30 @@ entries: the YAML string '>' operator means you can write your entry multiple lines and it will still be parsed as a single line. - kind: "addition" + # kind is one of: + # - addition + # - change + # - deprecation + # - removal + # - bugfix + kind: "" + # Is this a breaking change? breaking: false + + # NOTE: ONLY USE `pull_request_override` WHEN ADDING THIS + # FILE FOR A PREVIOUSLY MERGED PULL_REQUEST! + # + # The generator auto-detects the PR number from the commit + # message in which this file was originally added. + # + # What is the pull request number (without the "#")? + # pull_request_override: 0 + + + # Migration can be defined to automatically add a section to + # the migration guide. This is required for breaking changes. + migration: + header: Header text for the migration section + body: > + Body of the migration section. diff --git a/changelog/fragments/rescue-reconciliation.yaml b/changelog/fragments/rescue-reconciliation.yaml new file mode 100644 index 0000000000..e88ed05603 --- /dev/null +++ b/changelog/fragments/rescue-reconciliation.yaml @@ -0,0 +1,8 @@ +entries: + - description: > + Added checks for rescued tasks during reconciliation + to avoid adding rescued tasks to the list of failures. + + kind: "addition" + + breaking: false From 0d4620777b3470d384cd7e50958a7406f06a33c4 Mon Sep 17 00:00:00 2001 From: Venkat Ramaraju Date: Wed, 12 Aug 2020 11:35:03 -0700 Subject: [PATCH 4/7] Fragments --- changelog/fragments/rescue-reconciliation.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/changelog/fragments/rescue-reconciliation.yaml b/changelog/fragments/rescue-reconciliation.yaml index e88ed05603..179ea25607 100644 --- a/changelog/fragments/rescue-reconciliation.yaml +++ b/changelog/fragments/rescue-reconciliation.yaml @@ -1,8 +1,8 @@ entries: - description: > - Added checks for rescued tasks during reconciliation - to avoid adding rescued tasks to the list of failures. + Stop reconciling tasks when the event raised is a rescue in Ansible-based Operators. + More info: [Bugzilla 1856714](https://bugzilla.redhat.com/show_bug.cgi?id=1856714) - kind: "addition" + kind: "bugfix" breaking: false From 3fe021d6838e937429df77191aaf9672f1b115bf Mon Sep 17 00:00:00 2001 From: Venkat Ramaraju Date: Wed, 12 Aug 2020 15:00:09 -0700 Subject: [PATCH 5/7] Added links --- CHANGELOG.md | 2 +- cmd/operator-sdk/main.go | 2 +- internal/util/projutil/project_util.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c9ed1e9af..57937ed215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ ### Additions - Add "panic" level for --zap-stacktrace-level (allows "debug", "info", "error", "panic"). ([#3040](https://github.com/operator-framework/operator-sdk/pull/3040)) -- 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)) +- 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)) - `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)) - 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)) - 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)) diff --git a/cmd/operator-sdk/main.go b/cmd/operator-sdk/main.go index 76b4ee6a4e..089ef0536e 100644 --- a/cmd/operator-sdk/main.go +++ b/cmd/operator-sdk/main.go @@ -46,7 +46,7 @@ func main() { if operatorType == projutil.OperatorTypeGo { depMsg := "Operator SDK has a new CLI and project layout that is aligned with Kubebuilder.\n" + "See `operator-sdk init -h` and the following doc on how to scaffold a new project:\n" + - "https://sdk.operatorframework.io/docs/golang/quickstart/\n" + + "https://sdk.operatorframework.io/docs/building-operators/golang/quickstart/\n" + "To migrate existing projects to the new layout see:\n" + "https://sdk.operatorframework.io/docs/golang/migration/project_migration_guide/\n" projutil.PrintDeprecationWarning(depMsg) diff --git a/internal/util/projutil/project_util.go b/internal/util/projutil/project_util.go index 418320e3ae..c213852c39 100644 --- a/internal/util/projutil/project_util.go +++ b/internal/util/projutil/project_util.go @@ -315,7 +315,7 @@ func CheckGoModules() error { } if !goModOn { return fmt.Errorf(`using go modules requires GO111MODULE="on", "auto", or unset.` + - ` More info: https://sdk.operatorframework.io/docs/golang/quickstart/#a-note-on-dependency-management`) + ` More info: https://sdk.operatorframework.io/docs/building-operators/golang/quickstart/`) } return nil } From f15865d598ab9b2d651bc3e491e7309eb419d456 Mon Sep 17 00:00:00 2001 From: Venkat Ramaraju Date: Wed, 12 Aug 2020 15:29:18 -0700 Subject: [PATCH 6/7] Formatting --- CHANGELOG.md | 2 +- cmd/operator-sdk/main.go | 2 +- internal/util/projutil/project_util.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57937ed215..4c082be522 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ ### Additions - Add "panic" level for --zap-stacktrace-level (allows "debug", "info", "error", "panic"). ([#3040](https://github.com/operator-framework/operator-sdk/pull/3040)) -- 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)) +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)) - `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)) - 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)) - 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)) diff --git a/cmd/operator-sdk/main.go b/cmd/operator-sdk/main.go index 089ef0536e..7ddc379d1c 100644 --- a/cmd/operator-sdk/main.go +++ b/cmd/operator-sdk/main.go @@ -46,7 +46,7 @@ func main() { if operatorType == projutil.OperatorTypeGo { depMsg := "Operator SDK has a new CLI and project layout that is aligned with Kubebuilder.\n" + "See `operator-sdk init -h` and the following doc on how to scaffold a new project:\n" + - "https://sdk.operatorframework.io/docs/building-operators/golang/quickstart/\n" + + "https://v0-19-x.sdk.operatorframework.io/docs/golang/quickstart/\n" + "To migrate existing projects to the new layout see:\n" + "https://sdk.operatorframework.io/docs/golang/migration/project_migration_guide/\n" projutil.PrintDeprecationWarning(depMsg) diff --git a/internal/util/projutil/project_util.go b/internal/util/projutil/project_util.go index c213852c39..bbaebad8f8 100644 --- a/internal/util/projutil/project_util.go +++ b/internal/util/projutil/project_util.go @@ -315,7 +315,7 @@ func CheckGoModules() error { } if !goModOn { return fmt.Errorf(`using go modules requires GO111MODULE="on", "auto", or unset.` + - ` More info: https://sdk.operatorframework.io/docs/building-operators/golang/quickstart/`) + ` More info: https://v0-19-x.sdk.operatorframework.io/docs/golang/quickstart/#a-note-on-dependency-management`) } return nil } From 09fea899e55082ebef704d375169ded63fbaaf73 Mon Sep 17 00:00:00 2001 From: Venkat Ramaraju Date: Thu, 13 Aug 2020 07:54:29 -0700 Subject: [PATCH 7/7] Docker changes --- hack/tests/e2e-ansible-molecule.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/tests/e2e-ansible-molecule.sh b/hack/tests/e2e-ansible-molecule.sh index d91ebf6576..1064ba5cca 100755 --- a/hack/tests/e2e-ansible-molecule.sh +++ b/hack/tests/e2e-ansible-molecule.sh @@ -13,7 +13,7 @@ trap_add 'rm -rf $TMPDIR' EXIT pip3 install --user pyasn1==0.4.7 pyasn1-modules==0.2.6 idna==2.8 ipaddress==1.0.22 pip3 install --user molecule==3.0.2 pip3 install --user ansible-lint yamllint -pip3 install --user docker openshift jmespath +pip3 install --user docker==4.2.2 openshift jmespath ansible-galaxy collection install community.kubernetes deploy_prereqs() {