Creating a Configuration Item
Configuration items are user-defined resources that store application configurations. They can be used as files or environment variables in applications.
Scenarios
Configuration items allow you to decouple configuration files from images to enhance the portability of applications.
Benefits of configuration items:
- Manage configurations of different environments and services.
- Deploy applications in different environments. You can maintain configuration files in multiple versions, which makes it easy to update and roll back applications.
- Quickly import your configurations files to applications.
Prerequisites
You have created cluster and node resources. For more information, see Infrastructure Management. If cluster and node resources are already available, skip this operation.
Creating a Configuration Item
- Log in to ServiceStage and choose Application Management > Application Configuration > Configuration Item.
- Click Create.
- Create a configuration item by Visualization or YAML.
- Manner 1. Visualization. On the displayed page, set the parameters listed in the following table. Parameters marked with an asterisk (*) are mandatory.
Table 1 Parameters for creating a configuration item Parameter
Description
Basic Information
*Configuration Name
Name of a configuration item, which must be unique in the same namespace.
*Cluster
Cluster where the configuration item will be used.
*Namespace
Namespace to which the configuration item belongs. If you do not specify this parameter, the value default is used by default.
Description
Description of the configuration item.
Configuration Data
Used in applications or used to store configuration data. Key is a file name, and Value is the content of the file.
- Click Add Data.
- Set keys and values.
Configuration Labels
Labels are attached to objects, such as applications, nodes, and services, in the form of key-value pairs.
Labels define the identifiable attributes of these objects and are used to manage and select the objects.
- Click Add Label.
- Set keys and values.
- Method 2. YAML.
To create a configuration item by uploading a file, ensure that a resource description file has been created. ServiceStage supports resource description files in JSON or YAML format. For more information, see Configuration Item Requirements.
- Select a cluster from the Cluster drop-down list.
- (Optional) Click Upload File, select the created configMap file, and then click Open.
Upload a file whose size is smaller than 2 MB. The file can be uploaded in the YAML format.
- Write or modify the configMap file in Orchestration content.
- Manner 1. Visualization. On the displayed page, set the parameters listed in the following table. Parameters marked with an asterisk (*) are mandatory.
- After the configuration is complete, click Create.
The new configuration item is displayed in the configuration item list.
Configuration Item Requirements
A ConfigMap resource file can be in JSON or YAML format, and the file size cannot exceed 2 MB.
- JSON format
The following shows a configuration example of a configMap resource file named configmap.json:
{ "kind": "ConfigMap", "apiVersion": "v1", "metadata": { "name": "paas-broker-app-017", "namespace": "default", "enable": true }, "data": { "context": "{\"applicationComponent\":{\"properties\":{\"custom_spec\":{}},\"node_name\":\"paas-broker-app\",\"stack_id\":\"0177eae1-89d3-cb8a-1f94-c0feb7e91d7b\"},\"softwareComponents\":[{\"properties\":{\"custom_spec\":{}},\"node_name\":\"paas-broker\",\"stack_id\":\"0177eae1-89d3-cb8a-1f94-c0feb7e91d7b\"}]}" } } - YAML format
Modifying or Deleting a Configuration Item
| Operation | Description |
|---|---|
| Modifying a Configuration Item |
|
| Deleting a Configuration Item | Click Delete in the Operations column of the configuration item to be deleted, and follow the system prompts to delete this configuration item. |
| Deleting configuration items in batches |
|
Last Article: Creating a Secret
Next Article: Application O&M
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.