Giter VIP home page Giter VIP logo

metadata-agent's Introduction

illumos Metadata Agent

This agent runs early in boot to configure an illumos virtual machine using the metadata provided by the hypervisor or cloud environment. The agent supports the configuration of:

  • networking (IP addresses, DNS servers, and the default gateway)
  • credentials (SSH keys)
  • hostname
  • swap space
  • expansion of the ZFS pool to fill the provisioned root device
  • regeneration of ZFS pool unique ID (zpool reguid) in the image
  • optional execution of a user-provided script

At present, the following hypervisors or cloud environments are supported on some level:

  • Joyent SmartOS (including Triton environments)
  • DigitalOcean
  • Amazon EC2
  • Generic QEMU/KVM; e.g., under libvirtd
  • VMware Fusion

The software is expected to work on at least the following illumos distributions:

Building and Usage

This software must be built with Rust and Cargo.

$ cargo build --release

The built artefact, target/release/metadata, is intended to be installed as /usr/lib/metadata. In addition, userscript.sh is intended to be installed as /usr/lib/userscript.sh and made executable.

Finally, SMF service manifests are provided for both the metadata service (metadata.xml) and the service which executes a user-provided script (userscript.xml), and are intended to be included in the image in /lib/svc/manifest/system.

It is desirable to include these services in the SMF seed repository for an image so that they are already imported when the image first boots in the guest. The services include dependent relationships with several early boot networking and identity services in an attempt to ensure the metadata agent runs before network services are completely online.

Metadata CPIO Device

Not all hypervisor environments provide a self-describing configuration metadata service. In order to ease the creation of automatically configured guests in such hypervisor environments, the metadata agent will fall back to searching for a block device that contains a CPIO archive containing configuration files. Note that no file system is expected on the device, just the output of cpio -o starting at LBA 0 of the emulated disk.

The following configuration files may appear in the CPIO archive:

  • nodename (optional)

    A plain text file with the hostname to use for the guest on the first line of the file. This name will be used to populate nodename(5) and hosts(5), and the live hostname as reported by hostname(1).

  • authorized_keys (optional)

    This file will be installed as /root/.ssh/authorized_keys and should contain a list of SSH keys in the usual format expected by sshd.

  • config.toml (optional)

    This TOML-formatted file can contain overrides and other configuration. At present, only one key is supported:

    • network.skip (boolean, optional, defaults to false)

    For example, the following configuration file will cause the metadata agent to skip any attempt to use DHCP to configure a network interface:

    [network]
    skip = true
  • firstboot.sh (optional)

    This file may contain a shell script that will be started on first boot.

    Once the script has completed, the system will try not to start the script again on subsequent boots. If the system crashes part way through running the script, or there is some other unexpected failure, it may not be possible to record that the script completed and it may be started again immediately or on subsequent boots. As such, the provided script should be idempotent.

    The provided script must begin with a valid interpreter line; e.g.,

    #!/bin/bash
    
    echo ok

metadata-agent's People

Contributors

jclulow avatar rzezeski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

metadata-agent's Issues

First boot fails on Digital Ocean

When booting an image I created in Bhyve on Digital Ocean, the metadata service fails the first time with this error;

[ Apr 4 08:28:05 Enabled. ]
[ Apr 4 08:28:08 Executing start method ("/usr/lib/metadata | tee /dev/msglog"). ]
Apr 04 08:28:08.852 INFO SMF instance: svc:/system/illumos/metadata:default
Apr 04 08:28:09.130 INFO rpool disk: c1t0d0
Apr 04 08:28:09.351 ERRO fatal error: prtvtoc c1t0d0 failure: exit code 1: prtvtoc: /dev/dsk/c1t0d0: failed to open device: No such file or directory

Something is confused; the underlying device on Bhyve was c1t0d0, which is presumably where it's got that idea from. Once on DO, that gets changed to c3t0d0.

If I manually log in to the instance once it's booted (via console or secondary account) and restart the service, it then runs to completion (and does all the actions you would expect - ssh key, resize zfs, and sets the hostname).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.