Skip to content

ansible/runner: Adding ability to rotate artifacts via runner #889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

shawn-hurley
Copy link
Member

Allow runner to manage the artifacts it creates. Setting to 20 at the moment, as a random guess on the first time. Could see the eventual need to make this configurable. Open to doing it in this PR if others feel it is necessary.

/cc @mhrivnak

@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jan 7, 2019
@shawn-hurley shawn-hurley added kind/feature Categorizes issue or PR as related to a new feature. language/ansible Issue is related to an Ansible operator project labels Jan 7, 2019
Copy link
Contributor

@dymurray dymurray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that we are adding this flag to runner but I think we should expose this as a configurable option.

@shawn-hurley shawn-hurley force-pushed the feature/rotate-artifacts-1 branch from 06be9d7 to 3ed0a85 Compare January 15, 2019 17:21
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 15, 2019
@shawn-hurley shawn-hurley force-pushed the feature/rotate-artifacts-1 branch 2 times, most recently from 284749e to ccc0515 Compare January 15, 2019 17:59
Copy link
Member

@fabianvf fabianvf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits, but overall docs are good 👍

The only other question I had was if we have guidance for when/whether to capitalize Ansible and Ansible Operator in our documentation.

@shawn-hurley shawn-hurley force-pushed the feature/rotate-artifacts-1 branch from ccc0515 to 8d43e6e Compare January 15, 2019 19:17
| Reconcile Period | `reconcilePeriod` | time between reconcile runs for a particular CR | ansbile.operator-sdk/reconcile-period | 1m |
| Manage Status | `manageStatus` | Allows the ansible operator to manage the conditions section of the resources status section. | | true |
| Watching Dependent Resources | `watchDependentResources` | Allows the ansible operator to dynamically watch resources that are created by ansible | | true |
| Max Runner Artifacts | `maxRunnerArtifacts` | Manages the number of [artifact directories](https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-artifacts-directory-hierarchy) that ansible runner will keep in the operator container. | ansible.operator-sdk/max-runner-artifacts | 20 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add the words "for each individual resource" or similar at the end of the sentence.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't come up with a use case for needing to set this on an individual CR with an annotation. Maybe you have one in mind? Even if you're just debugging, it seems sufficient to adjust on a broader level. It may even be undesirable from a safety/security standpoint, because allowing an individual to affect this would enable an ill-meaning user to fill up the operator's filesystem with asset directories about their own CR.

What would you think about just making this a command-line flag that gets set at runtime and applies to all GVKs in the watches file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the debugging use case is important. We still really don't know what a user can change for a running operator via OLM. I think that a command line will be inaccessible. As well as the watches file.

The malicious user is interesting to me, but at the end of the day all they could do is say keep 10000000 artifacts but that means that the operator will have to run that many times. I think that this might be something worth keeping a metric for, that way cluster admins can monitor.

The same could be said for the reconcile period If I set it to .5s and that could monopolize the worker. I think let's deal with these situations a little later but we do need this for admins to debug IMO. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume if you're adjusting this value for troubleshooting, the next thing you need to do is exec into the pod to look at the artifact directories. Otherwise I'm not sure how this would be useful. And I assume if you can do that, you have the ability to adjust the command line args for the operator.

Do you see a different scenario?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, if you use OLM it will force the deployment to look a certain way from my understanding, therefore you would have to change and set up a new CSV.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just adding my 2 cents here...

I can see a use-case for wanting to set this value on an individual CR if my operator is watching 2 applications, one that has a long start-up window (24 hours) and one that has a short start-up window (5 minutes). I prefer to maintain all artifacts files when creating an operator for a long start-up application since it is useful to find the last running state of the app if I have walked away for a few hours and it failed 5 hours ago.

I also see how this may be undesired from a security aspect because it's essentially altering the resource requirements of the application. Since changing this would require a brand new CSV from OLM I am leaning towards the annotation approach as I have used it for reconcilePeriod in the past when debugging.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we need to find out then what the OLM user story is for affecting runtime settings of an operator. We have the same issue I assume with setting how many workers the operator should use. Other operators must have similar needs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but let's not block this while that story is figured out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see a use-case for wanting to set this value on an individual CR if my operator is watching 2 applications, one that has a long start-up window (24 hours) and one that has a short start-up window (5 minutes). I prefer to maintain all artifacts files when creating an operator for a long start-up application since it is useful to find the last running state of the app if I have walked away for a few hours and it failed 5 hours ago.

That's a good use case. The user wants to keep all the artifacts until the thing is up and running, then start pruning them. The user still presumably has elevated permission if they're intending to look at those artifacts.

Sold. :)

Copy link
Contributor

@djzager djzager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will help a lot. Maybe a link in the user-guide to the advanced options?


This document shows the advanced options available to a developer of an ansible operator.

### Watches File Options
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to see information about setting a finalizer for a particular GVK. Specifically I would like to see:

  1. An example, maybe something like:
- version: v1alpha1
  group: osb.openshift.io
  kind: AnsibleServiceBroker
  playbook: /opt/ansible/playbook.yml
  finalizer:
    name: finalizer.osb.openshift.io
    vars:
      state: absent
  1. The extra-vars passed when the playbook is called via finalizer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you ok with a follow on for that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup

@shawn-hurley shawn-hurley merged commit 57453bc into operator-framework:master Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. language/ansible Issue is related to an Ansible operator project size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants