operator-framework / ansible-operator-plugins

Experimental extraction/refactoring of the Operator SDK's ansible operator plugin
Apache License 2.0
7 stars 17 forks source link

Question: How to omit job events for Ansible operator? #19

Open el-pako opened 1 year ago

el-pako commented 1 year ago

Type of question

General operator-related help

Question

I am trying to find any way for Ansible operator to stop generating job events (*.json) in artifacts directory for each run, but keep writing stdout, stderr, etc.

Ansible runner executable provides flag --omit-event-data, but it seems Ansible operator code passes a fixed list of flags when calling the runner: https://github.com/operator-framework/operator-sdk/blob/v1.28.x/internal/ansible/runner/runner.go#L98

The awx display plugin, reads environment variable RUNNER_OMIT_EVENTS, but setting this to true before calling ansible-operator did not have the desired effect.

Operator type:

/language ansible

Kubernetes cluster type:

Openshift

$ oc version
Client Version: 4.10.16
Server Version: 4.10.16
Kubernetes Version: v1.23.5+3afdacb

$ ansible-operator version
ansible-operator version: "v1.28.1", commit: "b05f6a56a176a98b7d92c4d4b36076967e0d77f7", kubernetes version: "v1.26.0", go version: "go1.18.10", GOOS: "linux", GOARCH: "amd64"

$ ansible-runner --version
2.1.0
everettraven commented 1 year ago

Does any of the information in https://sdk.operatorframework.io/docs/building-operators/ansible/reference/advanced_options/#using-ansible-log-events help?

If not, I think it seems reasonable that if the ansible-runner doesn't provide an environment variable for omitting the event data that we add a check for an env var that we would append the --omit-event-data flag to it.

el-pako commented 1 year ago

None of this influences the creation of job events. The only thing that helps is reducing the overall number of artifacts using maxRunnerArtifacts, but this would also affect the collection of other files like stdout, stderr, etc.

Having default maxRunnerArtifacts of 20, the job events alone add up to > 1GB in the filesystem of our Ansible operator based pods, which consumes memory. It would be really helpful to be able to set the env var as you suggested.

everettraven commented 1 year ago

Adding the kind/feature label and removing the milestone so that this show up in our next issue triage meeting.

The feature to be added is the ability to specify that the --omit-job-events flag should be appended to the set of flags passed to the ansible runner around https://github.com/operator-framework/operator-sdk/blob/v1.28.x/internal/ansible/runner/runner.go#L98

I'm also going to unassign myself from this issue as I likely won't have the bandwidth to implement this myself. I'm happy to be a point of contact for these changes and review any PRs

openshift-ci[bot] commented 9 months ago

@el-pako: The label(s) language/ansible cannot be applied, because the repository doesn't have them.

In response to [this](https://github.com/operator-framework/ansible-operator-plugins/issues/19): >## Type of question > >General operator-related help > >## Question > >I am trying to find _any_ way for Ansible operator to stop generating job events (*.json) in artifacts directory for each run, but keep writing stdout, stderr, etc. > >Ansible runner executable provides flag --omit-event-data, but it seems Ansible operator code passes a fixed list of flags when calling the runner: >https://github.com/operator-framework/operator-sdk/blob/v1.28.x/internal/ansible/runner/runner.go#L98 > >The awx display plugin, reads environment variable RUNNER_OMIT_EVENTS, but setting this to true before calling ansible-operator did not have the desired effect. > >**Operator type:** > >/language ansible > >**Kubernetes cluster type:** > >Openshift > >``` >$ oc version >Client Version: 4.10.16 >Server Version: 4.10.16 >Kubernetes Version: v1.23.5+3afdacb > >$ ansible-operator version >ansible-operator version: "v1.28.1", commit: "b05f6a56a176a98b7d92c4d4b36076967e0d77f7", kubernetes version: "v1.26.0", go version: "go1.18.10", GOOS: "linux", GOARCH: "amd64" > >$ ansible-runner --version >2.1.0 >``` > > Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
openshift-bot commented 9 months ago

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale