Merge ~ballot/charm-k8s-mm-pd-bot/+git/charm-k8s-mm-pd-bot:rework_ssl into charm-k8s-mm-pd-bot:master

Proposed by Benjamin Allot
Status: Merged
Approved by: Junien F
Approved revision: 48b8a7b894fbb1513d240ae74eb14c9bcd4b6e4b
Merged at revision: cff66fee7a770e12ba2419d5c8e4c97f7acf4f4a
Proposed branch: ~ballot/charm-k8s-mm-pd-bot/+git/charm-k8s-mm-pd-bot:rework_ssl
Merge into: charm-k8s-mm-pd-bot:master
Diff against target: 31 lines (+6/-7)
1 file modified
src/charm.py (+6/-7)
Reviewer Review Type Date Requested Status
Junien F Approve
Canonical IS Reviewers Pending
Review via email: mp+389231@code.launchpad.net

Commit message

Rework SSL. When tls_secret_name is set, terminate SSL on the ingress

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
Junien F (axino) wrote :

+1

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

Change successfully merged at revision cff66fee7a770e12ba2419d5c8e4c97f7acf4f4a

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/charm.py b/src/charm.py
2index 8161913..4de6b21 100755
3--- a/src/charm.py
4+++ b/src/charm.py
5@@ -171,9 +171,9 @@ class MmPdBotK8sCharm(CharmBase):
6 hostname = self.bot_config.get('httpd', 'hostname')
7 container_port = self.bot_config.getint('httpd', 'listen-port')
8 magic_uuid = self.bot_config.get('httpd', 'magic-uuid')
9- ssl = self.bot_config.getboolean('httpd', 'ssl', fallback=False)
10+ tls_secret_name = self.model.config.get('tls_secret_name', None)
11
12- if ssl:
13+ if tls_secret_name:
14 scheme = "https"
15 else:
16 scheme = "http"
17@@ -200,11 +200,10 @@ class MmPdBotK8sCharm(CharmBase):
18 ]
19 },
20 }
21- if ssl:
22- ingress['spec']['tls'] = [{'hosts': [bot_listening_url_parsed.hostname]}]
23- tls_secret_name = self.model.config.get('tls_secret_name', None)
24- if tls_secret_name:
25- ingress['spec']['tls'][0]['secretName'] = tls_secret_name
26+ if tls_secret_name:
27+ ingress['spec']['tls'] = [
28+ {'hosts': [bot_listening_url_parsed.hostname], 'secretName': tls_secret_name,},
29+ ]
30 else:
31 annotations['nginx.ingress.kubernetes.io/ssl-redirect'] = 'false'
32

Subscribers

People subscribed via source and target branches