Skip to content

Commit 2130c22

Browse files
Sync docs from Discourse (#348)
* Sync charm docs from https://discourse.charmhub.io * Edit workflow file to prevent tagging Vladimir automatically as reviewer (expected to fail CLA check) Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 2eb2c2f commit 2130c22

File tree

4 files changed

+221
-33
lines changed

4 files changed

+221
-33
lines changed

docs/how-to/h-external-access.md

Lines changed: 138 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,160 @@
11
# How to connect DB from outside of Kubernetes
22

3-
To make the Charmed MySQL K8s database reachable from outside the Kubernetes cluster, this charm MySQL Router K8s should be deployed. It creates and manages several K8s services including the NodePort one:
3+
To expose a Charmed MySQL K8s database externally, this charm (MySQL Router K8s) should be deployed and related with the Charmed MySQL K8s application. Charmed MySQL Router K8s then provides a configuration option `expose-external` (with options `false`, `nodeport` and `loadbalancer`) to control precisely how the database will be externally exposed.
44

5-
```shell
6-
kubectl get services -n <model>
7-
```
5+
By default (when `expose-external=false`), Charmed MySQL Router K8s creates a K8s service of type `ClusterIP` which it provides as endpoints to the related client applications. These endpoints are only accessible from within the K8s namespace (or juju model) where the MySQL Router K8s application is deployed.
86

9-
```
10-
TODO
11-
```
7+
Below is a juju model where MySQL Router K8s is related to MySQL K8s and Data Integrator, which we will later use to demonstrate the configuration of `expose-external`:
128

13-
The `TODO` NodePort service exposes a port to access both R/W and R/O MySQL servers from outside of K8s. The charm opens NodePort if requested in relation as `external-node-connectivity: true`. Example (relate mysql-router-k8s with data-integrator):
149
```shell
15-
> juju run data-integrator/0 get-credentials
16-
...
17-
TODO
18-
```
19-
> **Note**: the relation flag `external-node-connectivity` is experimental and will be replaced in the future. Follow https://warthogs.atlassian.net/browse/DPE-5636 for more details.
10+
$ juju status --relations
11+
Model Controller Cloud/Region Version SLA Timestamp
12+
database uk8s-3-6-1 microk8s/localhost 3.6.1 unsupported 14:39:08Z
2013

21-
> **Note**: The `mysql-router-k8s` and `mysql-router-k8s-endpoints` ClusterIP services seen above are created for every Juju application by default as part of the StatefulSet they are associated with. These services are not relevant to users and can be safely ignored.
14+
App Version Status Scale Charm Channel Rev Address Exposed Message
15+
data-integrator active 1 data-integrator latest/stable 78 10.152.183.44 no
16+
mysql-k8s 8.0.39-0ubuntu0.22.04.1 active 1 mysql-k8s 8.0/candidate 210 10.152.183.143 no
17+
mysql-router-k8s 8.0.39-0ubuntu0.22.04.1 active 1 mysql-router-k8s 8.0/candidate 531 10.152.183.201 no
2218

23-
## Client connections using the bootstrap service
19+
Unit Workload Agent Address Ports Message
20+
data-integrator/0* active idle 10.1.241.219
21+
mysql-k8s/0* active idle 10.1.241.217 Primary
22+
mysql-router-k8s/0* active idle 10.1.241.218
2423

25-
A client can be configured to connect to the `TODO` service using a Kubernetes NodeIP, and desired NodePort.
24+
Integration provider Requirer Interface Type Message
25+
data-integrator:data-integrator-peers data-integrator:data-integrator-peers data-integrator-peers peer
26+
mysql-k8s:database mysql-router-k8s:backend-database mysql_client regular
27+
mysql-k8s:database-peers mysql-k8s:database-peers mysql_peers peer
28+
mysql-k8s:restart mysql-k8s:restart rolling_op peer
29+
mysql-k8s:upgrade mysql-k8s:upgrade upgrade peer
30+
mysql-router-k8s:cos mysql-router-k8s:cos cos peer
31+
mysql-router-k8s:database data-integrator:mysql mysql_client regular
32+
mysql-router-k8s:mysql-router-peers mysql-router-k8s:mysql-router-peers mysql_router_peers peer
33+
mysql-router-k8s:upgrade-version-a mysql-router-k8s:upgrade-version-a upgrade peer
34+
```
2635

27-
To get NodeIPs:
36+
When `expose-external=false`, the following shows the endpoints returned to the client:
2837

2938
```shell
30-
kubectl get nodes -o wide -n model | awk -v OFS='\t\t' '{print $1, $6}'
39+
$ juju run data-integrator/0 get-credentials
40+
mysql:
41+
data: '{"database": "test-database", "external-node-connectivity": "true", "requested-secrets":
42+
"[\"username\", \"password\", \"tls\", \"tls-ca\", \"uris\"]"}'
43+
database: test-database
44+
endpoints: mysql-router-k8s-service.database.svc.cluster.local:6446
45+
password: VRLNoVx6Br4Vn5SNHdoMK52Q
46+
read-only-endpoints: mysql-router-k8s-service.database.svc.cluster.local:6447
47+
username: relation-7_4fc92c2813524d6-8
48+
ok: "True"
3149
```
3250

33-
```
34-
NAME INTERNAL-IP
35-
node-0 10.155.67.110
36-
node-1 10.155.67.120
37-
node-2 10.155.67.130
51+
The following shows a mysql client connecting to the the provided endpoints from the data integrator unit (which is deployed in the same K8s namespace, i.e. the same juju model, as MySQL Router K8s):
52+
53+
```shell
54+
$ juju ssh data-integrator/0 bash
55+
root@data-integrator-0:/var/lib/juju# mysql -h mysql-router-k8s-service.database.svc.cluster.local -P 6446 -u relation-7_4fc92c2813524d6-8 -pVRLNoVx6Br4Vn5SNHdoMK52Q
56+
mysql> show databases;
57+
+--------------------+
58+
| Database |
59+
+--------------------+
60+
| information_schema |
61+
| performance_schema |
62+
| test-database |
63+
+--------------------+
64+
3 rows in set (0.01 sec)
65+
66+
mysql> exit;
67+
Bye
68+
root@data-integrator-0:/var/lib/juju# mysql -h mysql-router-k8s-service.database.svc.cluster.local -P 6447 -u relation-7_4fc92c2813524d6-8 -pVRLNoVx6Br4Vn5SNHdoMK52Q
69+
mysql> show databases;
70+
+--------------------+
71+
| Database |
72+
+--------------------+
73+
| information_schema |
74+
| performance_schema |
75+
| test-database |
76+
+--------------------+
77+
3 rows in set (0.01 sec)
3878
```
3979

