Skip to content
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

Agentless #1289

Merged
merged 7 commits into from
Aug 8, 2018
Merged

Agentless #1289

merged 7 commits into from
Aug 8, 2018

Conversation

hglkrijger
Copy link
Member

@hglkrijger hglkrijger commented Aug 7, 2018

Description

Addresses #838

This introduces two new modes of operation for the agent:

  • extensions disabled
  • agent disabled

Extensions disabled

This allows an end user to reduce the agent overhead when extensions are not required. This serves customers who have provisioned VMs already and cannot re-provision without the agent. To enable this mode, a new config option Extensions.Enabled=y|n is provided, which the user may set.

When y (default), the agent runs without any changes.

When n, the goal state interval is reduced to 5 minutes, and extension configuration is not processed. This should help customers who do not want to run the agent, but still need the VM to report status, handle JIT requests, and so on.

Agent disabled

As of Azure.Compute 2018-06-01, a new option is provided in the ARM API to disable the Linux guest agent completely. Documentation on that is forthcoming. This API will end up setting the ProvisionGuestAgent flag in ovf-env.xml, which the agent will honor with this change.

If that flag is set to false, the agent will write /var/lib/waagent/disable_agent, and if that file exists, sleep forever. No status reports or goal state handling of any kind are processed.

Once cloud-init supports this flag, the agent service will be disabled and/or removed on provision.


PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made and Travis.CI is passing.

Quality of Code and Contribution Guidelines

@hglkrijger hglkrijger added this to the vNext milestone Aug 7, 2018
@hglkrijger
Copy link
Member Author

hglkrijger commented Aug 7, 2018

/cc @danielsollondon @paulmey

agent_disabled_file_path = conf.get_disable_agent_file_path()
if os.path.exists(agent_disabled_file_path):
import threading
logger.warn("Disabling the guest agent by sleeping forever; "
Copy link
Member

Choose a reason for hiding this comment

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

There's no API to disable the agent, there's just a file on disk?

I assumed we would just stop the service, and no code would be running.

Copy link
Member Author

Choose a reason for hiding this comment

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

The API is in CRP, exposed through ARM/SDK/CLI. Cloud-init will honor this flag by stopping/disabling the service, but for distros without cloud-init support, I believe this is the best we can do.

@patch('azurelinuxagent.pa.provision.get_provision_handler', return_value=ProvisionHandler())
def test_daemon_agent_disabled(self, _, __, patch_run_latest):
"""
Agent should provision, then sleep forever when disable_agent is found
Copy link
Member

Choose a reason for hiding this comment

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

Why do we start the agent at all?

Copy link
Member Author

Choose a reason for hiding this comment

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

We do not start it, the system does. If we just exit the service will be restarted. I definitely do not want to get into the business of trying to update the service from a running agent.

self.assertEqual(3, patch_write_agent_disabled.call_count)

ph.handle_provision_guest_agent(provision_guest_agent='TRUE')
self.assertEqual(3, patch_write_agent_disabled.call_count)
Copy link
Member

Choose a reason for hiding this comment

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

Thorough! 💯

@@ -213,6 +214,18 @@ may be used for some string type configuration entries as detailed below.

### Configuration File Options

#### __Extensions.Enabled__

_Type: Boolean_
Copy link
Member

Choose a reason for hiding this comment

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

Please add this to the various waagent.conf versions in the tree. I think people are more likely to read that file than they are the web site.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, updated

Copy link
Member

@boumenot boumenot left a comment

Choose a reason for hiding this comment

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

LGTM.

@hglkrijger hglkrijger merged commit f6f8038 into Azure:master Aug 8, 2018
@hglkrijger hglkrijger deleted the gh838 branch August 8, 2018 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants