Merge ~hloeung/charm-k8s-content-cache:cleanup into charm-k8s-content-cache:master

Proposed by Haw Loeung
Status: Merged
Approved by: Haw Loeung
Approved revision: 64c672e323e220d74f056c1276bb6170e96e540d
Merged at revision: 44857c01e84c717a2da2dbf2ea636c02db8f77b3
Proposed branch: ~hloeung/charm-k8s-content-cache:cleanup
Merge into: charm-k8s-content-cache:master
Diff against target: 105 lines (+33/-39)
2 files modified
.jujuignore (+2/-0)
src/charm.py (+31/-39)
Reviewer Review Type Date Requested Status
Tom Haddon Approve
🤖 prod-jenkaas-is (community) continuous-integration Approve
Canonical IS Reviewers Pending
Review via email: mp+398565@code.launchpad.net

Commit message

Tidy up reducing levels of indentation

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 prod-jenkaas-is (prod-jenkaas-is) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tom Haddon (mthaddon) wrote :

LGTM, thx

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 44857c01e84c717a2da2dbf2ea636c02db8f77b3

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.jujuignore b/.jujuignore
2index 4365792..0ad1790 100644
3--- a/.jujuignore
4+++ b/.jujuignore
5@@ -9,5 +9,7 @@
6 Makefile
7 build/
8 docker/
9+requirements.txt
10+tox.ini
11 tests/
12 __pycache__/
13diff --git a/src/charm.py b/src/charm.py
14index e8decc4..c18a9fe 100755
15--- a/src/charm.py
16+++ b/src/charm.py
17@@ -103,20 +103,15 @@ class ContentCacheCharm(CharmBase):
18 config = self.model.config
19
20 annotations = {}
21+ rules_spec = {
22+ 'host': config['site'],
23+ 'http': {
24+ 'paths': [{'path': '/', 'backend': {'serviceName': self.app.name, 'servicePort': CONTAINER_PORT}}],
25+ },
26+ }
27 ingress = {
28 'name': '{}-ingress'.format(self.app.name),
29- 'spec': {
30- 'rules': [
31- {
32- 'host': config['site'],
33- 'http': {
34- 'paths': [
35- {'path': '/', 'backend': {'serviceName': self.app.name, 'servicePort': CONTAINER_PORT}}
36- ],
37- },
38- }
39- ],
40- },
41+ 'spec': {'rules': [rules_spec]},
42 }
43
44 client_max_body_size = config.get('client_max_body_size')
45@@ -146,37 +141,34 @@ class ContentCacheCharm(CharmBase):
46
47 pod_config = self._make_pod_config()
48
49- pod_spec = {
50- 'version': 3, # otherwise resources are ignored
51- 'containers': [
52+ containers_spec = {
53+ 'name': self.app.name,
54+ 'envConfig': pod_config,
55+ 'imageDetails': image_details,
56+ 'imagePullPolicy': 'Always',
57+ 'kubernetes': {
58+ 'livenessProbe': {
59+ 'httpGet': {'path': '/', 'port': CONTAINER_PORT},
60+ 'initialDelaySeconds': 3,
61+ 'periodSeconds': 3,
62+ },
63+ 'readinessProbe': {
64+ 'httpGet': {'path': '/', 'port': CONTAINER_PORT},
65+ 'initialDelaySeconds': 3,
66+ 'periodSeconds': 3,
67+ },
68+ },
69+ 'ports': [{'containerPort': CONTAINER_PORT, 'protocol': 'TCP'}],
70+ 'volumeConfig': [
71 {
72- 'name': self.app.name,
73- 'envConfig': pod_config,
74- 'imageDetails': image_details,
75- 'imagePullPolicy': 'Always',
76- 'kubernetes': {
77- 'livenessProbe': {
78- 'httpGet': {'path': '/', 'port': CONTAINER_PORT},
79- 'initialDelaySeconds': 3,
80- 'periodSeconds': 3,
81- },
82- 'readinessProbe': {
83- 'httpGet': {'path': '/', 'port': CONTAINER_PORT},
84- 'initialDelaySeconds': 3,
85- 'periodSeconds': 3,
86- },
87- },
88- 'ports': [{'containerPort': CONTAINER_PORT, 'protocol': 'TCP'}],
89- 'volumeConfig': [
90- {
91- 'name': 'cache-volume',
92- 'mountPath': CACHE_PATH,
93- 'emptyDir': {'sizeLimit': config['cache_max_size']},
94- }
95- ],
96+ 'name': 'cache-volume',
97+ 'mountPath': CACHE_PATH,
98+ 'emptyDir': {'sizeLimit': config['cache_max_size']},
99 }
100 ],
101 }
102+ # version 3, otherwise resources are ignored
103+ pod_spec = {'version': 3, 'containers': [containers_spec]}
104
105 return pod_spec
106

Subscribers

People subscribed via source and target branches