Puppet Class: confluent::control::center

Inherits:
confluent::params
Defined in:
manifests/control/center.pp

Overview

Class is used to install

Examples:

Installation through class.

class {'confluent::control::center':
  config => {
    'zookeeper.connect' => {
      'value' => 'zookeeper-01.example.com:2181,zookeeper-02.example.com:2181,zookeeper-03.example.com:2181'
    },
    'bootstrap.servers' => {
      'value' => 'kafka-01.example.com:9092,kafka-02.example.com:9092,kafka-03.example.com:9092'
    },
    'confluent.controlcenter.connect.cluster' => {
      'value' => 'kafka-connect-01.example.com:8083,kafka-connect-02.example.com:8083,kafka-connect-03.example.com:8083'
    }
  },
  environment_settings => {
    'CONTROL_CENTER_HEAP_OPTS' => {
      'value' => '-Xmx6g'
    }
  }
}

Hiera based installation

include ::confluent::control::center

confluent::control::center::config:
  zookeeper.connect:
    value: 'zookeeper-01.example.com:2181,zookeeper-02.example.com:2181,zookeeper-03.example.com:2181'
  bootstrap.servers:
    value: 'kafka-01.example.com:9092,kafka-02.example.com:9092,kafka-03.example.com:9092'
  confluent.controlcenter.connect.cluster:
    value: 'kafka-connect-01:8083,kafka-connect-02:8083,kafka-connect-03:8083'
confluent::control::center::environment_settings:
  CONTROL_CENTER_HEAP_OPTS:
    value: -Xmx6g

Parameters:

  • config (Any) (defaults to: {})

    Hash of configuration values.

  • environment_settings (Any) (defaults to: {})

    Hash of environment variables to set for the Kafka scripts.

  • config_path (Any) (defaults to: $::confluent::params::control_center_config_path)

    Location of the server.properties file for the Kafka broker.

  • environment_file (Any) (defaults to: $::confluent::params::control_center_environment_path)

    Location of the environment file used to pass environment variables to the Kafka broker.

  • log_path (Any) (defaults to: $::confluent::params::control_center_log_path)

    Location to write the log files to.

  • user (Any) (defaults to: $::confluent::params::control_center_user)

    User to run the kafka service as.

  • service_name (Any) (defaults to: $::confluent::params::control_center_service)

    Name of the kafka service.

  • manage_service (Any) (defaults to: $::confluent::params::control_center_manage_service)

    Flag to determine if the service should be managed by puppet.

  • service_ensure (Any) (defaults to: $::confluent::params::control_center_service_ensure)

    Ensure setting to pass to service resource.

  • service_enable (Any) (defaults to: $::confluent::params::control_center_service_enable)

    Enable setting to pass to service resource.

  • file_limit (Any) (defaults to: $::confluent::params::control_center_file_limit)

    File limit to set for the Kafka service (SystemD) only.

  • bootstrap_servers (Any)
  • zookeeper_connect (Any)
  • connect_cluster (Any) (defaults to: [])
  • control_center_id (Any) (defaults to: 1)
  • data_path (Any) (defaults to: $::confluent::params::control_center_data_path)
  • manage_repository (Any) (defaults to: $::confluent::params::manage_repository)
  • stop_timeout_secs (Any) (defaults to: $::confluent::params::control_center_stop_timeout_secs)
  • heap_size (Any) (defaults to: $::confluent::params::control_center_heap_size)


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'manifests/control/center.pp', line 48