40-
NodeIPs are different for each deployment as they are randomly allocated.
41-
For the example from the previous section, the created NodePorts was:
80+
## External Access
81+
82+
MySQL Router K8s can be made externally accessible by setting `expose-external=nodeport` (corresponding to K8s NodePort service) or `expose-external=loadbalancer` (corresponding to K8s LoadBalancer service).
83+
84+
When `expose-external=nodeport`, MySQL Router K8s will provide as endpoints comma-separated node:port values of the nodes where the MySQL Router K8s units are scheduled.
4285

4386
```shell
44-
TODO
87+
$ juju run data-integrator/0 get-credentials
88+
mysql:
89+
data: '{"database": "test-database", "external-node-connectivity": "true", "requested-secrets":
90+
"[\"username\", \"password\", \"tls\", \"tls-ca\", \"uris\"]"}'
91+
database: test-database
92+
endpoints: 10.0.0.44:31604
93+
password: VRLNoVx6Br4Vn5SNHdoMK52Q
94+
read-only-endpoints: 10.0.0.44:31907
95+
username: relation-7_4fc92c2813524d6-8
96+
ok: "True"
97+
98+
$ charmed-mysql.mysql -h 10.0.0.44 -P 31604 -u relation-7_4fc92c2813524d6-8 -pVRLNoVx6Br4Vn5SNHdoMK52Q
99+
mysql> show databases;
100+
+--------------------+
101+
| Database |
102+
+--------------------+
103+
| information_schema |
104+
| performance_schema |
105+
| test-database |
106+
+--------------------+
107+
3 rows in set (0.00 sec)
108+
109+
$ charmed-mysql.mysql -h 10.0.0.44 -P 31907 -u relation-7_4fc92c2813524d6-8 -pVRLNoVx6Br4Vn5SNHdoMK52Q
110+
mysql> show databases;
111+
+--------------------+
112+
| Database |
113+
+--------------------+
114+
| information_schema |
115+
| performance_schema |
116+
| test-database |
117+
+--------------------+
118+
3 rows in set (0.00 sec)
45119
```
46120

