summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--manifests/haproxy.pp1
-rw-r--r--manifests/profile/base/glance/api.pp77
-rw-r--r--manifests/profile/base/metrics/collectd.pp111
-rw-r--r--manifests/profile/base/metrics/collectd/collectd_plugin.pp6
-rw-r--r--manifests/profile/base/metrics/collectd/collectd_service.pp11
5 files changed, 149 insertions, 57 deletions
diff --git a/manifests/haproxy.pp b/manifests/haproxy.pp
index 4bbe1d6..1c3daac 100644
--- a/manifests/haproxy.pp
+++ b/manifests/haproxy.pp
@@ -930,6 +930,7 @@ class tripleo::haproxy (
'set-header X-Forwarded-Proto http if !{ ssl_fc }'],
},
service_network => $glance_api_network,
+ member_options => union($haproxy_member_options, $internal_tls_member_options),
}
}
diff --git a/manifests/profile/base/glance/api.pp b/manifests/profile/base/glance/api.pp
index 8945fff..6134a87 100644
--- a/manifests/profile/base/glance/api.pp
+++ b/manifests/profile/base/glance/api.pp
@@ -22,10 +22,39 @@
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('bootstrap_nodeid')
#
+# [*certificates_specs*]
+# (Optional) The specifications to give to certmonger for the certificate(s)
+# it will create.
+# Example with hiera:
+# apache_certificates_specs:
+# httpd-internal_api:
+# hostname: <overcloud controller fqdn>
+# service_certificate: <service certificate path>
+# service_key: <service key path>
+# principal: "haproxy/<overcloud controller fqdn>"
+# Defaults to hiera('apache_certificate_specs', {}).
+#
+# [*enable_internal_tls*]
+# (Optional) Whether TLS in the internal network is enabled or not.
+# Defaults to hiera('enable_internal_tls', false)
+#
+# [*generate_service_certificates*]
+# (Optional) Whether or not certmonger will generate certificates for
+# HAProxy. This could be as many as specified by the $certificates_specs
+# variable.
+# Note that this doesn't configure the certificates in haproxy, it merely
+# creates the certificates.
+# Defaults to hiera('generate_service_certificate', false).
+#
# [*glance_backend*]
# (Optional) Glance backend(s) to use.
# Defaults to downcase(hiera('glance_backend', 'swift'))
#
+# [*glance_network*]
+# (Optional) The network name where the glance endpoint is listening on.
+# This is set by t-h-t.
+# Defaults to hiera('glance_api_network', undef)
+#
# [*glance_nfs_enabled*]
# (Optional) Whether to use NFS mount as 'file' backend storage location.
# Defaults to false
@@ -42,15 +71,22 @@
# [*rabbit_port*]
# IP port for rabbitmq service
# Defaults to hiera('glance::notify::rabbitmq::rabbit_port', 5672)
-
+#
class tripleo::profile::base::glance::api (
- $bootstrap_node = hiera('bootstrap_nodeid', undef),
- $glance_backend = downcase(hiera('glance_backend', 'swift')),
- $glance_nfs_enabled = false,
- $step = hiera('step'),
- $rabbit_hosts = hiera('rabbitmq_node_names', undef),
- $rabbit_port = hiera('glance::notify::rabbitmq::rabbit_port', 5672),
+ $bootstrap_node = hiera('bootstrap_nodeid', undef),
+ $certificates_specs = hiera('apache_certificates_specs', {}),
+ $enable_internal_tls = hiera('enable_internal_tls', false),
+ $generate_service_certificates = hiera('generate_service_certificates', false),
+ $glance_backend = downcase(hiera('glance_backend', 'swift')),
+ $glance_network = hiera('glance_api_network', undef),
+ $glance_nfs_enabled = false,
+ $step = hiera('step'),
+ $rabbit_hosts = hiera('rabbitmq_node_names', undef),
+ $rabbit_port = hiera('glance::notify::rabbitmq::rabbit_port', 5672),
) {
+ if $enable_internal_tls and $generate_service_certificates {
+ ensure_resources('tripleo::certmonger::httpd', $certificates_specs)
+ }
if $::hostname == downcase($bootstrap_node) {
$sync_db = true
@@ -63,6 +99,27 @@ class tripleo::profile::base::glance::api (
}
if $step >= 4 or ($step >= 3 and $sync_db) {
+ if $enable_internal_tls {
+ if !$glance_network {
+ fail('glance_api_network is not set in the hieradata.')
+ }
+ $tls_certfile = $certificates_specs["httpd-${glance_network}"]['service_certificate']
+ $tls_keyfile = $certificates_specs["httpd-${glance_network}"]['service_key']
+
+ ::tripleo::tls_proxy { 'glance-api':
+ servername => hiera("fqdn_${glance_network}"),
+ ip => hiera('glance::api::bind_host'),
+ port => hiera('glance::api::bind_port'),
+ tls_cert => $tls_certfile,
+ tls_key => $tls_keyfile,
+ notify => Class['::glance::api'],
+ }
+ # TODO(jaosorior): Remove this when we pass it via t-h-t
+ $bind_host = 'localhost'
+ } else {
+ # TODO(jaosorior): Remove this when we pass it via t-h-t
+ $bind_host = hiera('glance::api::bind_host')
+ }
case $glance_backend {
'swift': { $backend_store = 'glance.store.swift.Store' }
'file': { $backend_store = 'glance.store.filesystem.Store' }
@@ -75,9 +132,11 @@ class tripleo::profile::base::glance::api (
# TODO: notifications, scrubber, etc.
include ::glance
include ::glance::config
+ # TODO(jaosorior): Remove bind_host when we set it up conditionally in t-h-t
class { '::glance::api':
- stores => $glance_store,
- sync_db => $sync_db,
+ bind_host => $bind_host,
+ stores => $glance_store,
+ sync_db => $sync_db,
}
$rabbit_endpoints = suffix(any2array($rabbit_hosts), ":${rabbit_port}")
class { '::glance::notify::rabbitmq' :
diff --git a/manifests/profile/base/metrics/collectd.pp b/manifests/profile/base/metrics/collectd.pp
index 0f738d1..d8e6f89 100644
--- a/manifests/profile/base/metrics/collectd.pp
+++ b/manifests/profile/base/metrics/collectd.pp
@@ -1,13 +1,27 @@
+# Copyright 2016 Red Hat, 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.
+#
# == Class: tripleo::profile::base::metrics::collectd
#
# Collectd configuration for TripleO
#
# === Parameters
#
-# [*collectd_plugins*]
-# (Optional) List. A list of collectd plugins to configure (the
-# corresponding collectd::plugin::NAME class must exist in the
-# collectd package).
+# [*step*]
+# (Optional) The current step in deployment. See tripleo-heat-templates
+# for more details.
+# Defaults to hiera('step')
#
# [*collectd_server*]
# (Optional) String. The name or address of a collectd server to
@@ -28,61 +42,62 @@
# [*collectd_securitylevel*]
# (Optional) String.
#
-# [*collectd_interface*]
-# (Optional) String. Name of a network interface.
-#
-# [*collectd_graphite_server*]
-# (Optional) String. The name or address of a graphite server to
-# which we should send metrics.
-#
-# [*collectd_graphite_port*]
-# (Optional) Integer. This is the port to which we will connect on
-# the graphite server. Defaults to 2004.
-#
-# [*collectd_graphite_prefix*]
-# (Optional) String. Prefix to add to metric names. Defaults to
-# 'overcloud.'.
-#
-# [*collectd_graphite_protocol*]
-# (Optional) String. One of 'udp' or 'tcp'.
-#
+# [*service_names*]
+# (Optional) List of strings. A list of active services in this tripleo
+# deployment. This is used to look up service-specific plugins that
+# need to be installed.
class tripleo::profile::base::metrics::collectd (
- $collectd_plugins = [],
+ $step = hiera('step'),
$collectd_server = undef,
- $collectd_port = 25826,
+ $collectd_port = undef,
$collectd_username = undef,
$collectd_password = undef,
$collectd_securitylevel = undef,
-
- $collectd_graphite_server = undef,
- $collectd_graphite_port = 2004,
- $collectd_graphite_prefix = undef,
- $collectd_graphite_protocol = 'udp'
+ $service_names = hiera('service_names', [])
) {
- include ::collectd
- ::tripleo::profile::base::metrics::collectd::plugin_helper { $collectd_plugins: }
+ if $step >= 3 {
+ include ::collectd
- if ! ($collectd_graphite_protocol in ['udp', 'tcp']) {
- fail("collectd_graphite_protocol must be one of 'udp' or 'tcp'")
- }
+ if ! ($collectd_securitylevel in [undef, 'None', 'Sign', 'Encrypt']) {
+ fail('collectd_securitylevel must be one of (None, Sign, Encrypt).')
+ }
+
+ # Load per-service plugin configuration
+ ::tripleo::profile::base::metrics::collectd::collectd_service {
+ $service_names: }
+
+ # Because THT doesn't allow us to default values to undef, we need
+ # to perform a number of transformations here to avoid passing a bunch of
+ # empty strings to the collectd plugins.
- if $collectd_server {
- ::collectd::plugin::network::server { $collectd_server:
- username => $collectd_username,
- password => $collectd_password,
- port => $collectd_port,
- securitylevel => $collectd_securitylevel,
+ $_collectd_username = empty($collectd_username) ? {
+ true => undef,
+ default => $collectd_username
+ }
+
+ $_collectd_password = empty($collectd_password) ? {
+ true => undef,
+ default => $collectd_password
}
- }
- if $collectd_graphite_server {
- ::collectd::plugin::write_graphite::carbon { 'openstack_graphite':
- graphitehost => $collectd_graphite_server,
- graphiteport => $collectd_graphite_port,
- graphiteprefix => $collectd_graphite_prefix,
- protocol => $collectd_graphite_protocol,
+ $_collectd_port = empty($collectd_port) ? {
+ true => undef,
+ default => $collectd_port
+ }
+
+ $_collectd_securitylevel = empty($collectd_securitylevel) ? {
+ true => undef,
+ default => $collectd_securitylevel
+ }
+
+ if ! empty($collectd_server) {
+ ::collectd::plugin::network::server { $collectd_server:
+ username => $_collectd_username,
+ password => $_collectd_password,
+ port => $_collectd_port,
+ securitylevel => $_collectd_securitylevel,
+ }
}
}
}
-
diff --git a/manifests/profile/base/metrics/collectd/collectd_plugin.pp b/manifests/profile/base/metrics/collectd/collectd_plugin.pp
new file mode 100644
index 0000000..5ab940b
--- /dev/null
+++ b/manifests/profile/base/metrics/collectd/collectd_plugin.pp
@@ -0,0 +1,6 @@
+# We use this to transform a list of unqualified plugin names
+# (like ['disk', 'ntpd']) into the correct collectd plugin classes.
+define tripleo::profile::base::metrics::collectd::collectd_plugin (
+) {
+ include "collectd::plugin::${title}"
+}
diff --git a/manifests/profile/base/metrics/collectd/collectd_service.pp b/manifests/profile/base/metrics/collectd/collectd_service.pp
new file mode 100644
index 0000000..c1b3a60
--- /dev/null
+++ b/manifests/profile/base/metrics/collectd/collectd_service.pp
@@ -0,0 +1,11 @@
+# This is used to look up a list of service-specific collectd plugins
+# in the hiera data provided by THT.
+define tripleo::profile::base::metrics::collectd::collectd_service (
+) {
+ $plugins = hiera("tripleo.collectd.plugins.${title}", [])
+
+ if $plugins {
+ ::tripleo::profile::base::metrics::collectd::collectd_plugin {
+ $plugins: }
+ }
+}