class confluent::control::center (
  $bootstrap_servers,
  $zookeeper_connect,
  $connect_cluster      = [],
  $control_center_id    = 1,
  $config               = {},
  $environment_settings = {},
  $data_path            = $::confluent::params::control_center_data_path,
  $config_path          = $::confluent::params::control_center_config_path,
  $environment_file     = $::confluent::params::control_center_environment_path,
  $log_path             = $::confluent::params::control_center_log_path,
  $user                 = $::confluent::params::control_center_user,
  $service_name         = $::confluent::params::control_center_service,
  $manage_service       = $::confluent::params::control_center_manage_service,
  $service_ensure       = $::confluent::params::control_center_service_ensure,
  $service_enable       = $::confluent::params::control_center_service_enable,
  $file_limit           = $::confluent::params::control_center_file_limit,
  $manage_repository    = $::confluent::params::manage_repository,
  $stop_timeout_secs    = $::confluent::params::control_center_stop_timeout_secs,
  $heap_size            = $::confluent::params::control_center_heap_size

) inherits confluent::params {
  include ::confluent

  if($manage_repository) {
    include ::confluent::repository
  }

  validate_hash($config)
  validate_hash($environment_settings)
  validate_absolute_path($config_path)
  validate_absolute_path($environment_file)
  validate_absolute_path($log_path)

  $application_name = 'c3'

  $control_center_default_settings = {
    'confluent.controlcenter.id'              => {
      'value' => $control_center_id
    },
    'confluent.controlcenter.data.dir'        => {
      'value' => $data_path
    },
    'bootstrap.servers'                       => {
      'value' => join(any2array($bootstrap_servers), ',')
    },
    'confluent.controlcenter.connect.cluster' => {
      'value' => join(any2array($connect_cluster), ',')
    },
    'zookeeper.connect'                       => {
      'value' => join(any2array($zookeeper_connect), ',')
    }
  }

  $java_default_settings = {
    'CONTROL_CENTER_HEAP_OPTS' => {
      'value' => "-Xmx${heap_size}"
    },
    'CONTROL_CENTER_OPTS'      => {
      'value' => '-Djava.net.preferIPv4Stack=true'
    },
    'LOG_DIR'                  => {
      'value' => $log_path
    }
  }

  $actual_control_center_settings = merge($control_center_default_settings, $config)
  $actual_java_settings = merge($java_default_settings, $environment_settings)

  user { $user:
    ensure => present
  } ->
  file { [$log_path, $data_path]:
    ensure  => directory,
    owner   => $user,
    group   => $user,
    recurse => true
  }

  package { 'confluent-control-center':
    ensure => latest,
    tag    => 'confluent',
  }

  $ensure_control_center_settings_defaults = {
    'ensure'      => 'present',
    'path'        => $config_path,
    'application' => $application_name
  }

  ensure_resources('confluent::java_property', $actual_control_center_settings, $ensure_control_center_settings_defaults
  )

  $ensure_java_settings_defaults = {
    'path'        => $environment_file,
    'application' => $application_name
  }

  ensure_resources('confluent::kafka_environment_variable', $actual_java_settings, $ensure_java_settings_defaults)

  $unit_ini_setting_defaults = {
    'ensure' => 'present'
  }

  $unit_ini_settings = {
    "${service_name}/Unit/Description"        => { 'value' => 'Confluent Control Center', },
    "${service_name}/Unit/Wants"              => { 'value' => 'basic.target', },
    "${service_name}/Unit/After"              => { 'value' => 'basic.target network.target', },
    "${service_name}/Service/User"            => { 'value' => $user, },
    "${service_name}/Service/EnvironmentFile" => { 'value' => $environment_file, },
    "${service_name}/Service/ExecStart"       => { 'value' => "/usr/bin/control-center-start ${config_path}", },
    # "${service_name}/Service/ExecStop'               => { 'value' => "/usr/bin/zookeeper-server-stop", },
    "${service_name}/Service/LimitNOFILE"     => { 'value' => $file_limit, },
    "${service_name}/Service/KillMode"        => { 'value' => 'process', },
    "${service_name}/Service/RestartSec"      => { 'value' => 5, },
    "${service_name}/Service/TimeoutStopSec"  => { 'value' => $stop_timeout_secs, },
    "${service_name}/Service/Type"            => { 'value' => 'simple', },
    "${service_name}/Install/WantedBy"        => { 'value' => 'multi-user.target', },
  }

  ensure_resources('confluent::systemd::unit_ini_setting', $unit_ini_settings, $unit_ini_setting_defaults)

  if($manage_service) {
    service { $service_name:
      ensure => $service_ensure,
      enable => $service_enable
    }
  }
}