-
Notifications
You must be signed in to change notification settings - Fork 391
add support for Azure container linux #3577
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
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3d7596f
add support for Azure Container Linux
mayankfz 5eee74d
incorporate review comments
mayankfz 27b33b4
update restart_ssh_service for ACL
mayankfz fc501b4
incorporate review comments
mayankfz 08be6ef
review comments
mayankfz 88fa537
update distro name for ACL as azurecontainerlinux in waagent
mayankfz 2d5f456
Merge branch 'develop' into mayansingh/add_acl_support
mayankfz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # | ||
| # Copyright 2018 Microsoft Corporation | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # Requires Python 2.6+ and Openssl 1.0+ | ||
| # | ||
| # Azure Container Linux (ACL) is an immutable, sysext-based distro derived | ||
| # from Flatcar. This osutil is a standalone copy of MarinerOSUtil with | ||
| # ACL-specific overrides so that future Azure-Linux changes do not | ||
| # inadvertently affect the immutable ACL image. | ||
| # | ||
|
|
||
| from azurelinuxagent.common.osutil.default import DefaultOSUtil | ||
|
|
||
|
|
||
| class AclOSUtil(DefaultOSUtil): | ||
| def __init__(self): | ||
| super(AclOSUtil, self).__init__() | ||
| self.jit_enabled = True | ||
|
|
||
| @staticmethod | ||
| def get_systemd_unit_file_install_path(): | ||
| # ACL delivers waagent as a sysext; /usr is read-only. | ||
| # Writable systemd units must go to /etc/systemd/system. | ||
| return "/etc/systemd/system" | ||
|
|
||
| @staticmethod | ||
| def get_agent_bin_path(): | ||
| return "/usr/bin" | ||
|
|
||
| def is_dhcp_enabled(self): | ||
| return True | ||
|
|
||
| def start_network(self): | ||
| self._run_command_without_raising(["systemctl", "start", "systemd-networkd"], log_error=False) | ||
|
|
||
| def restart_if(self, ifname=None, retries=None, wait=None): | ||
| self._run_command_without_raising(["systemctl", "restart", "systemd-networkd"]) | ||
|
|
||
| def restart_ssh_service(self): | ||
| # ACL uses sshd.socket for socket-activated SSH (similar to | ||
| # Flatcar/CoreOS). Restarting sshd.service would conflict with | ||
| # the active sshd.socket. | ||
| pass | ||
|
|
||
| def stop_dhcp_service(self): | ||
| self._run_command_without_raising(["systemctl", "stop", "systemd-networkd"], log_error=False) | ||
|
|
||
| def start_dhcp_service(self): | ||
| self._run_command_without_raising(["systemctl", "start", "systemd-networkd"], log_error=False) | ||
|
|
||
| def start_agent_service(self): | ||
| self._run_command_without_raising(["systemctl", "start", "{0}".format(self.service_name)], log_error=False) | ||
|
|
||
| def stop_agent_service(self): | ||
| self._run_command_without_raising(["systemctl", "stop", "{0}".format(self.service_name)], log_error=False) | ||
|
|
||
| def register_agent_service(self): | ||
| self._run_command_without_raising(["systemctl", "enable", "{0}".format(self.service_name)], log_error=False) | ||
|
|
||
| def unregister_agent_service(self): | ||
| self._run_command_without_raising(["systemctl", "disable", "{0}".format(self.service_name)], log_error=False) | ||
|
|
||
| def get_dhcp_pid(self): | ||
| return self._get_dhcp_pid(["pidof", "systemd-networkd"]) | ||
|
|
||
| def conf_sshd(self, disable_password): | ||
| pass | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # | ||
|
mayankfz marked this conversation as resolved.
|
||
| # Microsoft Azure Linux Agent Configuration (ACL) | ||
| # | ||
|
|
||
| Extensions.Enabled=y | ||
|
|
||
| # Auto-detect the provisioning agent (coreos-cloudinit or waagent). | ||
| Provisioning.Agent=auto | ||
| Provisioning.DeleteRootPassword=n | ||
| Provisioning.RegenerateSshHostKeyPair=n | ||
| Provisioning.SshHostKeyPairType=auto | ||
| Provisioning.MonitorHostName=y | ||
| Provisioning.DecodeCustomData=y | ||
| Provisioning.ExecuteCustomData=n | ||
| Provisioning.AllowResetSysUser=n | ||
|
|
||
| ResourceDisk.Format=y | ||
|
narrieta marked this conversation as resolved.
|
||
| ResourceDisk.Filesystem=ext4 | ||
| ResourceDisk.MountPoint=/mnt/resource | ||
| ResourceDisk.EnableSwap=n | ||
| ResourceDisk.SwapSizeMB=0 | ||
| ResourceDisk.MountOptions=None | ||
|
|
||
| LBProbeResponder=y | ||
|
|
||
| Logs.Verbose=n | ||
| # Logs.Console=y | ||
|
|
||
| OS.EnableFIPS=n | ||
| OS.SshDir=/etc/ssh | ||
| OS.RootDeviceScsiTimeout=300 | ||
| OS.OpensslPath=None | ||
|
|
||
| #AutoUpdate.Enabled=n | ||
|
|
||
| # Add firewall rules to protect access to Azure host node services | ||
| OS.EnableFirewall=y | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Drop-in for multi-user.target on Azure Container Linux (ACL). | ||
| # | ||
| # WALinuxAgent is delivered as a systemd-sysext image. Sysext units are | ||
| # only visible after systemd-sysext.service merges the overlay, which | ||
| # happens *after* the default target is already queued. Without an | ||
| # explicit "Upholds=", systemd has no dependency edge to pull | ||
| # waagent.service into the boot transaction. | ||
| # | ||
| # "Upholds=" (systemd 249+) is a soft requirement: it starts the unit | ||
| # whenever multi-user.target is active but does not fail the target if | ||
| # waagent.service cannot start. | ||
| [Unit] | ||
|
narrieta marked this conversation as resolved.
|
||
| Upholds=waagent.service | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [Unit] | ||
| Description=Microsoft Azure Linux Agent (ACL) | ||
| Wants=network-online.target sshd.service sshd-keygen.service | ||
| After=network-online.target sshd-keygen.service systemd-sysext.service | ||
|
mayankfz marked this conversation as resolved.
|
||
|
|
||
| ConditionFileIsExecutable=/usr/bin/waagent | ||
| ConditionPathExists=/etc/waagent.conf | ||
|
|
||
| [Service] | ||
| Type=simple | ||
|
|
||
| ExecStart=/usr/bin/python -u /usr/bin/waagent -daemon | ||
|
|
||
|
nagworld9 marked this conversation as resolved.
|
||
| Restart=always | ||
| RestartSec=5s | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module header says ACL is "derived from Flatcar", but the PR description states ACL is derived from Azure Linux. This inconsistency makes it unclear what behavior/assumptions this OSUtil should follow (e.g., Flatcar/CoreOS vs Azure Linux/Mariner). Please align the comment (or the PR description) to the correct lineage to avoid future maintenance mistakes.