Skip to content
This repository was archived by the owner on May 28, 2021. It is now read-only.

Commit ce721f9

Browse files
author
bcurrerb
committed
Moved custom mysql server image from operator spec to cluster spec
1 parent e0a5ded commit ce721f9

File tree

10 files changed

+60
-351
lines changed

10 files changed

+60
-351
lines changed

docs/development.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ in the format of `$USER-TIMESTAMP`. This will need to be remembered as this is
2020
needed for a latter step or can be exported as the `$MYSQL_AGENT_VERSION`
2121
envrionment variable.
2222

23+
```bash
24+
$ export MYSQL_AGENT_VERSION=$(cat dist/version.txt)
25+
```
26+
2327
## Create a namespace
2428

2529
Create the namespace that the operator will reside in. By default this is
@@ -38,11 +42,13 @@ ServiceAccounts, ClusterRoles, and ClusterRoleBindings for the operator to
3842
function.
3943

4044
```bash
41-
$ kubectl -n $USER apply \
42-
-f contrib/manifests/custom-resource-definitions.yaml \
43-
-f contrib/manifests/rbac.yaml
44-
$ sed -e "s/<NAMESPACE>/${USER}/g" \
45-
contrib/manifests/role-binding-template.yaml | kubectl -n $USER apply -f -
45+
$ kubectl -n $USER apply -f contrib/manifests/custom-resource-definitions.yaml
46+
```
47+
```bash
48+
$ sed -e "s/<NAMESPACE>/${USER}/g" contrib/manifests/rbac.yaml | kubectl -n $USER apply -f -
49+
```
50+
```bash
51+
$ sed -e "s/<NAMESPACE>/${USER}/g" contrib/manifests/role-binding-template.yaml | kubectl -n $USER apply -f -
4652
```
4753

