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

Temp: Network Deamon #1

Open
wants to merge 13 commits into
base: development
Choose a base branch
from
Open
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
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ Compute Engine [images](https://cloud.google.com/compute/docs/images).
* [Daemons](#daemons)
* [Accounts](#accounts)
* [Clock Skew](#clock-skew)
* [IP Forwarding](#ip-forwarding)
* [Network](#network)
* [Instance Setup](#instance-setup)
* [Metadata Scripts](#metadata-scripts)
* [Network Setup](#network-setup)
* [Configuration](#configuration)
* [Packaging](#packaging)
* [Version Updates](#version-updates)
Expand Down Expand Up @@ -52,11 +51,11 @@ The guest environment is made up of the following components:
* **Disk expand** scripts to expand the VM root partition for CentOS 6,
CentOS 7, RHEL 6, and RHEL 7 images.
* **Instance setup** scripts to execute VM configuration scripts during boot.
* **IP forwarding** daemon that integrates network load balancing with
* **Network** daemon that handles network setup for multiple network interfaces
on boot, DHCP lease renewal, and integrates network load balancing with
forwarding rule changes into the guest.
* **Metadata scripts** to run user-provided scripts at VM startup and
shutdown.
* **Network setup** service to enable multiple network interfaces on boot.

The Linux guest environment is written in Python and is version agnostic
between Python 2.6 and 3.5. There is complete unittest coverage for every Python
Expand Down Expand Up @@ -173,15 +172,19 @@ The clock skew daemon is responsible for syncing the software clock with the
hypervisor clock after a stop/start event or after a migration. Preventing clock
skew may result in `system time has changed` messages in VM logs.

#### IP Forwarding
#### Network

The IP forwarding daemon uses IP forwarding metadata to setup or remove IP
routes in the guest.
The network daemon uses network interface metadata to manage the network
interfaces in the guest by performing the following tasks:

* Only IPv4 IP addresses are currently supported.
* Routes are set on the default Ethernet interface determined dynamically.
* Google routes are configured, by default, with the routing protocol ID `66`.
This ID is a namespace for daemon configured IP addresses.
* Enabled all associated network interfaces on boot. Network interfaces are
specified by MAC address in instance metadata.
* Uses IP forwarding metadata to setup or remove IP routes in the guest.
* Only IPv4 IP addresses are currently supported.
* Routes are set on the default Ethernet interface determined dynamically.
* Google routes are configured, by default, with the routing protocol ID
`66`. This ID is a namespace for daemon configured IP addresses.
* Uses DHCP refresh metadata to trigger DHCP lease renewal.

## Instance Setup

Expand Down Expand Up @@ -215,12 +218,6 @@ design details.
`startup-script-url`) a URL is executed first.
* The exit status of a metadata script is logged after completed execution.

## Network Setup

A network setup service runs on boot and enables all associated network
interfaces. Network interfaces are specified by MAC address in instance
metadata.

## Configuration

Users of Google provided images may configure the guest environment behaviors
Expand All @@ -246,7 +243,8 @@ Accounts | usermod\_cmd | Command string to modify a user's g
Accounts | groupadd\_cmd | Command string to create a new group.
Daemons | accounts\_daemon | `false` disables the accounts daemon.
Daemons | clock\_skew\_daemon | `false` disables the clock skew daemon.
Daemons | ip\_forwarding\_daemon | `false` disables the IP forwarding daemon.
Daemons | ip\_forwarding\_daemon | `false` (deprecated) skips IP forwarding.
Daemons | network\_daemon | `false` disables the Network daemon.
InstanceSetup | host\_key\_types | Comma separated list of host key types to generate.
InstanceSetup | optimize\_local\_ssd | `false` prevents optimizing for local SSD.
InstanceSetup | network\_enabled | `false` skips instance setup functions that require metadata.
Expand All @@ -259,9 +257,11 @@ IpForwarding | target\_instance\_ips | `false` disables internal IP addres
MetadataScripts | run\_dir | String base directory where metadata scripts are executed.
MetadataScripts | startup | `false` disables startup script execution.
MetadataScripts | shutdown | `false` disables shutdown script execution.
NetworkInterfaces | setup | `false` skips network interface setup.
NetworkInterfaces | ip\_forwarding | `false` skips IP forwarding.
NetworkInterfaces | dhcp\_refresh | `false` skips DHCP lease renewal.
NetworkInterfaces | dhclient\_script | String path to a dhclient script used by dhclient.
NetworkInterfaces | dhcp\_command | String to execute to enable network interfaces.
NetworkInterfaces | setup | `false` disables network interface setup.

Setting `network_enabled` to `false` will skip setting up host keys and the
`boto` config in the guest. The setting may also prevent startup and shutdown
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
google-compute-image-packages (2.7.8-1) stable; urgency=low

* Network Daemon installation testing

-- Google Cloud Team <[email protected]> Thu, 22 Mar 2018 12:00:00 -0700

google-compute-image-packages (2.7.7-1) stable; urgency=low

* Add support for NSS cache in OS Login.
Expand Down
3 changes: 2 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Build-Depends: debhelper (>= 9),
python3-pytest,
python-mock,
python-boto,
python3-boto
python3-boto,
python3-distro
Standards-Version: 3.9.8
Homepage: https://github.com/GoogleCloudPlatform/compute-image-packages

Expand Down
3 changes: 1 addition & 2 deletions debian/google-compute-engine.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ if [ -d /run/systemd/system ]; then
fi
deb-systemd-invoke $_dh_action \
google-instance-setup.service \
google-network-setup.service \
google-accounts-daemon.service \
google-clock-skew-daemon.service \
google-ip-forwarding-daemon.service >/dev/null || true
google-network-daemon.service >/dev/null || true
fi
16 changes: 14 additions & 2 deletions debian/google-compute-engine.prerm
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,22 @@ set -e
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
deb-systemd-invoke stop \
google-instance-setup.service \
google-network-setup.service \
google-accounts-daemon.service \
google-clock-skew-daemon.service \
google-ip-forwarding-daemon.service \
google-network-daemon.service \
google-shutdown-scripts.service \
google-startup-scripts.service >/dev/null

# Remove old service.
if [ -f /lib/systemd/system/google-ip-forwarding-daemon.service ]; then
deb-systemd-invoke stop google-ip-forwarding-daemon.service
systemctl --no-reload disable google-ip-forwarding-daemon.service
rm /lib/systemd/system/google-ip-forwarding-daemon.service
fi

if [ -f /lib/systemd/system/google-network-setup.service ]; then
deb-systemd-invoke stop google-network-setup.service
systemctl --no-reload disable google-network-setup.service
rm /lib/systemd/system/google-network-setup.service
fi
fi
8 changes: 8 additions & 0 deletions google_compute_engine/distro/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ def EnableNetworkInterfaces(
dhclient_script: string, the path to a dhclient script used by dhclient.
"""
pass

def RefreshDhcpV6Lease(self, interface):
"""Refresh DHCP V6 lease for the given interface.

Args:
interface: string, the output device to refresh.
"""
pass
7 changes: 5 additions & 2 deletions google_compute_engine/instance_setup/instance_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class InstanceConfig(config_manager.ConfigManager):
'Daemons': {
'accounts_daemon': 'true',
'clock_skew_daemon': 'true',
'ip_forwarding_daemon': 'true',
'ip_forwarding_daemon': 'true', # Deprecated.
'network_daemon': 'true',
},
'Instance': {
'instance_id': '0',
Expand All @@ -91,8 +92,10 @@ class InstanceConfig(config_manager.ConfigManager):
},
'NetworkInterfaces': {
'setup': 'true',
'dhclient_script': '/sbin/google-dhclient-script',
'dhcp_refresh': 'true',
'ip_forwarding': 'true',
'dhcp_command': '',
'dhclient_script': '/sbin/google-dhclient-script',
},
}

Expand Down
Loading