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
1=== modified file 'Makefile'
2--- Makefile 2014-09-30 17:22:35 +0000
3+++ Makefile 2014-11-12 22:03:54 +0000
4@@ -18,6 +18,7 @@
5 rm -fr build/
6 rm -fr dist/
7 rm -fr *.egg-info
8+ rm -fr .tox
9
10 clean-pyc:
11 find . -name '*.pyc' -exec rm -f {} +
12
13=== modified file 'charmgen/placements.yaml'
14--- charmgen/placements.yaml 2014-09-30 17:22:35 +0000
15+++ charmgen/placements.yaml 2014-11-12 22:03:54 +0000
16@@ -6,7 +6,7 @@
17 c: [login, uaa, mysql]
18 d: [dea, hm, etcd]
19 e: [loggregator, loggregator-trafficcontrol]
20- f: [haproxy]
21+ f: [haproxy, collector]
22 local:
23 __default__:
24 constraints: arch=amd64 root-disk=20G mem=12G
25
26=== modified file 'cloudfoundry/contexts.py'
27--- cloudfoundry/contexts.py 2014-11-06 23:37:55 +0000
28+++ cloudfoundry/contexts.py 2014-11-12 22:03:54 +0000
29@@ -71,6 +71,29 @@
30 return data
31
32
33+class GraphiteRelation(RelationContext):
34+ name = 'carbon'
35+ interface = 'tcp'
36+ required_keys = 'port', 'hostname'
37+
38+ def is_ready(self):
39+ return True
40+
41+ def erb_mapping(self):
42+ orch = OrchestratorRelation()
43+ deployment_name = 'cf'
44+
45+ if orch.is_ready():
46+ deployment_name = orch.get_first('deployment_name')
47+
48+ if self.name in self: # check due to everreadiness
49+ return {'collector.use_graphite': True,
50+ 'collector.deployment_name': deployment_name,
51+ 'collector.graphite.address': self.get_first('hostname'),
52+ 'collector.graphite.port': self.get_first('port')}
53+ return {}
54+
55+
56 class NatsRelation(RelationContext):
57 name = 'nats'
58 interface = 'nats'
59@@ -505,6 +528,7 @@
60 def provide_data(self):
61 pub_key = path(hookenv.charm_dir()) / 'orchestrator-key.pub'
62 result = {
63+ 'deployment_name': hookenv.service_name(),
64 'artifacts_url': self.get_artifacts_url(),
65 'cf_version': self.get_version(),
66 'ssh_key': pub_key.text(),
67
68=== modified file 'cloudfoundry/releases.py'
69--- cloudfoundry/releases.py 2014-09-30 17:22:35 +0000
70+++ cloudfoundry/releases.py 2014-11-12 22:03:54 +0000
71@@ -11,6 +11,7 @@
72 ('loggregator-v1', 'loggregator'),
73 ('hm9000-v1', 'hm'),
74 ('haproxy-v1', 'haproxy'),
75+ ('collector-v1', 'collector'),
76
77 ('cs:trusty/mysql', 'mysql'),
78 ('cs:~hazmat/trusty/etcd', 'etcd'),
79
80=== modified file 'cloudfoundry/services.py'
81--- cloudfoundry/services.py 2014-11-06 23:37:55 +0000
82+++ cloudfoundry/services.py 2014-11-12 22:03:54 +0000
83@@ -362,5 +362,20 @@
84 'provided_data': [],
85 'required_data': [contexts.RouterRelation],
86 }]
87- }
88+ },
89+
90+ 'collector-v1': {
91+ 'service': 'collector',
92+ 'summary': 'collect health information on cf internal services',
93+ 'description': '',
94+ 'jobs': [{
95+ 'job_name': 'collector',
96+ 'ports': [],
97+ 'mapping': {},
98+ 'provided_data': [],
99+ 'required_data': [contexts.NatsRelation,
100+ contexts.GraphiteRelation,
101+ contexts.OrchestratorRelation]
102+ }]
103+ }
104 }
105
106=== added file 'docs/debugging.rst'
107--- docs/debugging.rst 1970-01-01 00:00:00 +0000
108+++ docs/debugging.rst 2014-11-12 22:03:54 +0000
109@@ -0,0 +1,8 @@
110+==================
111+ Cloud controller
112+==================
113+
114+The cc console
115+==============
116+
117+bin/console /var/vcap/jobs/cloud_controller_ng/config/cloud_controller_ng.yml
118
119=== modified file 'hooks/common.py'
120--- hooks/common.py 2014-11-06 23:37:55 +0000
121+++ hooks/common.py 2014-11-12 22:03:54 +0000
122@@ -14,7 +14,8 @@
123 from cloudfoundry.releases import RELEASES
124 from cloudfoundry.services import SERVICES
125 from cloudfoundry.contexts import JujuAPICredentials
126-from cloudfoundry.contexts import OrchestratorRelation, CloudFoundryCredentials
127+from cloudfoundry.contexts import OrchestratorRelation
128+from cloudfoundry.contexts import CloudFoundryCredentials
129 from cloudfoundry.contexts import RequiredConfig
130 from cloudfoundry.path import path
131 from cloudfoundry.utils import wait_for
132
133=== modified file 'reconciler/app.py'
134--- reconciler/app.py 2014-11-03 16:13:57 +0000
135+++ reconciler/app.py 2014-11-12 22:03:54 +0000
136@@ -78,10 +78,14 @@
137
138 def poll_health():
139 for service_name, service in db.real['Services'].iteritems():
140- for unit_name, unit in service.get('Units', {}).iteritems():
141+ logging.debug("Poll health for %s: %s", service_name, service)
142+ units = service.get('Units', {}) or {}
143+ for unit_name, unit in units.iteritems():
144 unit_addr = unit.get('PublicAddress')
145 if unit_addr:
146- tornado.ioloop.IOLoop.instance().add_callback(check_health, service_name, unit_name, unit_addr)
147+ loop = tornado.ioloop.IOLoop.instance()
148+ loop.add_callback(check_health, service_name,
149+ unit_name, unit_addr)
150
151
152 def check_health(service_name, unit_name, unit_addr):
153
154=== modified file 'tests/test_contexts.py'
155--- tests/test_contexts.py 2014-11-04 15:36:48 +0000
156+++ tests/test_contexts.py 2014-11-12 22:03:54 +0000
157@@ -240,10 +240,13 @@
158 gv.return_value = 'version'
159 gd.return_value = 'domain'
160 path.return_value.__div__.return_value.text.return_value = 'mock_key'
161- result = contexts.OrchestratorRelation().provide_data()
162+ with mock.patch('charmhelpers.core.hookenv.service_name') as hs:
163+ hs.return_value = 'cf'
164+ result = contexts.OrchestratorRelation().provide_data()
165 self.assertEqual(result, {
166 'artifacts_url': 'artifacts_url',
167 'cf_version': 'version',
168+ 'deployment_name': 'cf',
169 'domain': 'domain',
170 'ssh_key': 'mock_key',
171 })
172
173=== modified file 'wheelhouse/args-0.1.0-py2-none-any.whl'
174Binary 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
175=== removed file 'wheelhouse/boto-2.32.1-py2.py3-none-any.whl'
176Binary 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
177=== added file 'wheelhouse/boto-2.34.0-py2.py3-none-any.whl'
178Binary 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
179=== removed file 'wheelhouse/clint-0.3.7-py2-none-any.whl'
180Binary 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
181=== added file 'wheelhouse/clint-0.4.1-py2-none-any.whl'
182Binary 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
183=== added file 'wheelhouse/futures-2.2.0-py2.py3-none-any.whl'
184Binary 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
185=== removed file 'wheelhouse/path.py-6.2-py2-none-any.whl'
186Binary 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
187=== added file 'wheelhouse/path.py-7.0-py2-none-any.whl'
188Binary 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
189=== removed file 'wheelhouse/raindance-0.2dev-py2-none-any.whl'
190Binary 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
191=== added file 'wheelhouse/raindance-0.3dev_r0-py2-none-any.whl'
192Binary 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
193=== removed file 'wheelhouse/requests-2.2.1-py2.py3-none-any.whl'
194Binary 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
195=== removed file 'wheelhouse/requests-2.4.1-py2.py3-none-any.whl'
196Binary 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
197=== added file 'wheelhouse/requests-2.4.3-py2.py3-none-any.whl'
198Binary 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
199=== modified file 'wheelhouse/subparse-0.3.3-py2-none-any.whl'
200Binary 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