47-
Users can use this NodePort to access read-write / Primary server from outside of K8s:
121+
Similarly, when `expose-external=loadbalancer`, MySQL Router K8s will provide as endpoints comma-separated node:port values of the load balancer nodes associated with the MySQL Router K8s service.
122+
48123
```shell
49-
TODO
124+
$ juju run data-integrator/0 get-credentials
125+
mysql:
126+
data: '{"database": "test-database", "external-node-connectivity": "true", "requested-secrets":
127+
"[\"username\", \"password\", \"tls\", \"tls-ca\", \"uris\"]"}'
128+
database: test-database
129+
endpoints: 10.0.0.44:6446
130+
password: VRLNoVx6Br4Vn5SNHdoMK52Q
131+
read-only-endpoints: 10.0.0.44:6447
132+
username: relation-7_4fc92c2813524d6-8
133+
ok: "True"
134+
135+
$ charmed-mysql.mysql -h 10.0.0.44 -P 6446 -u relation-7_4fc92c2813524d6-8 -pVRLNoVx6Br4Vn5SNHdoMK52Q
136+
mysql> show databases;
137+
+--------------------+
138+
| Database |
139+
+--------------------+
140+
| information_schema |
141+
| performance_schema |
142+
| test-database |
143+
+--------------------+
144+
3 rows in set (0.00 sec)
145+
146+
$ charmed-mysql.mysql -h 10.0.0.44 -P 6447 -u relation-7_4fc92c2813524d6-8 -pVRLNoVx6Br4Vn5SNHdoMK52Q
147+
mysql> show databases;
148+
+--------------------+
149+
| Database |
150+
+--------------------+
151+
| information_schema |
152+
| performance_schema |
153+
| test-database |
154+
+--------------------+
155+
3 rows in set (0.00 sec)
50156
```
51-
Read-only servers can be accessed using the `_readonly` suffix to the desired DB name:
52-
```shell
53-
TODO
54-
```
157+
158+
[note]
159+
**Note**: The K8s service created by MySQL Router K8s is owned by the K8s StatefulSet that represents the MySQL Router K8s juju application. Thus, the K8s service is cleaned up when the MySQL Router K8s application is removed.
160+
[/note]

docs/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ This MySQL Router K8s charm is an official distribution of MySQL Router. It’s
5656
| 2 | h-contribute | [Contribute](/t/14528) |
5757
| 1 | reference | [Reference]() |
5858
| 2 | r-releases-group | [Release Notes](/t/12201) |
59+
| 3 | r-releases-rev531 | [Revision 530/531](/t/16134) |
5960
| 3 | r-releases-rev155 | [Revision 154/155](/t/15354) |
6061
| 3 | r-releases-rev117 | [Revision 117](/t/14074) |
6162
| 3 | r-releases-rev96 | [Revision 96](/t/13523) |
@@ -72,7 +73,6 @@ This MySQL Router K8s charm is an official distribution of MySQL Router. It’s
7273
[/details]
7374

7475

75-
7676
# Redirects
7777

7878
[details=Mapping table]

