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

Agent update refactor supports GA versioning #2810

Merged
merged 15 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion azurelinuxagent/common/agent_supported_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#
# Requires Python 2.6+ and Openssl 1.0+
#
from azurelinuxagent.common import conf


class SupportedFeatureNames(object):
Expand All @@ -23,6 +24,7 @@ class SupportedFeatureNames(object):
MultiConfig = "MultipleExtensionsPerHandler"
ExtensionTelemetryPipeline = "ExtensionTelemetryPipeline"
FastTrack = "FastTrack"
GAVersioningGovernance = "VersioningGovernance" # Guest Agent Versioning


class AgentSupportedFeature(object):
Expand Down Expand Up @@ -72,9 +74,28 @@ def __init__(self):
supported=self.__SUPPORTED)


class _GAVersioningGovernanceFeature(AgentSupportedFeature):
"""
CRP would drive the RSM upgrade version if agent reports that it does support RSM upgrades with this flag otherwise CRP fallback to largest version.
Agent doesn't report supported feature flag if auto update is disabled or old version of agent running that doesn't understand GA versioning.

Note: Especially Windows need this flag to report to CRP that GA doesn't support the updates. So linux adopted same flag to have a common solution.
"""

__NAME = SupportedFeatureNames.GAVersioningGovernance
__VERSION = "1.0"
__SUPPORTED = conf.get_autoupdate_enabled()

def __init__(self):
super(_GAVersioningGovernanceFeature, self).__init__(name=self.__NAME,
version=self.__VERSION,
supported=self.__SUPPORTED)


# This is the list of features that Agent supports and we advertise to CRP
__CRP_ADVERTISED_FEATURES = {
SupportedFeatureNames.MultiConfig: _MultiConfigFeature()
SupportedFeatureNames.MultiConfig: _MultiConfigFeature(),
SupportedFeatureNames.GAVersioningGovernance: _GAVersioningGovernanceFeature()
}


Expand Down
12 changes: 10 additions & 2 deletions azurelinuxagent/common/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def load_conf_from_file(conf_file_path, conf=__conf__):
"ResourceDisk.EnableSwapEncryption": False,
"AutoUpdate.Enabled": True,
"EnableOverProvisioning": True,
"GAUpdates.Enabled": True,
#
# "Debug" options are experimental and may be removed in later
# versions of the Agent.
Expand Down Expand Up @@ -502,6 +503,14 @@ def get_monitor_network_configuration_changes(conf=__conf__):
return conf.get_switch("Monitor.NetworkConfigurationChanges", False)


def get_ga_updates_enabled(conf=__conf__):
"""
If True, the agent go through update logic to look for new agents otherwise it will stop agent updates.
NOTE: This option is needed in e2e tests to control agent updates.
Copy link
Member

Choose a reason for hiding this comment

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

If only needed by the tests, this should be a Debug/experimental option

Copy link
Contributor

Choose a reason for hiding this comment

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

How is this different than auto update?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can't use the auto update flag because of legacy behavior associated with it where agent fallback to daemon version which we don't want as our e2e tests need to run on test version

Copy link
Member

Choose a reason for hiding this comment

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

@nagworld9 - did we decide this to expose this option to the user? if yes, let's add it to README, if not, let's make it Debug

Copy link
Member

Choose a reason for hiding this comment

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

sorry, what is the difference between GAUpdates.Enabled and Debug.EnableGAVersioning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is not exposed to the user. I'll change to debug.

Debug.EnableGAVersioning- This flag is like kill switch. Once this is trun off our code will go to self update path.

GAUpdates.Enabled- This flag is to stop the agent updates. Only used in e2e tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change as part of next work item.

"""
return conf.get_switch("GAUpdates.Enabled", True)


def get_cgroup_check_period(conf=__conf__):
"""
How often to perform checks on cgroups (are the processes in the cgroups as expected,
Expand Down Expand Up @@ -629,10 +638,9 @@ def get_normal_upgrade_frequency(conf=__conf__):
def get_enable_ga_versioning(conf=__conf__):
"""
If True, the agent uses GA Versioning for auto-updating the agent vs automatically auto-updating to the highest version.

NOTE: This option is experimental and may be removed in later versions of the Agent.
"""
return conf.get_switch("Debug.EnableGAVersioning", False)
return conf.get_switch("Debug.EnableGAVersioning", True)


def get_firewall_rules_log_period(conf=__conf__):
Expand Down
2 changes: 1 addition & 1 deletion azurelinuxagent/common/protocol/goal_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def fetch_extension_manifest(self, extension_name, uris):
def _fetch_manifest(self, manifest_type, name, uris):
try:
is_fast_track = self.extensions_goal_state.source == GoalStateSource.FastTrack
xml_text = self._wire_client.fetch_manifest(uris, use_verify_header=is_fast_track)
xml_text = self._wire_client.fetch_manifest(manifest_type, uris, use_verify_header=is_fast_track)
self._history.save_manifest(name, xml_text)
return ExtensionManifest(xml_text)
except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions azurelinuxagent/common/protocol/wire.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ def call_storage_service(http_req, *args, **kwargs):
def fetch_artifacts_profile_blob(self, uri):
return self._fetch_content("artifacts profile blob", [uri], use_verify_header=False)[1] # _fetch_content returns a (uri, content) tuple

def fetch_manifest(self, uris, use_verify_header):
uri, content = self._fetch_content("manifest", uris, use_verify_header=use_verify_header)
def fetch_manifest(self, manifest_type, uris, use_verify_header):
uri, content = self._fetch_content("{0} manifest".format(manifest_type), uris, use_verify_header=use_verify_header)
self.get_host_plugin().update_manifest_uri(uri)
return content

Expand Down
Loading