Merge ~barryprice/charm-k8s-bind/+git/charm-k8s-bind:wrapper into ~barryprice/charm-k8s-bind/+git/charm-k8s-bind:master

Proposed by Barry Price
Status: Superseded
Proposed branch: ~barryprice/charm-k8s-bind/+git/charm-k8s-bind:wrapper
Merge into: ~barryprice/charm-k8s-bind/+git/charm-k8s-bind:master
Diff against target: 245 lines (+42/-67)
7 files modified
.jujuignore (+1/-0)
Makefile (+3/-3)
README.md (+23/-54)
dockerfile (+1/-2)
image-scripts/docker-wrapper.sh (+2/-0)
metadata.yaml (+7/-3)
tests/unit/test_charm.py (+5/-5)
Reviewer Review Type Date Requested Status
Barry Price Pending
Review via email: mp+402963@code.launchpad.net

Commit message

Convert from using both ENTRYPOINT and CMD to a single wrapper script that sets up our config and then starts the bind service

To post a comment you must log in.
287bc61... by Barry Price

Repoint shellcheck to renamed file

Unmerged commits

287bc61... by Barry Price

Repoint shellcheck to renamed file

2341d51... by Barry Price

Convert from using both ENTRYPOINT and CMD to a single wrapper script that sets up our config and then starts the bind service

062a222... by Tom Haddon

Rename charm for consistency with others

Reviewed-on: https://code.launchpad.net/~mthaddon/charm-k8s-bind/+git/charm-k8s-bind/+merge/402883
Reviewed-by: Barry Price <email address hidden>

a2bf1f0... by Tom Haddon

Update README for new charm name

5f5b4f4... by Tom Haddon

Rename charm for consistency with others

0a8dd26... by Tom Haddon

Update README and metadata.yaml to be more end-user focused

Reviewed-on: https://code.launchpad.net/~mthaddon/charm-k8s-bind/+git/charm-k8s-bind/+merge/395302
Reviewed-by: Laurent Sesques <email address hidden>

3adff97... by Tom Haddon

Update README and metadata.yaml to be more end-user focused

89e8f48... by Tom Haddon

Remove unnecessary reference to config.yaml in README

Reviewed-on: https://code.launchpad.net/~mthaddon/charm-k8s-bind/+git/charm-k8s-bind/+merge/395069
Reviewed-by: Laurent Sesques <email address hidden>

ac4ab68... by Tom Haddon

Remove unnecessary reference to config.yaml in README

ff88d40... by Barry Price

Clean up docs, and explain how to work around the recursion default

