Requirements
There are three ways the configuration updates happen in K8S world.
- Using K8S kinds (typically CRDs) implemented by application specific operators
- Updating by overwriting (config-map) and updating via 'helm upgrade' (Incremental configuration)
- Using K8S kinds via operators, but expect all the configuration to be given every time (currently this is done via helm upgrade)
Configuration Template Management API
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
> 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
--- 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.
With the following JSON content
{ "application-name": "kafka", "record-name": "kafka-config-1", "description": "testing Kafka Day 2 config configuration", "uuid": "7eb09e38-4363-9942-1234-3beb2e95fd85" }
Command to create (POST) Template:
curl -i -d @create_config_template.json -X POST http://localhost:8081/v1/config/template
Command to UPLOAD Template:
curl -i --data-binary @kafka-config.tar.gz -X POST http://localhost:8081/v1/config/template/7eb09e38-4363-9942-1234-3beb2e95fd85/content
Command to GET Templates:
# Get all Templates curl -i http://localhost:8081/v1/config/template # Get one Template curl -i http://localhost:8081/v1/config/template/7eb09e38-4363-9942-1234-3beb2e95fd85
Command to DELETE Templates:
curl -i -X DELETE http://localhost:8081/config/template/7eb09e38-4363-9942-1234-3beb2e95fd85
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.
Day2 apply configuration API includes:
- Each instance of 'configuration' is identified by "application name", "record name", "VNF instance ID" (on which VNF instance to apply this configuration on)
- Body of the API:
- 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.
{ "application-name":"kafka", "record-name":"kafka-config-1", "vnf-instance-id":"1234567890", "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 } } }
Command to create (POST) Configuration Values
curl -i -d @values.json -X POST http://localhost:8081/v1/config/value
Command to GET Configuration Values
# Get all Values curl -i http://localhost:8081/v1/config/value # Get one Value curl -i http://localhost:8081/v1/config/value/12345678-8888-4578-3344-987654398731
Command to DELETE Configuration Values
curl -i -X DELETE http://localhost:8081/v1/config/value/12345678-8888-4578-3344-987654398731