You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Make a copy of `k8s/operator.yaml` and replace ${DOCKER_REGISTRY} and ${OPERATOR_VERSION} to the
65
-
right values. You will want to set `OPERATOR_VERSION` to the one used for building the Docker image. `DOCKER_REGISTRY` should
66
-
be the same as you set the docker-registry property in your `pom.xml`.
64
+
1. Make a copy of `k8s/operator.yaml` and replace `spec.template.spec.containers[0].image` (`$ yq 'select(di == 1).spec.template.spec.containers[0].image' k8s/operator.yaml`) with the operator image that you pushed to your registry. This should be the same as you set the docker-registry
65
+
property in your `pom.xml`.
67
66
If you look at the environment variables you will notice this is where the access to the MySQL server is configured.
68
67
The default values assume the server is running in another Kubernetes namespace (called `mysql`), uses the `root` user
69
68
with a not very secure password. In case you want to use a different MySQL server, this is where you configure it.
70
69
71
70
1. Run `kubectl apply -f copy-of-operator.yaml` to deploy the operator. You can wait for the deployment to succeed using
72
-
this command: `kubectl rollout status deployment mysql-schema-operator -w`. `-w` will cause kubectl to continuously monitor
73
-
the deployment until you stop it.
71
+
this command: `kubectl rollout status deployment -n mysql-schema-operator mysql-schema-operator -w`. `-w` will cause kubectl to continuously monitor the deployment until you stop it.
74
72
75
73
1. Now you are ready to create some databases! To create a database schema called `mydb` just apply the `k8s/schema.yaml`
76
-
file with kubectl: `kubectl apply -f k8s/schema.yaml`. You can modify the database name in the file to create more schemas.
74
+
file with kubectl: `kubectl apply -f k8s/schema.yaml`. You can modify the database name in the file to create more schemas. To verify, that the schema is installed you need to expose your `LoadBalancer` `mysql` service and you can use the `mysql`
75
+
CLI to run `show schemas;` command. For instance, with minikube, this can be done like this:
76
+
77
+
```
78
+
$ minikube service mysql -n mysql --url
79
+
http://192.168.49.2:30317
80
+
81
+
$ mysql -h 192.168.49.2 -P 30317 --protocol=tcp -u root -ppassword
82
+
...
83
+
84
+
MariaDB [(none)]> show schemas;
85
+
+--------------------+
86
+
| Database |
87
+
+--------------------+
88
+
| information_schema |
89
+
| mydb |
90
+
| mysql |
91
+
| performance_schema |
92
+
| sys |
93
+
+--------------------+
94
+
5 rows in set (0.000 sec)
95
+
```
96
+
97
+
Or you can verify it directly with `kubectl` like this:
Copy file name to clipboardExpand all lines: sample-operators/mysql-schema/src/test/java/io/javaoperatorsdk/operator/sample/MySQLSchemaOperatorE2E.java
0 commit comments