add support for config generation
Change-Id: I61707ddb10bb64bd6ccbe10cd5e52c623ff01664
diff --git a/metadata/service/control/cluster.yml b/metadata/service/control/cluster.yml
index af57c64..8a20225 100644
--- a/metadata/service/control/cluster.yml
+++ b/metadata/service/control/cluster.yml
@@ -66,6 +66,7 @@
control:
version: ${_param:opencontrail_version}
enabled: true
+ id: ${_param:opencontrail_database_id}
bind:
address: ${_param:cluster_local_address}
discovery:
diff --git a/metadata/service/control/container.yml b/metadata/service/control/container.yml
new file mode 100644
index 0000000..c83ffb6
--- /dev/null
+++ b/metadata/service/control/container.yml
@@ -0,0 +1,110 @@
+parameters:
+ kubernetes:
+ control:
+ configmap:
+ opencontrail-control:
+ grains:
+ os_family: Debian
+ pillar:
+ opencontrail:
+ control:
+ version: ${_param:opencontrail_version}
+ enabled: true
+ bind:
+ address: $OPENCONTRAIL_CONTROL_LOCAL_HOST
+ discovery:
+ host: ${_param:opencontrail_config_service_host}
+ name: $HOSTNAME
+ opencontrail-config:
+ grains:
+ os_family: Debian
+ pillar:
+ opencontrail:
+ config:
+ version: ${_param:opencontrail_version}
+ enabled: true
+ multi_tenancy: true
+ discovery:
+ host: ${_param:opencontrail_config_service_host}
+ analytics:
+ host: ${_param:opencontrail_collector_service_host}
+ bind:
+ address: $IP
+ message_queue:
+ engine: rabbitmq
+ host: ${_param:rabbitmq_service_host}
+ port: 5672
+ identity:
+ engine: keystone
+ version: '2.0'
+ region: RegionOne
+ host: ${_param:keystone_service_host}
+ port: 35357
+ user: admin
+ password: '${_param:keystone_admin_password}'
+ token: '${_param:keystone_service_token}'
+ tenant: admin
+ opencontrail-collector:
+ grains:
+ os_family: Debian
+ pillar:
+ opencontrail:
+ collector:
+ version: ${_param:opencontrail_version}
+ enabled: true
+ bind:
+ address: $IP
+ port: 9081
+ discovery:
+ host: ${_param:opencontrail_config_service_host}
+ data_ttl: 1
+ opencontrail-database:
+ grains:
+ os_family: Debian
+ pillar:
+ opencontrail:
+ database:
+ version: ${_param:opencontrail_version}
+ cassandra:
+ version: 2
+ enabled: true
+ name: 'Contrail'
+ minimum_disk: 10
+ discovery:
+ host: ${_param:opencontrail_config_service_host}
+ bind:
+ host: $IP
+ port: 9042
+ rpc_port: 9160
+ id: $ID
+ opencontrail-web:
+ grains:
+ os_family: Debian
+ pillar:
+ opencontrail:
+ web:
+ version: ${_param:opencontrail_version}
+ enabled: True
+ enable_discovery: False
+ bind:
+ address: 0.0.0.0
+ analytics:
+ host: ${_param:opencontrail_collector_service_host}
+ cache:
+ engine: redis
+ host: 0.0.0.0
+ port: 6379
+ identity:
+ engine: keystone
+ version: '2.0'
+ host: ${_param:keystone_service_host}
+ port: 35357
+ user: admin
+ password: '${_param:keystone_admin_password}'
+ token: '${_param:keystone_service_token}'
+ tenant: admin
+ network:
+ engine: neutron
+ host: ${_param:neutron_service_host}
+ master:
+ host: ${_param:opencontrail_config_service_host}
\ No newline at end of file
diff --git a/metadata/service/control/control.yml b/metadata/service/control/control.yml
index dfc7c0f..6ab199c 100644
--- a/metadata/service/control/control.yml
+++ b/metadata/service/control/control.yml
@@ -66,6 +66,7 @@
control:
version: ${_param:opencontrail_version}
enabled: true
+ id: ${_param:opencontrail_database_id}
bind:
address: ${_param:cluster_local_address}
discovery:
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index 5927fdd..83734c0 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -9,3 +9,5 @@
enabled: true
sphinx:
enabled: true
+ config:
+ enabled: true
\ No newline at end of file
diff --git a/opencontrail/files/3.0/basicauthusers.properties b/opencontrail/files/3.0/basicauthusers.properties
index 7d62559..4aefe2d 100644
--- a/opencontrail/files/3.0/basicauthusers.properties
+++ b/opencontrail/files/3.0/basicauthusers.properties
@@ -7,6 +7,7 @@
schema-transformer:schema-transformer
svc-monitor:svc-monitor
control-user:control-user-passwd
+control-node-0:control-node-0
control-node-1:control-node-1
control-node-2:control-node-2
control-node-3:control-node-3
@@ -17,6 +18,11 @@
control-node-8:control-node-8
control-node-9:control-node-9
control-node-10:control-node-10
+control-node-1.dns:control-node-1.dns
+control-node-2.dns:control-node-2.dns
+control-node-3.dns:control-node-3.dns
+control-node-4.dns:control-node-4.dns
+control-node-5.dns:control-node-5.dns
dhcp:dhcp
visual:visual
sensor:sensor
@@ -27,10 +33,6 @@
# This is a read-only MAPC
reader:reader
-{%- for member in config.members %}
-{{ member.host }}:{{ member.host }}
-{{ member.host }}.dns:{{ member.host }}.dns
-{%- endfor %}
#10.0.102.31:10.0.102.31
#10.0.102.31.dns:10.0.102.31.dns
#10.0.102.32:10.0.102.32
diff --git a/opencontrail/files/3.0/contrail-control.conf b/opencontrail/files/3.0/contrail-control.conf
index b8241e4..58154c1 100644
--- a/opencontrail/files/3.0/contrail-control.conf
+++ b/opencontrail/files/3.0/contrail-control.conf
@@ -11,7 +11,11 @@
# collectors= # Provided by discovery server
hostip={{ control.bind.address }} # Resolved IP of `hostname`
#hostname=ctl-oc-1 # Retrieved as `hostname`
+ {%- if control.name is defined %}
+ hostname={{ control.name }}
+ {%- else %}
hostname={{ pillar.linux.system.name }}
+ {%- endif %}
# http_server_port=8083
# log_category=
# log_disable=0
@@ -29,9 +33,14 @@
[IFMAP]
certs_store=
- password={{ control.bind.address }}
+ {%- if control.id is defined %}
+ password=control-node-{{ control.id }}
+ user=control-node-{{ control.id }}
+ {%- else %}
+ password={{ control.name }}
+ user={{ control.name }}
+ {%- endif %}
# server_url= # Provided by discovery server, e.g. https://127.0.0.1:8443
{%- if grains.get('virtual_subtype', None) == "Docker" %}
server_url=https://{{ control.discovery.host }}:8443
{%- endif %}
- user={{ control.bind.address }}
diff --git a/opencontrail/files/3.0/contrail-dns.conf b/opencontrail/files/3.0/contrail-dns.conf
index db5de80..88676bd 100644
--- a/opencontrail/files/3.0/contrail-dns.conf
+++ b/opencontrail/files/3.0/contrail-dns.conf
@@ -14,7 +14,11 @@
# rndc_config_file=contrail-rndc.conf # rndc config file
# rndc_secret=secretkey # rndc secret
hostip={{ control.bind.address }} # Resolved IP of `hostname`
- hostname={{ pillar.linux.system.name }} # Retrieved as `hostname`
+ {%- if control.name is defined %}
+ hostname={{ control.name }}
+ {%- else %}
+ hostname={{ pillar.linux.system.name }}
+ {%- endif %}
# http_server_port=8092
# dns_server_port=53
# log_category=
@@ -32,7 +36,12 @@
[IFMAP]
certs_store=
- password={{ control.bind.address }}.dns
+ {%- if control.id is defined %}
+ password=control-node-{{ control.id }}.dns
+ user=control-node-{{ control.id }}.dns
+ {%- else %}
+ password={{ control.name }}.dns
+ user={{ control.name }}.dns
+ {%- endif %}
# server_url= # Provided by discovery server, e.g. https://127.0.0.1:8443
- user={{ control.bind.address }}.dns
diff --git a/opencontrail/map.jinja b/opencontrail/map.jinja
index 2701d3b..4392732 100644
--- a/opencontrail/map.jinja
+++ b/opencontrail/map.jinja
@@ -8,7 +8,7 @@
'source': {'engine': 'pkg', 'address': 'http://'},
'pkgs': ['contrail-utils', 'contrail-nodemgr'],
},
-}, merge=salt['pillar.get']('opencontrail:common')) %}
+}, merge=pillar.opencontrail.get('common', {})) %}
{% set collector = salt['grains.filter_by']({
'Debian': {
@@ -21,7 +21,7 @@
'redis_config': '/etc/redis.conf',
'services': ['supervisor-analytics','redis']
},
-}, merge=salt['pillar.get']('opencontrail:collector')) %}
+}, merge=pillar.opencontrail.get('collector', {})) %}
{% set compute = salt['grains.filter_by']({
'Debian': {
@@ -32,7 +32,7 @@
'pkgs': ['contrail-openstack-vrouter', 'haproxy', 'contrail-vrouter-source'],
'services': ['supervisor-vrouter']
},
-}, merge=salt['pillar.get']('opencontrail:compute')) %}
+}, merge=pillar.opencontrail.get('compute', {})) %}
{% set config = salt['grains.filter_by']({
'Debian': {
@@ -43,7 +43,7 @@
'pkgs': ['contrail-openstack-config'],
'services': ['supervisor-config']
},
-}, merge=salt['pillar.get']('opencontrail:config')) %}
+}, merge=pillar.opencontrail.get('config', {})) %}
{% set control = salt['grains.filter_by']({
'Debian': {
@@ -54,7 +54,7 @@
'pkgs': ['contrail-openstack-control'],
'services': ['contrail-control', 'supervisor-control']
},
-}, merge=salt['pillar.get']('opencontrail:control')) %}
+}, merge=pillar.opencontrail.get('control', {})) %}
{% set database = salt['grains.filter_by']({
'Debian': {
@@ -67,7 +67,7 @@
'cassandra_config': '/etc/cassandra/conf/',
'services': ['supervisord-contrail-database','zookeeper']
},
-}, merge=salt['pillar.get']('opencontrail:database')) %}
+}, merge=pillar.opencontrail.get('database', {})) %}
{% set web = salt['grains.filter_by']({
'Debian': {
@@ -78,7 +78,7 @@
'pkgs': ['contrail-web-controller'],
'services': ['supervisor-webui']
},
-}, merge=salt['pillar.get']('opencontrail:web')) %}
+}, merge=pillar.opencontrail.get('web', {})) %}
{% set tor = salt['grains.filter_by']({
'Debian': {
@@ -93,4 +93,4 @@
'Debian': {
'pkgs': ['python-contrail'],
}
-}, merge=salt['pillar.get']('opencontrail:client')) %}
+}, merge=pillar.opencontrail.get('client', {})) %}
diff --git a/opencontrail/meta/config.yml b/opencontrail/meta/config.yml
new file mode 100644
index 0000000..8d294dc
--- /dev/null
+++ b/opencontrail/meta/config.yml
@@ -0,0 +1,129 @@
+config:
+ {%- if pillar.opencontrail.config is defined %}
+ {%- from "opencontrail/map.jinja" import config with context %}
+ publisher.properties:
+ source: "salt://opencontrail/files/{{ config.version }}/config/publisher.properties"
+ template: jinja
+ log4j.properties:
+ source: "salt://opencontrail/files/{{ config.version }}/config/log4j.properties"
+ template: jinja
+ basicauthusers.properties:
+ source: "salt://opencontrail/files/{{ config.version }}/basicauthusers.properties"
+ template: jinja
+ contrail-api.conf:
+ source: "salt://opencontrail/files/{{ config.version }}/contrail-api.conf"
+ template: jinja
+ contrail-discovery.conf:
+ source: "salt://opencontrail/files/{{ config.version }}/contrail-discovery.conf"
+ template: jinja
+ vnc-api-lib.ini:
+ source: "salt://opencontrail/files/{{ config.version }}/vnc_api_lib.ini"
+ template: jinja
+ contrail-device-manager.conf:
+ source: "salt://opencontrail/files/{{ config.version }}/contrail-device-manager.conf"
+ template: jinja
+ contrail-sudoers:
+ source: "salt://opencontrail/files/{{ config.version }}/config/contrail_sudoers"
+ template: jinja
+ {%- if config.identity.engine == "keystone" %}
+ contrail-keystone-auth.conf:
+ source: "salt://opencontrail/files/{{ config.version }}/contrail-keystone-auth.conf"
+ template: jinja
+ {%- endif %}
+ contrail-config-nodemgr.ini:
+ source: "salt://opencontrail/files/{{ config.version }}/config/contrail-config-nodemgr.ini"
+ template: jinja
+ contrail-schema.conf:
+ source: "salt://opencontrail/files/{{ config.version }}/contrail-schema.conf"
+ template: jinja
+ contrail-svc-monitor.conf:
+ source: "salt://opencontrail/files/{{ config.version }}/contrail-svc-monitor.conf"
+ template: jinja
+ {%- endif %}
+ {%- if pillar.opencontrail.control is defined %}
+ {%- from "opencontrail/map.jinja" import control with context %}
+ contrail-control-nodemgr.conf:
+ source: "salt://opencontrail/files/{{ control.version }}/contrail-control-nodemgr.conf"
+ template: jinja
+ contrail-control.conf:
+ source: "salt://opencontrail/files/{{ control.version }}/contrail-control.conf"
+ template: jinja
+ contrail-dns.conf:
+ source: "salt://opencontrail/files/{{ control.version }}/contrail-dns.conf"
+ template: jinja
+ contrail-control-nodemgr.ini:
+ source: "salt://opencontrail/files/{{ control.version }}/control/contrail-control-nodemgr.ini"
+ template: jinja
+ {%- endif %}
+ {%- if pillar.opencontrail.database is defined %}
+ {%- from "opencontrail/map.jinja" import database with context %}
+ cassandra.yaml:
+ source: "salt://opencontrail/files/{{ database.version }}/cassandra.yaml"
+ template: jinja
+ cassandra-env.sh:
+ source: "salt://opencontrail/files/{{ database.version }}/database/cassandra-env.sh"
+ template: jinja
+ contrail-database-nodemgr.conf:
+ source: "salt://opencontrail/files/{{ database.version }}/contrail-database-nodemgr.conf"
+ template: jinja
+ zoo.cfg:
+ source: "salt://opencontrail/files/{{ database.version }}/zoo.cfg"
+ template: jinja
+ server.properties:
+ source: "salt://opencontrail/files/{{ database.version }}/server.properties"
+ template: jinja
+ {%- endif %}
+ {%- if pillar.opencontrail.collector is defined %}
+ {%- from "opencontrail/map.jinja" import collector with context %}
+ contrail-analytics-nodemgr.conf:
+ source: "salt://opencontrail/files/{{ collector.version }}/contrail-analytics-nodemgr.conf"
+ template: jinja
+ contrail-alarm-gen.conf:
+ source: "salt://opencontrail/files/{{ collector.version }}/contrail-alarm-gen.conf"
+ template: jinja
+ contrail-snmp-collector.conf:
+ source: "salt://opencontrail/files/{{ collector.version }}/contrail-snmp-collector.conf"
+ template: jinja
+ contrail-topology.conf:
+ source: "salt://opencontrail/files/{{ collector.version }}/contrail-topology.conf"
+ template: jinja
+ contrail-collector.conf:
+ source: "salt://opencontrail/files/{{ collector.version }}/contrail-collector.conf"
+ template: jinja
+ contrail-query-engine.conf:
+ source: "salt://opencontrail/files/{{ collector.version }}/contrail-query-engine.conf"
+ template: jinja
+ contrail-analytics-api.conf:
+ source: "salt://opencontrail/files/{{ collector.version }}/contrail-analytics-api.conf"
+ template: jinja
+ contrail-analytics-nodemgr.ini:
+ source: "salt://opencontrail/files/{{ collector.version }}/collector/contrail-analytics-nodemgr.ini"
+ template: jinja
+ {%- endif %}
+ {%- if pillar.opencontrail.web is defined %}
+ {%- from "opencontrail/map.jinja" import web with context %}
+ config.global.js:
+ source: "salt://opencontrail/files/{{ web.version }}/config.global.js"
+ template: jinja
+ contrail-webui-userauth.js:
+ source: "salt://opencontrail/files/{{ web.version }}/contrail-webui-userauth.js"
+ template: jinja
+ {%- endif %}
+ {%- if pillar.opencontrail.compute is defined %}
+ {%- from "opencontrail/map.jinja" import compute with context %}
+ contrail-vrouter-nodemgr.conf:
+ source: "salt://opencontrail/files/{{ compute.version }}/contrail-vrouter-nodemgr.conf"
+ template: jinja
+ vrouter-nodemgr-param:
+ source: "salt://opencontrail/files/{{ compute.version }}/vrouter_nodemgr_param"
+ template: jinja
+ agent-param:
+ source: "salt://opencontrail/files/{{ compute.version }}/agent_param"
+ template: jinja
+ contrail-vrouter-agent.conf:
+ source: "salt://opencontrail/files/{{ compute.version }}/contrail-vrouter-agent.conf"
+ template: jinja
+ contrail-vrouter-nodemgr.ini:
+ source: "salt://opencontrail/files/{{ compute.version }}/contrail-vrouter-nodemgr.ini"
+ template: jinja
+ {%- endif %}
\ No newline at end of file