docs/reference/r-releases-group.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Canonical publishes here release notes for production ready revisions available in [CharmHub](https://charmhub.io) [channels](https://juju.is/docs/sdk/channel):
44

5+
* [revision 530/531](/t/16134) in `8.0/stable`
56
* [revision 154/155](/t/15354) in `8.0/stable`
67
* [revision 117](/t/14074) in `8.0/stable`
78
* [revision 96](/t/13523) in `8.0/stable`

docs/reference/r-releases-rev531.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
> Reference > Release Notes > [All revisions] > Revision 530/531
2+
3+
# Revision 530/531
4+
<sub>January 6, 2025</sub>
5+
6+
Dear community,
7+
8+
Canonical's newest Charmed MySQL Router K8s operator has been published in the [8.0/stable channel]:
9+
* Revision 531 is built for `amd64` on Ubuntu 22.04 LTS
10+
* Revision 530 is built for `arm64` on Ubuntu 22.04 LTS
11+
12+
If you are jumping over several stable revisions, check [previous release notes][All revisions] before upgrading.
13+
14+
---
15+
16+
## Highlights
17+
* Updated MySQL Router to `v8.0.39` ([PR #308](https://github.com/canonical/mysql-router-k8s-operator/pull/308)) ([DPE-4573](https://warthogs.atlassian.net/browse/DPE-4573))
18+
* Add K8s LoadBalancer support via [expose-external](https://charmhub.io/mysql-router-k8s/configurations?channel=8.0/candidate#expose-external) config option ([PR #328](https://github.com/canonical/mysql-router-k8s-operator/pull/328)) ([DPE-5637](https://warthogs.atlassian.net/browse/DPE-5637))
19+
20+
## Features and improvements
21+
* Add [COS Tracing](/t/14553) support using [Tempo K8s coordinator](https://charmhub.io/tempo-coordinator-k8s) ([PR #324](https://github.com/canonical/mysql-router-k8s-operator/pull/324)) ([DPE-5312](https://warthogs.atlassian.net/browse/DPE-5312))
22+
* Truncated TLS common name to 64 characters ([PR #318](https://github.com/canonical/mysql-router-k8s-operator/pull/318))
23+
* Bumped supported juju versions ([PR #325](https://github.com/canonical/mysql-router-k8s-operator/pull/325)) ([DPE-5625](https://warthogs.atlassian.net/browse/DPE-5625))
24+
* `v2.9.50``v2.9.51`
25+
* `v3.4.5``v3.6.1`
26+
27+
<!--## Bugfixes and maintenance-->
28+
29+
[details=Libraries, testing, and CI]
30+
31+
* Switched from tox build wrapper to `charmcraft.yaml` overrides ([PR #319](https://github.com/canonical/mysql-router-k8s-operator/pull/319))
32+
* Test against juju 3.6/candidate + upgrade dpw to v23.0.5 ([PR #335](https://github.com/canonical/mysql-router-k8s-operator/pull/335))
33+
* Run juju 3.6 nightly tests against 3.6/stable ([PR #337](https://github.com/canonical/mysql-router-k8s-operator/pull/337))
34+
* Run tests on juju 3.6 on a nightly schedule ([PR #311](https://github.com/canonical/mysql-router-k8s-operator/pull/311)) ([DPE-4976](https://warthogs.atlassian.net/browse/DPE-4976))
35+
* Update canonical/charming-actions action to v2.6.3 ([PR #280](https://github.com/canonical/mysql-router-k8s-operator/pull/280))
36+
* Update data-platform-workflows to v23 ([PR #326](https://github.com/canonical/mysql-router-k8s-operator/pull/326))
37+
* Update dependency canonical/microk8s to v1.31 ([PR #316](https://github.com/canonical/mysql-router-k8s-operator/pull/316))
38+
* Update dependency cryptography to v43 [SECURITY] ([PR #317](https://github.com/canonical/mysql-router-k8s-operator/pull/317))
39+
* Update Juju agents (patch) ([PR #287](https://github.com/canonical/mysql-router-k8s-operator/pull/287))
40+
[/details]
41+
42+
## Requirements and compatibility
43+
* (increased) MySQL version: `v8.0.37``v8.0.39`
44+
* (increased) Minimum Juju 2 version: `v2.9.50``v2.9.51`
45+
* (increased) Minimum Juju 3 version: `v3.4.5``v3.6.1`
46+
47+
See the [system requirements] for more details about Juju versions and other software and hardware prerequisites.
48+
49+
### Packaging
50+
51+
This charm is based on the Charmed MySQL [rock image]. It packages:
52+
* [mysql-router] `v8.0.39`
53+
* [mysql-shell] `v8.0.38`
54+
* [prometheus-mysqlrouter-exporter] `v5.0.1`
55+
56+
See the [`/lib/charms` directory on GitHub] for more details about all supported libraries.
57+
58+
See the [`metadata.yaml` file on GitHub] for a full list of supported interfaces.
59+
60+
<!-- Topics -->
61+
[All revisions]: /t/12201
62+
[system requirements]: /t/12179
63+
64+
<!-- GitHub -->
65+
[`/lib/charms` directory on GitHub]: https://github.com/canonical/mysql-router-k8s-operator/tree/main/lib/charms
66+
[`metadata.yaml` file on GitHub]: https://github.com/canonical/mysql-router-k8s-operator/blob/main/metadata.yaml
67+
68+
<!-- Charmhub -->
69+
[8.0/stable channel]: https://charmhub.io/mysql-router?channel=8.0/stable
70+
71+
<!-- Snap/Rock -->
72+
[`charmed-mysql-router` packaging]: https://github.com/canonical/charmed-mysql-router-rock
73+
74+
[MySQL Libraries tab]: https://charmhub.io/mysql/libraries
75+
76+
[snap]: https://github.com/canonical/charmed-mysql-snap/releases/tag/rev114
77+
[rock image]: https://github.com/canonical/charmed-mysql-rock/pkgs/container/charmed-mysql
78+
79+
[mysql-router]: https://launchpad.net/ubuntu/+source/mysql-8.0/
80+
[mysql-shell]: https://launchpad.net/~data-platform/+archive/ubuntu/mysql-shell
81+
[prometheus-mysqlrouter-exporter]: https://launchpad.net/~data-platform/+archive/ubuntu/mysqlrouter-exporter

0 commit comments

Comments
 (0)