Requirements
Day 2 Configurations for applications are applied using K8S kinds (typically CRDs) implemented by application specific operators. 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. 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 POST (create) Template:
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 )
{ "name": "kafka_token" "description": "testing Kafka Day 2 config configuration", "rb-name": "kafka", "rb-version": "1.0", }
Command to UPLOAD Template:
curl -i --data-binary @kafka-config.tar.gz -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config-template/{name}
Command to GET Templates:
# 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/{name}
Command to DELETE Templates:
curl -i -X DELETE http://localhost:8081/rb/definition/{name}/{version}/profile/{name}/config-template/{name}
Example
Example Contents of Tar File
> 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
In Day2 apply configuration API 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.
CRUD Operations
Command to POST (create) Configuration Values
curl -i -d @values.json -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config
With the following JSON content (values.json )
{ "template-name": "kafka_token" "config-name": "kafka_token_1" "description":"testing Kafka Day 2 config configuration", "values":{ "namespace":"kafka", "topic":{ "name":"orders", "cluster":"my-cluster", "partitions":10, "replicas":2 } } }
This command returns the following JSON which contains config-version id.
{ "rb-name":"kafka", "rb-version":"kafka-config-1", "profile-name":"1234567890", "template-name": "kafka-token" "config-name": "kafka_token_1" "config-version":"1.0" } }
Command to GET Configuration Values
# Get all Values curl -i http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config # Get one Value with config version curl -i http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{name}
Command to DELETE Configuration Values
curl -i -X DELETE http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{name}
Command to PUT (Modify) Configuration Values
curl -i -X PUT http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{name}
Command to ROLLBACK configuration Values
curl -i -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/rollback
With the following JSON content (values.json )
{ "config-version": "5" }
Command to TAG configuration Values
curl -i -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/tagit
With the following JSON content (values.json )
{ "tag-name": "my-tag" }