Merge lp:~whitmo/charms/trusty/cloudfoundry/add-collector into lp:~cf-charmers/charms/trusty/cloudfoundry/trunk

Proposed by Whit Morriss
Status: Merged
Merged at revision: 161
Proposed branch: lp:~whitmo/charms/trusty/cloudfoundry/add-collector
Merge into: lp:~cf-charmers/charms/trusty/cloudfoundry/trunk
Diff against target: 200 lines (+63/-6)
9 files modified
Makefile (+1/-0)
charmgen/placements.yaml (+1/-1)
cloudfoundry/contexts.py (+24/-0)
cloudfoundry/releases.py (+1/-0)
cloudfoundry/services.py (+16/-1)
docs/debugging.rst (+8/-0)
hooks/common.py (+2/-1)
reconciler/app.py (+6/-2)
tests/test_contexts.py (+4/-1)
To merge this branch: bzr merge lp:~whitmo/charms/trusty/cloudfoundry/add-collector
Reviewer Review Type Date Requested Status
Cory Johns Pending
Review via email: mp+241628@code.launchpad.net

Description of the change

Add the collector as a service

 - add service block for collector job
 - GraphiteContext for creating relationships to graphite
 - update dependencies (esp. raindance)
 - minor tweaks to support subordinates

To post a comment you must log in.
Revision history for this message
Cory Johns (johnsca) wrote :

