Merge lp:~whitmo/charms/trusty/cloudfoundry/add-collector into lp:~cf-charmers/charms/trusty/cloudfoundry/trunk
- Trusty Tahr (14.04)
- add-collector
- Merge into 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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cory Johns | Pending | ||
Review via email: mp+241628@code.launchpad.net |
Commit message
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 : | # |
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 | 18 | rm -fr build/ | 18 | rm -fr build/ |
6 | 19 | rm -fr dist/ | 19 | rm -fr dist/ |
7 | 20 | rm -fr *.egg-info | 20 | rm -fr *.egg-info |
8 | 21 | rm -fr .tox | ||
9 | 21 | 22 | ||
10 | 22 | clean-pyc: | 23 | clean-pyc: |
11 | 23 | find . -name '*.pyc' -exec rm -f {} + | 24 | find . -name '*.pyc' -exec rm -f {} + |
12 | 24 | 25 | ||
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 | 6 | c: [login, uaa, mysql] | 6 | c: [login, uaa, mysql] |
18 | 7 | d: [dea, hm, etcd] | 7 | d: [dea, hm, etcd] |
19 | 8 | e: [loggregator, loggregator-trafficcontrol] | 8 | e: [loggregator, loggregator-trafficcontrol] |
21 | 9 | f: [haproxy] | 9 | f: [haproxy, collector] |
22 | 10 | local: | 10 | local: |
23 | 11 | __default__: | 11 | __default__: |
24 | 12 | constraints: arch=amd64 root-disk=20G mem=12G | 12 | constraints: arch=amd64 root-disk=20G mem=12G |
25 | 13 | 13 | ||
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 | 71 | return data | 71 | return data |
31 | 72 | 72 | ||
32 | 73 | 73 | ||
33 | 74 | class GraphiteRelation(RelationContext): | ||
34 | 75 | name = 'carbon' | ||
35 | 76 | interface = 'tcp' | ||
36 | 77 | required_keys = 'port', 'hostname' | ||
37 | 78 | |||
38 | 79 | def is_ready(self): | ||
39 | 80 | return True | ||
40 | 81 | |||
41 | 82 | def erb_mapping(self): | ||
42 | 83 | orch = OrchestratorRelation() | ||
43 | 84 | deployment_name = 'cf' | ||
44 | 85 | |||
45 | 86 | if orch.is_ready(): | ||
46 | 87 | deployment_name = orch.get_first('deployment_name') | ||
47 | 88 | |||
48 | 89 | if self.name in self: # check due to everreadiness | ||
49 | 90 | return {'collector.use_graphite': True, | ||
50 | 91 | 'collector.deployment_name': deployment_name, | ||
51 | 92 | 'collector.graphite.address': self.get_first('hostname'), | ||
52 | 93 | 'collector.graphite.port': self.get_first('port')} | ||
53 | 94 | return {} | ||
54 | 95 | |||
55 | 96 | |||
56 | 74 | class NatsRelation(RelationContext): | 97 | class NatsRelation(RelationContext): |
57 | 75 | name = 'nats' | 98 | name = 'nats' |
58 | 76 | interface = 'nats' | 99 | interface = 'nats' |
59 | @@ -505,6 +528,7 @@ | |||
60 | 505 | def provide_data(self): | 528 | def provide_data(self): |
61 | 506 | pub_key = path(hookenv.charm_dir()) / 'orchestrator-key.pub' | 529 | pub_key = path(hookenv.charm_dir()) / 'orchestrator-key.pub' |
62 | 507 | result = { | 530 | result = { |
63 | 531 | 'deployment_name': hookenv.service_name(), | ||
64 | 508 | 'artifacts_url': self.get_artifacts_url(), | 532 | 'artifacts_url': self.get_artifacts_url(), |
65 | 509 | 'cf_version': self.get_version(), | 533 | 'cf_version': self.get_version(), |
66 | 510 | 'ssh_key': pub_key.text(), | 534 | 'ssh_key': pub_key.text(), |
67 | 511 | 535 | ||
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 | 11 | ('loggregator-v1', 'loggregator'), | 11 | ('loggregator-v1', 'loggregator'), |
73 | 12 | ('hm9000-v1', 'hm'), | 12 | ('hm9000-v1', 'hm'), |
74 | 13 | ('haproxy-v1', 'haproxy'), | 13 | ('haproxy-v1', 'haproxy'), |
75 | 14 | ('collector-v1', 'collector'), | ||
76 | 14 | 15 | ||
77 | 15 | ('cs:trusty/mysql', 'mysql'), | 16 | ('cs:trusty/mysql', 'mysql'), |
78 | 16 | ('cs:~hazmat/trusty/etcd', 'etcd'), | 17 | ('cs:~hazmat/trusty/etcd', 'etcd'), |
79 | 17 | 18 | ||
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 | 362 | 'provided_data': [], | 362 | 'provided_data': [], |
85 | 363 | 'required_data': [contexts.RouterRelation], | 363 | 'required_data': [contexts.RouterRelation], |
86 | 364 | }] | 364 | }] |
88 | 365 | } | 365 | }, |
89 | 366 | |||
90 | 367 | 'collector-v1': { | ||
91 | 368 | 'service': 'collector', | ||
92 | 369 | 'summary': 'collect health information on cf internal services', | ||
93 | 370 | 'description': '', | ||
94 | 371 | 'jobs': [{ | ||
95 | 372 | 'job_name': 'collector', | ||
96 | 373 | 'ports': [], | ||
97 | 374 | 'mapping': {}, | ||
98 | 375 | 'provided_data': [], | ||
99 | 376 | 'required_data': [contexts.NatsRelation, | ||
100 | 377 | contexts.GraphiteRelation, | ||
101 | 378 | contexts.OrchestratorRelation] | ||
102 | 379 | }] | ||
103 | 380 | } | ||
104 | 366 | } | 381 | } |
105 | 367 | 382 | ||
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 | 1 | ================== | ||
111 | 2 | Cloud controller | ||
112 | 3 | ================== | ||
113 | 4 | |||
114 | 5 | The cc console | ||
115 | 6 | ============== | ||
116 | 7 | |||
117 | 8 | bin/console /var/vcap/jobs/cloud_controller_ng/config/cloud_controller_ng.yml | ||
118 | 0 | 9 | ||
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 | 14 | from cloudfoundry.releases import RELEASES | 14 | from cloudfoundry.releases import RELEASES |
124 | 15 | from cloudfoundry.services import SERVICES | 15 | from cloudfoundry.services import SERVICES |
125 | 16 | from cloudfoundry.contexts import JujuAPICredentials | 16 | from cloudfoundry.contexts import JujuAPICredentials |
127 | 17 | from cloudfoundry.contexts import OrchestratorRelation, CloudFoundryCredentials | 17 | from cloudfoundry.contexts import OrchestratorRelation |
128 | 18 | from cloudfoundry.contexts import CloudFoundryCredentials | ||
129 | 18 | from cloudfoundry.contexts import RequiredConfig | 19 | from cloudfoundry.contexts import RequiredConfig |
130 | 19 | from cloudfoundry.path import path | 20 | from cloudfoundry.path import path |
131 | 20 | from cloudfoundry.utils import wait_for | 21 | from cloudfoundry.utils import wait_for |
132 | 21 | 22 | ||
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 | 78 | 78 | ||
138 | 79 | def poll_health(): | 79 | def poll_health(): |
139 | 80 | for service_name, service in db.real['Services'].iteritems(): | 80 | for service_name, service in db.real['Services'].iteritems(): |
141 | 81 | for unit_name, unit in service.get('Units', {}).iteritems(): | 81 | logging.debug("Poll health for %s: %s", service_name, service) |
142 | 82 | units = service.get('Units', {}) or {} | ||
143 | 83 | for unit_name, unit in units.iteritems(): | ||
144 | 82 | unit_addr = unit.get('PublicAddress') | 84 | unit_addr = unit.get('PublicAddress') |
145 | 83 | if unit_addr: | 85 | if unit_addr: |
147 | 84 | tornado.ioloop.IOLoop.instance().add_callback(check_health, service_name, unit_name, unit_addr) | 86 | loop = tornado.ioloop.IOLoop.instance() |
148 | 87 | loop.add_callback(check_health, service_name, | ||
149 | 88 | unit_name, unit_addr) | ||
150 | 85 | 89 | ||
151 | 86 | 90 | ||
152 | 87 | def check_health(service_name, unit_name, unit_addr): | 91 | def check_health(service_name, unit_name, unit_addr): |
153 | 88 | 92 | ||
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 | 240 | gv.return_value = 'version' | 240 | gv.return_value = 'version' |
159 | 241 | gd.return_value = 'domain' | 241 | gd.return_value = 'domain' |
160 | 242 | path.return_value.__div__.return_value.text.return_value = 'mock_key' | 242 | path.return_value.__div__.return_value.text.return_value = 'mock_key' |
162 | 243 | result = contexts.OrchestratorRelation().provide_data() | 243 | with mock.patch('charmhelpers.core.hookenv.service_name') as hs: |
163 | 244 | hs.return_value = 'cf' | ||
164 | 245 | result = contexts.OrchestratorRelation().provide_data() | ||
165 | 244 | self.assertEqual(result, { | 246 | self.assertEqual(result, { |
166 | 245 | 'artifacts_url': 'artifacts_url', | 247 | 'artifacts_url': 'artifacts_url', |
167 | 246 | 'cf_version': 'version', | 248 | 'cf_version': 'version', |
168 | 249 | 'deployment_name': 'cf', | ||
169 | 247 | 'domain': 'domain', | 250 | 'domain': 'domain', |
170 | 248 | 'ssh_key': 'mock_key', | 251 | 'ssh_key': 'mock_key', |
171 | 249 | }) | 252 | }) |
172 | 250 | 253 | ||
173 | === modified file 'wheelhouse/args-0.1.0-py2-none-any.whl' | |||
174 | 251 | Binary 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 | 254 | Binary 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' | |||
176 | 252 | Binary 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 | 255 | Binary 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' | |||
178 | 253 | Binary 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 | 256 | Binary 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' | |||
180 | 254 | Binary 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 | 257 | Binary 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' | |||
182 | 255 | Binary 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 | 258 | Binary 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' | |||
184 | 256 | Binary 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 | 259 | Binary 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' | |||
186 | 257 | Binary 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 | 260 | Binary 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' | |||
188 | 258 | Binary 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 | 261 | Binary 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' | |||
190 | 259 | Binary 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 | 262 | Binary 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' | |||
192 | 260 | Binary 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 | 263 | Binary 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' | |||
194 | 261 | Binary 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 | 264 | Binary 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' | |||
196 | 262 | Binary 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 | 265 | Binary 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' | |||
198 | 263 | Binary 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 | 266 | Binary 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' | |||
200 | 264 | Binary 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 | 267 | Binary 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 |
Inline comments, below.