4854
### Run the MySQL Operator
@@ -54,9 +60,6 @@ development purposes.
5460
$ make run-dev
5561
```
5662

57-
If you did not set an envrionment variable previously, prefix this command with
58-
`MYSQL_AGENT_VERSION=` followed by the $USER-TIMESTAMP fortmatted version.
59-
6063
## Creating an InnoDB cluster
6164

6265
For the purpose of this document, we will create a cluster with 3 members with

docs/enterprise-edition-example.md

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,53 @@
22
This tutorial will explain how to create a mysqlcluster that runs the enterprise version of mysql.
33

44
## Prerequisites
5-
- A Kubernetes Cluster running on Kubernetes 1.7.0+.
5+
66
- The mysql-operator repository checked out locally.
77
- Access to a Docker registry that contains the enterprise version of mysql.
88

9-
## Create the Operator
10-
This file bundles the creation of various resources:
9+
## 01 - Create the Operator
10+
You will need to create the following:
1111

1212
1. Custom resources
1313
2. RBAC configuration <sup>*</sup>
1414
3. The Operator
15-
4. The Agent
15+
4. The Agent ServiceAccount & RoleBinding
1616

17-
Section 3 of the file pulls the sql enterprise image from the docker store: `store/oracle/mysql-enterprise-server`. If you wish to pull the image from somewhere else you will need to swap out this address.
18-
```
19-
kubectl apply -f examples/example-enterprise-deployment.yaml
20-
```
17+
The creation of these resources can be achieved by following the [introductory tutorial][1]; return here before creating a MySQL Cluster.
2118

22-
## Create a secret with registry credentials
19+
## 02 - Create a secret with registry credentials
2320
To be able to pull the mysql enterprise edition from docker it is necessary to provide credentials, these credentials must be supplied in the form of a Kubernetes secret.
2421

25-
- The name of the secret `myregistrykey` must match the name in the `imagepullsecrets` which is found in Section 3 of the `example-enterprise-deployment.yaml`.
26-
- The secret must be created in the same namespace as the mysqlcluster which we will make in the next step.
22+
- The name of the secret `myregistrykey` must match the name in the `imagepullsecrets` which we will specify in the cluster config in step 03.
23+
- The secret must be created in the same namespace as the MySQL Cluster which we will make in step 03. It must also be in the same namespace as the RBAC permissions created in step 01.
2724
- If you are pulling the mysql enterprise image from a different registry then the secret must contain the relevant credentials for that registry.
2825

2926
>For alternative ways to create Kubernetes secretes see their documentation on [creating secrets from docker configs](https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod) or [creating secrets manually](https://kubernetes.io/docs/concepts/containers/images/#creating-a-secret-with-a-docker-config).
3027
31-
Enter your credentials into the following command and execute it to create a Kubernetes secret that will enable pulling images from the Docker store.
28+
Enter your credentials into the following command and execute it to create a Kubernetes secret that will enable pulling images from the Docker store. add the `-n` flag to specify a namespace if you do not want to use the default namespace.
3229
```
3330
kubectl create secret docker-registry myregistrykey \
3431
--docker-server=https://index.docker.io/v1/ \
3532
--docker-username= \
3633
--docker-password= \
3734
--docker-email=
3835
```
39-
## Create your mysqlcluster
40-
Finally, create the mysqlcluster.
36+
## 03 - Create your MySQL Cluster
37+
Finally, create your MySQL Cluster with the required specifications entered under `spec:`
4138

42-
- The version to be used has been specified in the file. Without this a default version is used which is **not** guaranteed to match an available image of mysql enterprise.
43-
- The lowest version supported by the mysql operator is **8.0.11**
44-
- The namespace of the cluster must match the namespace of the secret we created in the previous step. This file omits namespace in the metadata so the cluster will be created in the default namespace.
39+
- The mysqlServer field should be the path to a registry containing the enterprise edition of MySQL.
40+
- The imagePullSecret: name: Should be the name of a Kubernetes secret in the same namespace that contains your credentials for the docker registry.
41+
- The version to be used must be specified, without this, a default version is used which is **not** guaranteed to match an available image of MySQL Enterprise.
42+
- The namespace of the cluster must match the namespace of the secret we created in step 02.
4543
```
46-
kubectl apply -f examples/cluster/cluster-with-3-members-enterprise-version.yaml
44+
kubectl apply -f examples/cluster/cluster-enterprise-version.yaml
4745
```
48-
You can now run the following command to see the newly created mysql cluster
46+
### Check that it is running
47+
You can now run the following command to access the sql prompt in your MySQL Cluster, just replace `<NAMESPACE>` with the namespace you created your cluster in.
4948
```
50-
kubectl describe mysqlcluster mysql
49+
sh hack/mysql.sh <NAMESPACE>/mysql-0
5150
```
5251

53-
## Clean up
54-
55-
To remove the mysqlcluster and each of the components created in this tutorial, execute the following:
56-
```
57-
kubectl delete -f examples/cluster/cluster-with-3-members-enterprise-version.yaml
58-
kubectl delete secret myregistrykey
59-
kubectl delete -f examples/example-enterprise-deployment.yaml
60-
```
52+
><sup>*</sup>If you run into issues when creating RBAC roles see [Access controls](https://docs.cloud.oracle.com/iaas/Content/ContEng/Concepts/contengabouta]ccesscontrol.htm?) for more information.
6153
62-
><sup>*</sup>If you run into issues when creating RBAC roles see [Access controls](https://docs.cloud.oracle.com/iaas/Content/ContEng/Concepts/contengabouta]ccesscontrol.htm?) for more information.
54+
[1]: docs/tutorial.md
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: mysql.oracle.com/v1alpha1
2+
kind: Cluster
3+
metadata:
4+
name: mysql
5+
namespace: default
6+
spec:
7+
version: "8.0.11"
8+
mysqlServer: store/oracle/mysql-enterprise-server
9+
imagePullSecret:
10+
name: myregistrykey

examples/cluster/cluster-with-3-members-enterprise-version.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)