Inline comments, below.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2014-09-30 17:22:35 +0000
+++ Makefile 2014-11-12 22:03:54 +0000
@@ -18,6 +18,7 @@
18 rm -fr build/18 rm -fr build/
19 rm -fr dist/19 rm -fr dist/
20 rm -fr *.egg-info20 rm -fr *.egg-info
21 rm -fr .tox
2122
22clean-pyc:23clean-pyc:
23 find . -name '*.pyc' -exec rm -f {} +24 find . -name '*.pyc' -exec rm -f {} +
2425
=== modified file 'charmgen/placements.yaml'
--- charmgen/placements.yaml 2014-09-30 17:22:35 +0000
+++ charmgen/placements.yaml 2014-11-12 22:03:54 +0000
@@ -6,7 +6,7 @@
6 c: [login, uaa, mysql]6 c: [login, uaa, mysql]
7 d: [dea, hm, etcd]7 d: [dea, hm, etcd]
8 e: [loggregator, loggregator-trafficcontrol]8 e: [loggregator, loggregator-trafficcontrol]
9 f: [haproxy]9 f: [haproxy, collector]
10local:10local:
11 __default__:11 __default__:
12 constraints: arch=amd64 root-disk=20G mem=12G12 constraints: arch=amd64 root-disk=20G mem=12G
1313
=== modified file 'cloudfoundry/contexts.py'
--- cloudfoundry/contexts.py 2014-11-06 23:37:55 +0000
+++ cloudfoundry/contexts.py 2014-11-12 22:03:54 +0000
@@ -71,6 +71,29 @@
71 return data71 return data
7272
7373
74class GraphiteRelation(RelationContext):
75 name = 'carbon'
76 interface = 'tcp'
77 required_keys = 'port', 'hostname'
78
79 def is_ready(self):
80 return True
81
82 def erb_mapping(self):
83 orch = OrchestratorRelation()
84 deployment_name = 'cf'
85
86 if orch.is_ready():
87 deployment_name = orch.get_first('deployment_name')
88
89 if self.name in self: # check due to everreadiness
90 return {'collector.use_graphite': True,
91 'collector.deployment_name': deployment_name,
92 'collector.graphite.address': self.get_first('hostname'),
93 'collector.graphite.port': self.get_first('port')}
94 return {}
95
96
74class NatsRelation(RelationContext):97class NatsRelation(RelationContext):
75 name = 'nats'98 name = 'nats'
76 interface = 'nats'99 interface = 'nats'
@@ -505,6 +528,7 @@
505 def provide_data(self):528 def provide_data(self):
506 pub_key = path(hookenv.charm_dir()) / 'orchestrator-key.pub'529 pub_key = path(hookenv.charm_dir()) / 'orchestrator-key.pub'
507 result = {530 result = {
531 'deployment_name': hookenv.service_name(),
508 'artifacts_url': self.get_artifacts_url(),532 'artifacts_url': self.get_artifacts_url(),
509 'cf_version': self.get_version(),533 'cf_version': self.get_version(),
510 'ssh_key': pub_key.text(),534 'ssh_key': pub_key.text(),
511535
=== modified file 'cloudfoundry/releases.py'
--- cloudfoundry/releases.py 2014-09-30 17:22:35 +0000
+++ cloudfoundry/releases.py 2014-11-12 22:03:54 +0000
@@ -11,6 +11,7 @@
11 ('loggregator-v1', 'loggregator'),11 ('loggregator-v1', 'loggregator'),
12 ('hm9000-v1', 'hm'),12 ('hm9000-v1', 'hm'),
13 ('haproxy-v1', 'haproxy'),13 ('haproxy-v1', 'haproxy'),
14 ('collector-v1', 'collector'),
1415
15 ('cs:trusty/mysql', 'mysql'),16 ('cs:trusty/mysql', 'mysql'),
16 ('cs:~hazmat/trusty/etcd', 'etcd'),17 ('cs:~hazmat/trusty/etcd', 'etcd'),
1718
=== modified file 'cloudfoundry/services.py'
--- cloudfoundry/services.py 2014-11-06 23:37:55 +0000
+++ cloudfoundry/services.py 2014-11-12 22:03:54 +0000
@@ -362,5 +362,20 @@
362 'provided_data': [],362 'provided_data': [],
363 'required_data': [contexts.RouterRelation],363 'required_data': [contexts.RouterRelation],
364 }]364 }]
365 }365 },
366
367 'collector-v1': {
368 'service': 'collector',
369 'summary': 'collect health information on cf internal services',
370 'description': '',
371 'jobs': [{
372 'job_name': 'collector',
373 'ports': [],
374 'mapping': {},
375 'provided_data': [],
376 'required_data': [contexts.NatsRelation,
377 contexts.GraphiteRelation,
378 contexts.OrchestratorRelation]
379 }]
380 }
366}381}
367382
=== added file 'docs/debugging.rst'
--- docs/debugging.rst 1970-01-01 00:00:00 +0000
+++ docs/debugging.rst 2014-11-12 22:03:54 +0000
@@ -0,0 +1,8 @@
1==================
2 Cloud controller
3==================
4
5The cc console
6==============
7
8bin/console /var/vcap/jobs/cloud_controller_ng/config/cloud_controller_ng.yml
09
=== modified file 'hooks/common.py'
--- hooks/common.py 2014-11-06 23:37:55 +0000
+++ hooks/common.py 2014-11-12 22:03:54 +0000
@@ -14,7 +14,8 @@
14from cloudfoundry.releases import RELEASES14from cloudfoundry.releases import RELEASES
15from cloudfoundry.services import SERVICES15from cloudfoundry.services import SERVICES
16from cloudfoundry.contexts import JujuAPICredentials16from cloudfoundry.contexts import JujuAPICredentials
17from cloudfoundry.contexts import OrchestratorRelation, CloudFoundryCredentials17from cloudfoundry.contexts import OrchestratorRelation
18from cloudfoundry.contexts import CloudFoundryCredentials
18from cloudfoundry.contexts import RequiredConfig19from cloudfoundry.contexts import RequiredConfig
19from cloudfoundry.path import path20from cloudfoundry.path import path
20from cloudfoundry.utils import wait_for21from cloudfoundry.utils import wait_for
2122
=== modified file 'reconciler/app.py'
--- reconciler/app.py 2014-11-03 16:13:57 +0000
+++ reconciler/app.py 2014-11-12 22:03:54 +0000
@@ -78,10 +78,14 @@
7878
79def poll_health():79def poll_health():
80 for service_name, service in db.real['Services'].iteritems():80 for service_name, service in db.real['Services'].iteritems():
81 for unit_name, unit in service.get('Units', {}).iteritems():81 logging.debug("Poll health for %s: %s", service_name, service)
82 units = service.get('Units', {}) or {}
83 for unit_name, unit in units.iteritems():
82 unit_addr = unit.get('PublicAddress')84 unit_addr = unit.get('PublicAddress')
83 if unit_addr:85 if unit_addr:
84 tornado.ioloop.IOLoop.instance().add_callback(check_health, service_name, unit_name, unit_addr)86 loop = tornado.ioloop.IOLoop.instance()
87 loop.add_callback(check_health, service_name,
88 unit_name, unit_addr)
8589
8690
87def check_health(service_name, unit_name, unit_addr):91def check_health(service_name, unit_name, unit_addr):
8892
=== modified file 'tests/test_contexts.py'
--- tests/test_contexts.py 2014-11-04 15:36:48 +0000
+++ tests/test_contexts.py 2014-11-12 22:03:54 +0000
@@ -240,10 +240,13 @@
240 gv.return_value = 'version'240 gv.return_value = 'version'
241 gd.return_value = 'domain'241 gd.return_value = 'domain'
242 path.return_value.__div__.return_value.text.return_value = 'mock_key'242 path.return_value.__div__.return_value.text.return_value = 'mock_key'
243 result = contexts.OrchestratorRelation().provide_data()243 with mock.patch('charmhelpers.core.hookenv.service_name') as hs:
244 hs.return_value = 'cf'
245 result = contexts.OrchestratorRelation().provide_data()
244 self.assertEqual(result, {246 self.assertEqual(result, {
245 'artifacts_url': 'artifacts_url',247 'artifacts_url': 'artifacts_url',
246 'cf_version': 'version',248 'cf_version': 'version',
249 'deployment_name': 'cf',
247 'domain': 'domain',250 'domain': 'domain',
248 'ssh_key': 'mock_key',251 'ssh_key': 'mock_key',
249 })252 })
250253
=== modified file 'wheelhouse/args-0.1.0-py2-none-any.whl'
251Binary files wheelhouse/args-0.1.0-py2-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/args-0.1.0-py2-none-any.whl 2014-11-12 22:03:54 +0000 differ254Binary files wheelhouse/args-0.1.0-py2-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/args-0.1.0-py2-none-any.whl 2014-11-12 22:03:54 +0000 differ
=== removed file 'wheelhouse/boto-2.32.1-py2.py3-none-any.whl'
252Binary files wheelhouse/boto-2.32.1-py2.py3-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/boto-2.32.1-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 differ255Binary files wheelhouse/boto-2.32.1-py2.py3-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/boto-2.32.1-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 differ
=== added file 'wheelhouse/boto-2.34.0-py2.py3-none-any.whl'
253Binary files wheelhouse/boto-2.34.0-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/boto-2.34.0-py2.py3-none-any.whl 2014-11-12 22:03:54 +0000 differ256Binary files wheelhouse/boto-2.34.0-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/boto-2.34.0-py2.py3-none-any.whl 2014-11-12 22:03:54 +0000 differ
=== removed file 'wheelhouse/clint-0.3.7-py2-none-any.whl'
254Binary files wheelhouse/clint-0.3.7-py2-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/clint-0.3.7-py2-none-any.whl 1970-01-01 00:00:00 +0000 differ257Binary files wheelhouse/clint-0.3.7-py2-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/clint-0.3.7-py2-none-any.whl 1970-01-01 00:00:00 +0000 differ
=== added file 'wheelhouse/clint-0.4.1-py2-none-any.whl'
255Binary files wheelhouse/clint-0.4.1-py2-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/clint-0.4.1-py2-none-any.whl 2014-11-12 22:03:54 +0000 differ258Binary files wheelhouse/clint-0.4.1-py2-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/clint-0.4.1-py2-none-any.whl 2014-11-12 22:03:54 +0000 differ
=== added file 'wheelhouse/futures-2.2.0-py2.py3-none-any.whl'
256Binary files wheelhouse/futures-2.2.0-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/futures-2.2.0-py2.py3-none-any.whl 2014-11-12 22:03:54 +0000 differ259Binary files wheelhouse/futures-2.2.0-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/futures-2.2.0-py2.py3-none-any.whl 2014-11-12 22:03:54 +0000 differ
=== removed file 'wheelhouse/path.py-6.2-py2-none-any.whl'
257Binary files wheelhouse/path.py-6.2-py2-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/path.py-6.2-py2-none-any.whl 1970-01-01 00:00:00 +0000 differ260Binary files wheelhouse/path.py-6.2-py2-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/path.py-6.2-py2-none-any.whl 1970-01-01 00:00:00 +0000 differ
=== added file 'wheelhouse/path.py-7.0-py2-none-any.whl'
258Binary files wheelhouse/path.py-7.0-py2-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/path.py-7.0-py2-none-any.whl 2014-11-12 22:03:54 +0000 differ261Binary files wheelhouse/path.py-7.0-py2-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/path.py-7.0-py2-none-any.whl 2014-11-12 22:03:54 +0000 differ
=== removed file 'wheelhouse/raindance-0.2dev-py2-none-any.whl'
259Binary files wheelhouse/raindance-0.2dev-py2-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/raindance-0.2dev-py2-none-any.whl 1970-01-01 00:00:00 +0000 differ262Binary files wheelhouse/raindance-0.2dev-py2-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/raindance-0.2dev-py2-none-any.whl 1970-01-01 00:00:00 +0000 differ
=== added file 'wheelhouse/raindance-0.3dev_r0-py2-none-any.whl'
260Binary files wheelhouse/raindance-0.3dev_r0-py2-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/raindance-0.3dev_r0-py2-none-any.whl 2014-11-12 22:03:54 +0000 differ263Binary files wheelhouse/raindance-0.3dev_r0-py2-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/raindance-0.3dev_r0-py2-none-any.whl 2014-11-12 22:03:54 +0000 differ
=== removed file 'wheelhouse/requests-2.2.1-py2.py3-none-any.whl'
261Binary files wheelhouse/requests-2.2.1-py2.py3-none-any.whl 2014-06-25 07:08:08 +0000 and wheelhouse/requests-2.2.1-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 differ264Binary files wheelhouse/requests-2.2.1-py2.py3-none-any.whl 2014-06-25 07:08:08 +0000 and wheelhouse/requests-2.2.1-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 differ
=== removed file 'wheelhouse/requests-2.4.1-py2.py3-none-any.whl'
262Binary files wheelhouse/requests-2.4.1-py2.py3-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/requests-2.4.1-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 differ265Binary files wheelhouse/requests-2.4.1-py2.py3-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/requests-2.4.1-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 differ
=== added file 'wheelhouse/requests-2.4.3-py2.py3-none-any.whl'
263Binary files wheelhouse/requests-2.4.3-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/requests-2.4.3-py2.py3-none-any.whl 2014-11-12 22:03:54 +0000 differ266Binary files wheelhouse/requests-2.4.3-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 and wheelhouse/requests-2.4.3-py2.py3-none-any.whl 2014-11-12 22:03:54 +0000 differ
=== modified file 'wheelhouse/subparse-0.3.3-py2-none-any.whl'
264Binary files wheelhouse/subparse-0.3.3-py2-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/subparse-0.3.3-py2-none-any.whl 2014-11-12 22:03:54 +0000 differ267Binary files wheelhouse/subparse-0.3.3-py2-none-any.whl 2014-09-30 21:15:05 +0000 and wheelhouse/subparse-0.3.3-py2-none-any.whl 2014-11-12 22:03:54 +0000 differ

Subscribers

People subscribed via source and target branches