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",
}

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 )

Profile JSON Body
{
  "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.

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

# Get all Values
curl -i http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config

# Get one Value with config name
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 -d @values.json -X PUT http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{name}

With the following JSON content (values.json )

Profile JSON Body
{
  "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":20,
         "replicas":2
      }
   }
}


This command returns the following JSON which contains config-version.

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":"3"
   }
}

Command to TAG  configuration Values 

This will add the tag name to the current config version

curl -i  -d @values.json -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/tagit

With the following JSON content (values.json )

Profile JSON Body
{
  "tag-name": "my-tag"
}


Command to ROLLBACK   configuration Values 

Rollbacks configuration to a config version or a tag. 

curl -i -d @values.json -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/rollback

With the following JSON content (values.json )

Profile JSON Body
{
  "anyOf": [
    {
      "config-version": "<value>"
    },
    {
      "config-tag": "<tag name>"
    }
  ]
}
  • No labels

2 Comments

  1. Ritu Sood and Kiran Kamineni


    On Rollback API, I feel that we should provide an option to rollback to config-version or tag.

    How about this:

     "anyOf": [ 
     {"config-version" : "<value>"}, {"config-tag" : "<tag name>"}

            ]


    Srini




  2. Have few questions, can anyone please help me on this, 


    Q1: I am using multicloud gerrit code from "https://github.com/onap/multicloud-k8s.git ", vnfs missing in demo (cd demo/vnfs/DAaaS).

    Can anyone share kafka-config link.


    Q2: Getting below error while configuring values of management ( post ) in local setup ( where Mongo DB, Multicloud K8S and ETCD are running ),

    Create Error: Unmarshaling Config Value: Error deSerializing value: invalid character 'v' looking for beginning of value


    Q3: while performing " curl -i -d @values.json -X POST http://NODE_IP:30280/api/multicloud-k8s/v1/v1/rb/definition/{name}/{version}/profile/{name}/config " in cluster getting ETCD not initialized.