Creates topics

- creates Kafka topics: notifications.sample and metering.sample

Change-Id: I6cb6abd8f0f121c477bdeb1f5e436a651ba77226
This commit is contained in:
Volodymyr Kornylyuk 2016-09-19 11:41:15 +03:00
parent 782e153375
commit 0ae8c7888f
3 changed files with 69 additions and 24 deletions

View File

@ -0,0 +1,36 @@
notice('MODULAR: fuel-plugin-telemetry: create-topics.pp')
# Topic settings
prepare_network_config(hiera_hash('network_scheme', {}))
$network_metadata = hiera_hash('network_metadata')
$controllers = get_nodes_hash_by_roles($network_metadata, ['controller', 'primary-controller'])
$controllers_amount = count($controllers)
$notifications_partitions = max($controllers_amount/3,1)*$::processorcount
$metering_partitions = $controllers_amount
# Connection info
$brokerlist = hiera('telemetry::kafka::nodes_list')
$replication_factor = count($brokerlist)
$zookeeper_ip = $brokerlist[0]
$zookeeper_address = "${zookeeper_ip}:2181"
$script_location = '/tmp/create-topics.sh'
file { $script_location:
owner => 'root',
group => 'root',
mode => '0740',
content => template('telemetry/create-topics.sh.erb'),
}
exec { "run_${script_location}":
command => $script_location,
require => File[$script_location],
}
exec { "remove_${script_location}":
command => "/bin/rm -f ${script_location}",
require => Exec["run_${script_location}"],
}

View File

@ -0,0 +1,20 @@
#!/bin/bash
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eux
/opt/kafka/bin/kafka-topics.sh --create --if-not-exists --zookeeper <%= @zookeeper_address %> --replication-factor <%= @replication_factor %> --partitions <%= @notifications_partitions %> --topic notifications.sample
/opt/kafka/bin/kafka-topics.sh --create --if-not-exists --zookeeper <%= @zookeeper_address %> --replication-factor <%= @replication_factor %> --partitions <%= @metering_partitions %> --topic metering.sample

View File

@ -161,19 +161,6 @@
test_post:
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-ceilometer_post.rb
#- id: telemetry-ceilometer-radosgw-user
# type: puppet
# version: 2.1.0
# role: [primary-controller, controller]
# requires: [post_deployment_start, enable_rados]
# required_for: [post_deployment_end]
# parameters:
# puppet_manifest: "/etc/puppet/modules/openstack_tasks/examples/ceilometer/radosgw_user.pp"
# puppet_modules: "/etc/puppet/modules"
# timeout: 300
# cwd: /
- id: telemetry-configure-apt
type: puppet
version: 2.0.0
@ -199,14 +186,8 @@
groups: [primary-controller, controller]
requires: [post_deployment_start,telemetry-aodh,telemetry-hiera,telemetry-ceilometer-controller]
required_for: [post_deployment_end]
# required_for: [deploy_end]
# requires: [deploy_start, telemetry-ceilometer-controller]
cross-depends:
- name: primary-influxdb_grafana
# - name: lma-hiera-override
# - name: lma-aggregator
# - name: /(primary-)?cluster-haproxy/
# role: self
parameters:
puppet_manifest: puppet/manifests/configure.pp
puppet_modules: puppet/modules:/etc/puppet/modules
@ -220,10 +201,6 @@
required_for: [post_deployment_end]
cross-depends:
- name: primary-influxdb_grafana
# - name: lma-hiera-override
# - name: lma-aggregator
# - name: /(primary-)?cluster-haproxy/
# role: self
parameters:
puppet_manifest: puppet/manifests/configure-influxdb.pp
puppet_modules: puppet/modules:/etc/puppet/modules
@ -258,12 +235,24 @@
groups: [primary-controller, controller]
required_for: [post_deployment_end]
role: [primary-kafka, kafka]
requires: [telemetry-influxdb-create-db, telemetry-hiera]
requires: [telemetry-influxdb-create-db, telemetry-hiera, kafka-installation]
parameters:
puppet_manifest: puppet/manifests/hindsight.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 300
- id: telemetry-create-topics
type: puppet
version: 2.1.0
groups: [primary-controller, controller]
required_for: [post_deployment_end]
role: [primary-kafka, kafka]
requires: [telemetry-hindsight]
parameters:
puppet_manifest: puppet/manifests/create-topics.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 300
# skip base tasks
- id: ceilometer-radosgw-user
type: skipped