Reviewed-on: https://code.launchpad.net/~barryprice/charm-k8s-bind/+git/charm-k8s-bind/+merge/393440
Reviewed-by: Benjamin Allot <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/.jujuignore b/.jujuignore
index e8eb682..128851d 100644
--- a/.jujuignore
+++ b/.jujuignore
@@ -1,4 +1,5 @@
1*~1*~
2*.charm
2.coverage3.coverage
3.gitignore4.gitignore
4__pycache__5__pycache__
diff --git a/Makefile b/Makefile
index 6e99731..564aeb9 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ lint: blacken
1212
13# We actually use the build directory created by charmcraft,13# We actually use the build directory created by charmcraft,
14# but the .charm file makes a much more convenient sentinel.14# but the .charm file makes a much more convenient sentinel.
15unittest: bind.charm15unittest: bind-k8s.charm
16 @tox -e unit16 @tox -e unit
1717
18test: lint unittest18test: lint unittest
@@ -21,7 +21,7 @@ clean:
21 @echo "Cleaning files"21 @echo "Cleaning files"
22 @git clean -fXd22 @git clean -fXd
2323
24bind.charm: src/*.py requirements.txt24bind-k8s.charm: src/*.py requirements.txt
25 charmcraft build25 charmcraft build
2626
27image-deps:27image-deps:
@@ -30,7 +30,7 @@ image-deps:
3030
31image-lint: image-deps31image-lint: image-deps
32 @echo "Running shellcheck."32 @echo "Running shellcheck."
33 @shellcheck image-scripts/docker-entrypoint.sh33 @shellcheck image-scripts/docker-wrapper.sh
34 @shellcheck image-scripts/dns-check.sh34 @shellcheck image-scripts/dns-check.sh
3535
36image-build: image-lint36image-build: image-lint
diff --git a/README.md b/README.md
index c0b037d..3e31d97 100644
--- a/README.md
+++ b/README.md
@@ -1,74 +1,37 @@
1# Bind charm1# Bind Operator
22
3A Juju charm deploying Bind, configurable to use a git repository for its configuration files.3A Juju charm deploying Bind, configurable to use a git repository for its configuration files.
44
5## Overview5## Overview
66
7This is a k8s workload charm and can only be deployed to a Juju k8s cloud,7BIND 9 has evolved to be a very flexible, full-featured DNS system. Whatever
8attached to a controller using `juju add-k8s`.8your application is, BIND 9 probably has the required features. As the first,
9oldest, and most commonly deployed solution, there are more network engineers
10who are already familiar with BIND 9 than with any other system.
911
10This charm is not currently ready for production due to issues with providing12## Usage
11an egress to route TCP and UDP traffic to the pods. See:
1213
13https://bugs.launchpad.net/charm-k8s-bind/+bug/188974614For details on using Kubernetes with Juju [see here](https://juju.is/docs/kubernetes), and for
1415details on using Juju with MicroK8s for easy local testing [see here](https://juju.is/docs/microk8s-cloud).
15https://bugs.launchpad.net/juju/+bug/1889703
16
17## Details
18
19See config option descriptions in config.yaml.
20
21## Getting Started
22
23Notes for deploying a test setup locally using microk8s, the setup of which is
24documented here: https://juju.is/docs/microk8s-cloud
2516
17To deploy this charm in a juju k8s model:
26```18```
27juju add-model bind-test19juju deploy bind-k8s
28```20```
2921The charm will deploy bind with its stock Ubuntu package configuration, which
301. Either deploy with the default image from Dockerhub:22will forward all queries to root name servers.
31
32```
33juju deploy cs:~bind-charmers/bind
34```
352. Or optionally build your own image locally and deploy with that
36
37```
38sudo snap install charmcraft
39git clone https://git.launchpad.net/charm-k8s-bind
40cd charm-k8s-bind
41make image-build
42docker push localhost:32000/bind
43juju deploy cs:~bind-charmers/bind --config bind_image_path=localhost:32000/bind:latest bind
44
45juju wait
46juju status
47```
48
49Assuming you're using the image from dockerhub, or an image built locally from
50this repo without changes, the charm will deploy bind with its stock Ubuntu
51package configuration, which will forward all queries to root name servers.
5223
53DNSSEC is also enabled by default.24DNSSEC is also enabled by default.
5425
55Custom config can be deployed by setting the `custom_config_repo` option to26Custom config can be deployed by setting the `custom_config_repo` option to
56point to a Git repository containing a valid set of configuration files with27point to a Git repository containing a valid set of configuration files with
57which to populate the /etc/bind/ directory within the pod(s).28which to populate the `/etc/bind/` directory within the pod(s).
5829
59Since bind won't allow recursion from external clients by default, to allow30Since bind won't allow recursion from external clients by default, to allow
60easy testing, I've set up a repo with a copy of the stock config, modified to31easy testing, you can use [a repo with a copy of the stock config, modified to allow recursion from all RFC1918 networks](https://code.launchpad.net/~barryprice/junk/+git/etc-bind-stock-config-with-all-rfc1918-nets-allowed):
61allow recursion from all RFC1918 networks:
62
63https://code.launchpad.net/~barryprice/junk/+git/etc-bind-stock-config-with-all-rfc1918-nets-allowed
64
65To configure a local microk8s-deployed bind application to use this config,
66simply run:
67
68```32```
69juju config bind custom_config_repo=https://git.launchpad.net/~barryprice/junk/+git/etc-bind-stock-config-with-all-rfc1918-nets-allowed33juju config bind-k8s custom_config_repo=https://git.launchpad.net/~barryprice/junk/+git/etc-bind-stock-config-with-all-rfc1918-nets-allowed
70```34```
71
72Once the application is ready, you should be able to query the App's IP address35Once the application is ready, you should be able to query the App's IP address
73(not the Unit addresses) directly from your local machine:36(not the Unit addresses) directly from your local machine:
7437
@@ -81,10 +44,16 @@ bind-test myk8s-localhost myk8s/localhost 2.8.6 unsupported 16:44:30+07:0
81App Version Status Scale Charm Store Rev OS Address Notes44App Version Status Scale Charm Store Rev OS Address Notes
82bind bind:edge active 1 bind jujucharms 2 kubernetes 10.152.183.24645bind bind:edge active 1 bind jujucharms 2 kubernetes 10.152.183.246
8346
84Unit Workload Agent Address Ports Message47Unit Workload Agent Address Ports Message
85bind/0* active idle 10.1.25.35 53/TCP,53/UDP Pod configured48bind-k8s/0* active idle 10.1.25.35 53/TCP,53/UDP Pod configured
8649
87$ dig +short example.com @10.152.183.24650$ dig +short example.com @10.152.183.246
8893.184.216.345193.184.216.34
89$52$
90```53```
54
55## Known Issues
56
57This charm is unable to provide an ingress to route TCP and UDP traffic to the
58pods due to [LP#1889703](https://bugs.launchpad.net/juju/+bug/1889703). This is
59also being tracked as [a bug against the charm itself](https://bugs.launchpad.net/charm-k8s-bind/+bug/1889746).
diff --git a/dockerfile b/dockerfile
index 968d4fd..4215462 100644
--- a/dockerfile
+++ b/dockerfile
@@ -29,5 +29,4 @@ RUN chmod 0755 /usr/local/bin/dns-check.sh
29EXPOSE 53/udp29EXPOSE 53/udp
30EXPOSE 53/tcp30EXPOSE 53/tcp
3131
32ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]32CMD ["/usr/local/bin/docker-wrapper.sh"]
33CMD /usr/sbin/named -g -u bind -c /etc/bind/named.conf
diff --git a/image-scripts/docker-entrypoint.sh b/image-scripts/docker-wrapper.sh
34similarity index 97%33similarity index 97%
35rename from image-scripts/docker-entrypoint.sh34rename from image-scripts/docker-entrypoint.sh
36rename to image-scripts/docker-wrapper.sh35rename to image-scripts/docker-wrapper.sh
index 2ed0857..4f807e1 100644
--- a/image-scripts/docker-entrypoint.sh
+++ b/image-scripts/docker-wrapper.sh
@@ -21,3 +21,5 @@ if [ -d "${BIND_CONFDIR}" ]; then
21else21else
22 echo "Something went wrong, ${BIND_CONFDIR} does not exist, not starting";22 echo "Something went wrong, ${BIND_CONFDIR} does not exist, not starting";
23fi23fi
24
25/usr/sbin/named -g -u bind -c /etc/bind/named.conf
diff --git a/metadata.yaml b/metadata.yaml
index 12075b3..6c09e29 100644
--- a/metadata.yaml
+++ b/metadata.yaml
@@ -1,6 +1,10 @@
1name: "bind"1name: bind-k8s
2summary: "Bind"2display-name: Bind
3description: "The original, complete open source DNS implementation"3summary: The original, complete open source DNS implementation.
4docs: https://discourse.charmhub.io/t/bind-documentation-overview/3973
5description: |
6 The original, complete open source DNS implementation.
7 https://www.isc.org/bind/
4min-juju-version: 2.8.08min-juju-version: 2.8.0
5maintainers:9maintainers:
6 - https://launchpad.net/~bind-charmers <bind-charmers@lists.launchpad.net>10 - https://launchpad.net/~bind-charmers <bind-charmers@lists.launchpad.net>
diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py
index 85fe103..3938f12 100644
--- a/tests/unit/test_charm.py
+++ b/tests/unit/test_charm.py
@@ -117,7 +117,7 @@ class TestBindK8s(unittest.TestCase):
117 'version': 2,117 'version': 2,
118 'containers': [118 'containers': [
119 {119 {
120 'name': 'bind',120 'name': 'bind-k8s',
121 'imageDetails': {'imagePath': 'example.com/bind:v1'},121 'imageDetails': {'imagePath': 'example.com/bind:v1'},
122 'ports': [122 'ports': [
123 {'containerPort': 53, 'name': 'domain-tcp', 'protocol': 'TCP'},123 {'containerPort': 53, 'name': 'domain-tcp', 'protocol': 'TCP'},
@@ -137,7 +137,7 @@ class TestBindK8s(unittest.TestCase):
137 'version': 2,137 'version': 2,
138 'containers': [138 'containers': [
139 {139 {
140 'name': 'bind',140 'name': 'bind-k8s',
141 'imageDetails': {141 'imageDetails': {
142 'imagePath': 'secure.example.com/bind:v1',142 'imagePath': 'secure.example.com/bind:v1',
143 'username': 'test-user',143 'username': 'test-user',
@@ -161,7 +161,7 @@ class TestBindK8s(unittest.TestCase):
161 'version': 2,161 'version': 2,
162 'containers': [162 'containers': [
163 {163 {
164 'name': 'bind',164 'name': 'bind-k8s',
165 'imageDetails': {'imagePath': 'example.com/bind:v1'},165 'imageDetails': {'imagePath': 'example.com/bind:v1'},
166 'ports': [166 'ports': [
167 {'containerPort': 53, 'name': 'domain-tcp', 'protocol': 'TCP'},167 {'containerPort': 53, 'name': 'domain-tcp', 'protocol': 'TCP'},
@@ -181,7 +181,7 @@ class TestBindK8s(unittest.TestCase):
181 'version': 2,181 'version': 2,
182 'containers': [182 'containers': [
183 {183 {
184 'name': 'bind',184 'name': 'bind-k8s',
185 'imageDetails': {'imagePath': 'example.com/bind:v1'},185 'imageDetails': {'imagePath': 'example.com/bind:v1'},
186 'ports': [186 'ports': [
187 {'containerPort': 53, 'name': 'domain-tcp', 'protocol': 'TCP'},187 {'containerPort': 53, 'name': 'domain-tcp', 'protocol': 'TCP'},
@@ -201,7 +201,7 @@ class TestBindK8s(unittest.TestCase):
201 'version': 2,201 'version': 2,
202 'containers': [202 'containers': [
203 {203 {
204 'name': 'bind',204 'name': 'bind-k8s',
205 'imageDetails': {'imagePath': 'example.com/bind:v1'},205 'imageDetails': {'imagePath': 'example.com/bind:v1'},
206 'ports': [206 'ports': [
207 {'containerPort': 53, 'name': 'domain-tcp', 'protocol': 'TCP'},207 {'containerPort': 53, 'name': 'domain-tcp', 'protocol': 'TCP'},

Subscribers

People subscribed via source and target branches

to all changes: