Table of Contents | ||
---|---|---|
|
Requirements
There are three ways the configuration updates happen in K8S world.
...
Day 2 Configurations for applications are applied using K8S kinds (typically CRDs) implemented by application specific operators
...
Configuration Template Management API
For . For a given application, type of configuration is similar (but not the values), therefore configuration templates are created by applications. These templates are for each application and are expected to be created even before Day 2 configuration is applied.
Content of the API
- Meta data file (Configuration profile to map the actual micro-service with the config-map files in the tar )
- Tar file consisting of
- config-maps files (to satisfy method 2 as described above) with templating.
- additional helm charts (to satisfy method 1 - Configurations via operators who support incremental configuration)
- Set of additional helm charts (to satisfy method 3)
Example of Method 1 (Using K8S kinds (typically CRDs) implemented by application specific operators)
This example is based on kafka config https://github.com/onap/demo/tree/master/vnfs/DAaaS/kafka-config
Example Contents of Tar File
Once the templates are created, configuration can be applied by choosing the right template. Day 2 configuration is applied by users as and when new configuration is required. As a user, he/she should select the template and supply values to apply new configuration.
Configuration Template Management API
CRUD Operations
The following curl commands can be used to upload a Day 2 Configuration template.
Command to create (POST) Template:
...
Code Block | ||
---|---|---|
| ||
> cd demo/vnfs/DAaaS
> find kafka-config
kafka-config/manifest.yaml
kafka-config/Chart.yaml
kafka-config/templates
kafka-config/templates/topic.yaml
#Create a tar.gz for upload
> tar -cf kafka-config.tar kafka-config
> gzip kafka-config.tar
|
Manifest file
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
---
version: v1
type:
configresource:
- filepath: kafka-config/templates/topic.yaml
chartpath: kafka-config/templates/topic.yaml |
Example of Method 2 (Updating by overwriting config-map)
TO DO
Example of Method 3 (Using K8S kinds via operators, but expect all the configuration to be given every time)
TO DO
CRUD Operations
The following curl commands can be used to upload a Day 2 Configuration template. UUID can be provided or generated by POST command.
curl -i -d @create_config_template.json -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/template/ |
With the following JSON content (create_config_template.json )
Code Block | ||||
---|---|---|---|---|
| ||||
{ "application-name": "kafka", "record-name": "kafka-config-1",_token_1" "description": "testing Kafka Day 2 config configuration", "uuidrb-name": "7eb09e38-4363-9942-1234-3beb2e95fd85" } |
Command to create (POST) Template:
Code Block | ||
---|---|---|
| ||
curl -i -d @create_config_template.json -X POST http://localhost:8081/v1/config/templatekafka", "rb-version": "1.0", } |
Command to UPLOAD Template:
Code Block | ||
---|---|---|
| ||
curl -i --data-binary @kafka-config.tar.gz -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/template/7eb09e38-4363-9942-1234-3beb2e95fd85/content{name} |
Command to GET Templates:
Code Block | ||
---|---|---|
| ||
# Get all Templates curl -i http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/template # Get one Template curl -i http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/template/7eb09e38-4363-9942-1234-3beb2e95fd85{name} |
Command to DELETE Templates:
Code Block | ||
---|---|---|
| ||
curl -i -X DELETE http://localhost:8081/rb/definition/{name}/{version}/profile/{name}/config/template/7eb09e38-4363-9942-1234-3beb2e95fd85{name} |
Example
Example Contents of Tar File
Code Block | ||
---|---|---|
| ||
> cd demo/vnfs/DAaaS
> find kafka-config
kafka-config/values.yaml
kafka-config/Chart.yaml
kafka-config/templates
kafka-config/templates/topic.yaml
#Create a tar.gz for upload
> tar -cf kafka-config.tar kafka-config
> gzip kafka-config.tar
|
Configuration Values Management API
Once the templates are created, configuration can be applied by choosing the right template.
Day 2 configuration is applied by users as and when new configuration is required. As a user, he/she should select the template and supply values to apply new configuration.
In Day2 apply configuration API includes:
...
each instance of
...
configuration
...
is identified by
...
rb_name
...
, rb_version and profile_name. The body of the API contains set of parameter and value list
With this information, we are ready to upload the values with the following JSON data. UUID can be provided or if not provided then generated internally.Command to create (POST) Configuration Values
Code Block | ||||||
---|---|---|---|---|---|---|
| {
"application-name":"kafka",
"record-name":"kafka-config-1",
"vnf-instance-id":"1234567890",
"
| |||||
curl -i -d @values.json -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{template-name}/value |
Code Block | ||||
---|---|---|---|---|
| ||||
{ "description":"testing Kafka Day 2 config configuration", "uuid":"12345678-8888-4578-3344-987654398731", "values":{ "namespace":"kafka", "topic":{ "name":"orders", "cluster":"my-cluster", "partitions":10, "replicas":2 } } } |
...
This command returns the following JSON which contains config-version id.
Code Block | ||||||
---|---|---|---|---|---|---|
| curl -i -d @values.json -X POST http://localhost:8081/v1/config/value
| |||||
{
"rb-name":"kafka",
"rb-version":"kafka-config-1",
"profile-name":"1234567890",
"template-name": "kafka-1"
"config-version":"1.0"
}
} |
POST used for both loading new configuration values and also modifying the existing configuration values
Command to GET Configuration Values
Code Block | ||
---|---|---|
| ||
# Get all Values curl -i http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{template-name}/value # Get one Value with config version curl -i http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/value/12345678-8888-4578-3344-987654398731 |
...
{template-name}/value/{config-version} |
Command to DELETE Configuration Values
Code Block | ||
---|---|---|
| ||
curl -i -X DELETE http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{template-name}/value/{config-version} |
Command to PUT Configuration Values for Rollback
Code Block | ||
---|---|---|
| ||
curl -i -X DELETE http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{template-name}/value/12345678-8888-4578-3344-987654398731{config-version} |
This will rollback the configuration to the config-version.