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 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:
Code Block |
---|
|
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 |
---|
language | js |
---|
linenumbers | true |
---|
|
{
"name": "kafka_token"
"description": "testing Kafka Day 2 config configuration",
} |
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/{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/{name} |
Command to DELETE Templates:
Code Block |
---|
|
curl -i -X DELETE http://localhost:8081/rb/definition/{name}/{version}/profile/{name}/config-template/{name} |
Example
Example Contents of Tar File
Code Block |
---|
|
> cd demo/vnfs/DAaaS
> find kafka-config
kafka-config/manifestvalues.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 |
---|
language | yml |
---|
title | manifest.yaml |
---|
linenumbers | true |
---|
|
---
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.
...
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
Code Block |
---|
|
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 )
Code Block |
---|
language | js |
---|
linenumberstitle | trueProfile JSON Body |
---|
|
{
"applicationtemplate-name": "kafka_token",
"recordconfig-name": "kafka-config-_token_1",
"description": "testing Kafka Day 2 config configuration",
"values":{
"uuidnamespace":"kafka",
"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/template |
Command to UPLOAD Template:
Code Block |
---|
|
curl -i --data-binary @kafka-config.tar.gz -X POST http://localhost:8081/v1/config/template/7eb09e38-4363-9942-1234-3beb2e95fd85/content |
...
"topic":{
"name":"orders",
"cluster":"my-cluster",
"partitions":10,
"replicas":2
}
}
} |
This command returns the following JSON which contains config-version id.
Code Block |
---|
language | js |
---|
title | Profile JSON Body |
---|
|
{
"rb-name":"kafka",
"rb-version":"kafka-config-1",
"profile-name":"1234567890",
"template-name": "kafka-token"
"config-name": "kafka_token_1"
"config-version":"1"
}
} |
Command to GET Configuration Values
Code Block |
---|
|
# Get all TemplatesValues
curl -i http://localhost:8081/v1/rb/definition/{name}/config/template{version}/profile/{name}/config
# Get one Template Value with config name
curl -i http://localhost:8081/v1/config/template/7eb09e38-4363-9942-1234-3beb2e95fd85rb/definition/{name}/{version}/profile/{name}/config/{name} |
Command to DELETE
...
Configuration Values
Code Block |
---|
|
curl -i -X DELETE http://localhost:8081/v1/rb/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
...
definition/{name}/{version}/profile/{name}/config/{name} |
Command to PUT (Modify) Configuration Values
Code Block |
---|
|
curl -i -d @values.json -X PUT http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{name} |
With the following JSON content (values.json )
Code Block |
---|
language | js |
---|
title | Profile JSON Body |
---|
|
{
"applicationtemplate-name": "kafka_token",
"recordconfig-name": "kafka-config-1",
"vnf-instance-id":"1234567890",_token_1"
"description":"testing Kafka Day 2 config configuration",
"uuid":"12345678-8888-4578-3344-987654398731",
"values":{
"namespace":"kafka",
"topic":{
"name":"orders",
"cluster":"my-cluster",
"partitions":1020,
"replicas":2
}
}
} |
...
This command returns the following JSON which contains config-version.
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-token"
"config-name": "kafka_token_1"
"config-version":"3"
}
} |
Command to TAG configuration Values
This will add the tag name to the current config version
Code Block |
---|
|
#curl Get-i all Values
curl-d @values.json -iX POST http://localhost:8081/v1/config/value
# Get one Value
curl -i http://localhost:8081/v1/config/value/12345678-8888-4578-3344-987654398731 |
...
rb/definition/{name}/{version}/profile/{name}/tagit |
With the following JSON content (values.json )
Code Block |
---|
language | js |
---|
title | Profile JSON Body |
---|
|
{
"tag-name": "my-tag"
} |
Command to ROLLBACK configuration Values
Rollbacks configuration to a config version or a tag.
Code Block |
---|
|
curl -i -d @values.json -X DELETEPOST http://localhost:8081/v1/config/value/12345678-8888-4578-3344-987654398731/rb/definition/{name}/{version}/profile/{name}/rollback |
With the following JSON content (values.json )
Code Block |
---|
language | js |
---|
title | Profile JSON Body |
---|
|
{
"anyOf": [
{
"config-version": "<value>"
},
{
"config-tag": "<tag name>"
}
]
} |