Cluster Controller Rendering of Preseeds

Registered by Julian Edwards on 2012-11-22

While preseeds are currently rendered on the region controller, it is desirable to do this on cluster controllers instead because cluster controllers are in possession of data like networking information that is not always on the region. This will result in a much better separation of responsibilities - the region provides raw data and the cluster renders it in the most appropriate way.

Here is some information captured from bug 1081701

.. -*- mode: rst -*-

Things needed from the region to render a preseed:
==================================================

- From ``maasserver.compose_preseed``:

  - Metadata URL: ``absolute_reverse('metadata')``
  - Token: ``NodeKey.objects.get_token_for_node(node)``
  - Node status: ``node.status`` (only if commissioning or not)

- From ``maasserver.preseed``:

  - Node status: ``node.status`` (only if commissioning or not)

  - Enum ``PRESEED_TYPE``.

    ⇒ Move to ``provisioningserver``?

  - Setting ``PRESEED_TEMPLATE_LOCATIONS``.

    ⇒ Move to ``provisioningserver``.

  - Config:

     - ``commissioning_distro_series``
     - ``main_archive``
     - ``ports_archive``
     - ``http_proxy``

    ⇒ Can be obtained via API.

  - Server host: ``get_maas_facing_server_host`` (used for?)

    ⇒ Already known on cluster?

  - Server URL: ``absolute_reverse('nodes_handler')`` (used for?)

    ⇒ Already known on cluster?

  - Enlistment URL: ``absolute_reverse('enlist')``

  - Disable netboot URL::

      absolute_reverse(
          'metadata-node-by-id',
          args=['latest', node.system_id])

  - Enlistment preseed URL::

      absolute_reverse(
          'metadata-enlist-preseed', args=[version],
          query={'op': 'get_enlist_preseed'})

    ⇒ Becomes responsibility of ``provisioningserver``.

  - Regular preseed URL::

      absolute_reverse(
          'metadata-node-by-id', args=[version, node.system_id],
          query={'op': 'get_preseed'})

    ⇒ Becomes responsibility of ``provisioningserver``.

- From ``contrib/preseeds_v2/generic``:

  - Node architecture: ``node.architecture``

Which boils down to:
--------------------

Code moves (see below_) and a view that returns:

- Metadata URL: ``absolute_reverse('metadata')``

- Token: ``NodeKey.objects.get_token_for_node(node)``

- Node status: ``node.status`` (only if commissioning or not)

- Node architecture: ``node.architecture``

- Enlistment URL: ``absolute_reverse('enlist')``

- Disable netboot URL::

    absolute_reverse(
        'metadata-node-by-id', args=['latest', node.system_id])

- *Optional:* return config items (e.g. ``ports_archive``)

.. _below: `Adding rendering server to the provisioning server:`_

Adding rendering server to the provisioning server:
===================================================

- Resurrect HTTP server in ``provisioningserver.plugin``.

- Move code, as detailed earlier_, to ``provisioningserver``, and
  perform some moderate refactoring.

- Add handler to the ``provisioningserver`` HTTP server to query the
  view_ detailed above, perhaps query the API for config, and call the
  render code.

.. _earlier: `Things needed from the region to render a preseed:`_
.. _view: `Which boils down to:`_

Notes:
======

- The ``pxeconfig`` view calculates the preseed URLs. This calculation
  no longer needs to happen, and its responsibility passes to the
  provisioning server.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Low
Drafter:
Julian Edwards
Direction:
Needs approval
Assignee:
None
Definition:
Review
Series goal:
None
Implementation:
Not started
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.