Chapter 12. Adding metadata to instances
The content for this feature is available in this release as a Documentation Preview, and therefore is not fully verified by Red Hat. Use it only for testing, and do not use in a production environment.
The Compute (nova) service uses metadata to pass configuration information to instances on launch. The instance can access the metadata by using a config drive or the metadata service.
- Config drive
- By default, every instance has a config drive. Config drives are special drives that you can attach to an instance when it boots. The config drive is presented to the instance as a read-only drive. The instance can mount this drive and read files from it to get information that is normally available through the metadata service. To disable the config drive, see Disabling config drive.
- Metadata service
-
The Compute service provides the metadata service as a REST API, which can be used to retrieve data specific to an instance. Instances access this service at
169.254.169.254
or atfe80::a9fe:a9fe
.
12.1. Types of instance metadata Copy linkLink copied to clipboard!
Cloud users, cloud administrators, and the Compute service can pass metadata to instances:
- Cloud user provided data
- Cloud users can specify additional data to use when they launch an instance, such as a shell script that the instance runs on boot. The cloud user can pass data to instances by using the user data feature, and by passing key-value pairs as required properties when creating or updating an instance.
- Cloud administrator provided data
The Red Hat OpenStack Services on OpenShift (RHOSO) administrator uses the vendordata feature to pass data to instances. The Compute service provides the vendordata modules
StaticJSON
andDynamicJSON
to allow administrators to pass metadata to instances:-
StaticJSON
: (Default) Use for metadata that is the same for all instances. -
DynamicJSON
: Use for metadata that is different for each instance. This module makes a request to an external REST service to determine what metadata to add to an instance.
Vendordata configuration is located in one of the following read-only files on the instance:
-
/openstack/{version}/vendor_data.json
-
/openstack/{version}/vendor_data2.json
-
- Compute service provided data
- The Compute service uses its internal implementation of the metadata service to pass information to the instance, such as the requested hostname for the instance, and the availability zone the instance is in. This happens by default and requires no configuration by the cloud user or administrator.
12.2. Disabling config drive Copy linkLink copied to clipboard!
To disable the attachment of a config drive when launching an instance, you must set the force_config_drive
parameter to false
.
You can configure only whole node sets. Reconfiguring a subset of the nodes within a node set is not supported. If you need to reconfigure a subset of nodes within a node set, you must scale the node set down, and create a new node set from the previously removed nodes.
Prerequisites
-
The
oc
command line tool is installed on your workstation. -
You are logged in to Red Hat OpenStack Services on OpenShift (RHOSO) as a user with
cluster-admin
privileges. -
You have selected the
OpenStackDataPlaneNodeSet
custom resource (CR) that defines the nodes for which you want to disable config drive. For more information about creating anOpenStackDataPlaneNodeSet
CR, see Creating an OpenStackDataPlaneNodeSet CR with pre-provisioned nodes in Deploying Red Hat OpenStack Services on OpenShift.
Procedure
Create or update the
ConfigMap
CR namednova-extra-config.yaml
and set the value offorce_config_drive
under[DEFAULT]
tofalse
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information about creating
ConfigMap
objects, see Creating and using config maps in Nodes.Create a new
OpenStackDataPlaneDeployment
CR to configure the services on the data plane nodes and deploy the data plane, and save it to a file namedcompute_config_drive_deploy.yaml
on your workstation:apiVersion: core.openstack.org/v1beta1 kind: OpenStackDataPlaneDeployment metadata: name: compute-config-drive
apiVersion: core.openstack.org/v1beta1 kind: OpenStackDataPlaneDeployment metadata: name: compute-config-drive
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the
compute_config_drive_deploy.yaml
CR, specifynodeSets
to include all theOpenStackDataPlaneNodeSet
CRs you want to deploy. Ensure that you include theOpenStackDataPlaneNodeSet
CR that you selected as a prerequisite. ThatOpenStackDataPlaneNodeSet
CR defines which nodes you are disabling config drive on.WarningIf your deployment has more than one node set, changes to the
nova-extra-config.yaml
ConfigMap
might directly affect more than one node set, depending on how the node sets and theDataPlaneServices
are configured. To check if a node set uses thenova-extra-config
ConfigMap
and therefore will be affected by the reconfiguration, complete the following steps:-
Check the services list of the node set and find the name of the
DataPlaneService
that points to nova. Ensure that the value of the
edpmServiceType
field of theDataPlaneService
is set tonova
.If the
dataSources
list of theDataPlaneService
contains aconfigMapRef
namednova-extra-config
, then this node set uses thenova-extra-config.yaml
ConfigMap
and therefore will be affected by the configuration changes in thisConfigMap
. If some of the node sets that are affected should not be reconfigured, you must create a newDataPlaneService
pointing to a separateConfigMap
for these node sets.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<nodeSet_name>
with the names of theOpenStackDataPlaneNodeSet
CRs that you want to include in your data plane deployment.
-
Check the services list of the node set and find the name of the
-
Save the
compute_config_drive_deploy.yaml
deployment file. Deploy the data plane:
oc create -f compute_config_drive_deploy.yaml
$ oc create -f compute_config_drive_deploy.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the data plane is deployed:
oc get openstackdataplanenodeset
$ oc get openstackdataplanenodeset NAME STATUS MESSAGE compute-config-drive True Deployed
Copy to Clipboard Copied! Toggle word wrap Toggle overflow TipAppend the
-w
option to the end of the get command to track deployment progress.Access the remote shell for
openstackclient
and verify that the deployed Compute nodes are visible on the control plane:oc rsh -n openstack openstackclient openstack hypervisor list
$ oc rsh -n openstack openstackclient $ openstack hypervisor list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow