You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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 create (POST) 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_1"
    "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

Command to create (POST) Configuration Values

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


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

# 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/{template-name}/value/{config-version}

Command to DELETE Configuration Values

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

curl -i -X DELETE http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{template-name}/value/{config-version}

This will rollback the configuration to the config-version.


  • No labels