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

Migrate API version from v1 -> v1alpha1 #122

Merged
merged 1 commit into from
Jun 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cmd/mysql-agent/app/mysql_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
backupcontroller "github.com/oracle/mysql-operator/pkg/controllers/backup"
clustermgr "github.com/oracle/mysql-operator/pkg/controllers/cluster/manager"
restorecontroller "github.com/oracle/mysql-operator/pkg/controllers/restore"
mysqlop "github.com/oracle/mysql-operator/pkg/generated/clientset/versioned"
clientset "github.com/oracle/mysql-operator/pkg/generated/clientset/versioned"
informers "github.com/oracle/mysql-operator/pkg/generated/informers/externalversions"
metrics "github.com/oracle/mysql-operator/pkg/util/metrics"
signals "github.com/oracle/mysql-operator/pkg/util/signals"
Expand Down Expand Up @@ -83,7 +83,7 @@ func Run(opts *options.MySQLAgentOpts) error {
}()

kubeclient := kubernetes.NewForConfigOrDie(kubeconfig)
mysqlopClient := mysqlop.NewForConfigOrDie(kubeconfig)
mysqlopClient := clientset.NewForConfigOrDie(kubeconfig)

sharedInformerFactory := informers.NewFilteredSharedInformerFactory(mysqlopClient, 0, opts.Namespace, nil)
kubeInformerFactory := kubeinformers.NewFilteredSharedInformerFactory(kubeclient, resyncPeriod(opts)(), opts.Namespace, nil)
Expand Down Expand Up @@ -116,9 +116,9 @@ func Run(opts *options.MySQLAgentOpts) error {

backupController := backupcontroller.NewAgentController(
kubeclient,
mysqlopClient.MysqlV1(),
sharedInformerFactory.Mysql().V1().MySQLBackups(),
sharedInformerFactory.Mysql().V1().MySQLClusters(),
mysqlopClient.MysqlV1alpha1(),
sharedInformerFactory.Mysql().V1alpha1().MySQLBackups(),
sharedInformerFactory.Mysql().V1alpha1().MySQLClusters(),
kubeInformerFactory.Core().V1().Pods(),
opts.Hostname,
)
Expand All @@ -130,10 +130,10 @@ func Run(opts *options.MySQLAgentOpts) error {

restoreController := restorecontroller.NewAgentController(
kubeclient,
mysqlopClient.MysqlV1(),
sharedInformerFactory.Mysql().V1().MySQLRestores(),
sharedInformerFactory.Mysql().V1().MySQLClusters(),
sharedInformerFactory.Mysql().V1().MySQLBackups(),
mysqlopClient.MysqlV1alpha1(),
sharedInformerFactory.Mysql().V1alpha1().MySQLRestores(),
sharedInformerFactory.Mysql().V1alpha1().MySQLClusters(),
sharedInformerFactory.Mysql().V1alpha1().MySQLBackups(),
kubeInformerFactory.Core().V1().Pods(),
opts.Hostname,
)
Expand Down
22 changes: 11 additions & 11 deletions cmd/mysql-operator/app/mysql_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
backupschedule "github.com/oracle/mysql-operator/pkg/controllers/backup/schedule"
cluster "github.com/oracle/mysql-operator/pkg/controllers/cluster"
restorecontroller "github.com/oracle/mysql-operator/pkg/controllers/restore"
mysqlop "github.com/oracle/mysql-operator/pkg/generated/clientset/versioned"
clientset "github.com/oracle/mysql-operator/pkg/generated/clientset/versioned"
informers "github.com/oracle/mysql-operator/pkg/generated/informers/externalversions"
metrics "github.com/oracle/mysql-operator/pkg/util/metrics"
signals "github.com/oracle/mysql-operator/pkg/util/signals"
Expand Down Expand Up @@ -71,7 +71,7 @@ func Run(s *options.MySQLOperatorServer) error {
signals.SetupSignalHandler(cancelFunc)

kubeClient := kubernetes.NewForConfigOrDie(kubeconfig)
mysqlopClient := mysqlop.NewForConfigOrDie(kubeconfig)
mysqlopClient := clientset.NewForConfigOrDie(kubeconfig)

// Shared informers (non namespace specific).
operatorInformerFactory := informers.NewFilteredSharedInformerFactory(mysqlopClient, resyncPeriod(s)(), s.Namespace, nil)
Expand All @@ -83,7 +83,7 @@ func Run(s *options.MySQLOperatorServer) error {
*s,
mysqlopClient,
kubeClient,
operatorInformerFactory.Mysql().V1().MySQLClusters(),
operatorInformerFactory.Mysql().V1alpha1().MySQLClusters(),
kubeInformerFactory.Apps().V1beta1().StatefulSets(),
kubeInformerFactory.Core().V1().Pods(),
kubeInformerFactory.Core().V1().Services(),
Expand All @@ -98,9 +98,9 @@ func Run(s *options.MySQLOperatorServer) error {

backupController := backupcontroller.NewOperatorController(
kubeClient,
mysqlopClient.MysqlV1(),
operatorInformerFactory.Mysql().V1().MySQLBackups(),
operatorInformerFactory.Mysql().V1().MySQLClusters(),
mysqlopClient.MysqlV1alpha1(),
operatorInformerFactory.Mysql().V1alpha1().MySQLBackups(),
operatorInformerFactory.Mysql().V1alpha1().MySQLClusters(),
kubeInformerFactory.Core().V1().Pods(),
)
wg.Add(1)
Expand All @@ -111,10 +111,10 @@ func Run(s *options.MySQLOperatorServer) error {

restoreController := restorecontroller.NewOperatorController(
kubeClient,
mysqlopClient.MysqlV1(),
operatorInformerFactory.Mysql().V1().MySQLRestores(),
operatorInformerFactory.Mysql().V1().MySQLClusters(),
operatorInformerFactory.Mysql().V1().MySQLBackups(),
mysqlopClient.MysqlV1alpha1(),
operatorInformerFactory.Mysql().V1alpha1().MySQLRestores(),
operatorInformerFactory.Mysql().V1alpha1().MySQLClusters(),
operatorInformerFactory.Mysql().V1alpha1().MySQLBackups(),
kubeInformerFactory.Core().V1().Pods(),
)
wg.Add(1)
Expand All @@ -126,7 +126,7 @@ func Run(s *options.MySQLOperatorServer) error {
backupScheduleController := backupschedule.NewController(
mysqlopClient,
kubeClient,
operatorInformerFactory.Mysql().V1().MySQLBackupSchedules(),
operatorInformerFactory.Mysql().V1alpha1().MySQLBackupSchedules(),
30*time.Second,
s.Namespace,
)
Expand Down
8 changes: 4 additions & 4 deletions contrib/manifests/custom-resource-definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: mysqlclusters.mysql.oracle.com
spec:
group: mysql.oracle.com
version: v1
version: v1alpha1
scope: Namespaced
names:
kind: MySQLCluster
Expand All @@ -18,7 +18,7 @@ metadata:
name: mysqlbackups.mysql.oracle.com
spec:
group: mysql.oracle.com
version: v1
version: v1alpha1
scope: Namespaced
names:
kind: MySQLBackup
Expand All @@ -31,7 +31,7 @@ metadata:
name: mysqlrestores.mysql.oracle.com
spec:
group: mysql.oracle.com
version: v1
version: v1alpha1
scope: Namespaced
names:
kind: MySQLRestore
Expand All @@ -44,7 +44,7 @@ metadata:
name: mysqlbackupschedules.mysql.oracle.com
spec:
group: mysql.oracle.com
version: v1
version: v1alpha1
scope: Namespaced
names:
kind: MySQLBackupSchedule
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ You should now have a cluster in the default namespace
```
$ kubectl get mysqlclusters
NAME KIND
myappdb MySQLCluster.v1.mysql.oracle.com
myappdb MySQLCluster.v1alpha1.mysql.oracle.com
```

To find out how to create larger clusters, and configure storage see [Clusters](user/clusters.md#clusters).
Expand Down
24 changes: 12 additions & 12 deletions docs/user/backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ operator. The secretRef is the name of a secret that contains your Object
Storage credentials. Note: The databases field is mandatory.

```yaml
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpa1
kind: MySQLBackup
metadata:
name: mysql-backup
Expand All @@ -63,30 +63,30 @@ spec:

### On-demand backups - executor configuration

A backup spec requires an 'executor' to support the backup and restore of
A backup spec requires an 'executor' to support the backup and restore of
database content.

Currently, the 'mysqldump' utility is provided, although further executors may
Currently, the 'mysqldump' utility is provided, although further executors may
be added in the future.

You should additionally configure the list of databases to include in the
You should additionally configure the list of databases to include in the
backup.

### On-demand backups - storage configuration

A backup spec requires a 'storage' mechanism to save the backed up
A backup spec requires a 'storage' mechanism to save the backed up
content of a database.

Currently, 'S3' based object storage is provided, although further providers
Currently, 'S3' based object storage is provided, although further providers
may be added in the future.

#### On-demand backups - OCI S3 storage configuration

When configuring an S3 endpoint you should ensure that it is correct for your
backing provider and that you have pre-created the desired bucket.
When configuring an S3 endpoint you should ensure that it is correct for your
backing provider and that you have pre-created the desired bucket.

For example, An Oracle OCI backend for the tenancy 'mytenancy', region
'us-phoenix-1', and bucket 'mybucket', should have the storage element
For example, An Oracle OCI backend for the tenancy 'mytenancy', region
'us-phoenix-1', and bucket 'mybucket', should have the storage element
configured as follows:

```yaml
Expand All @@ -98,7 +98,7 @@ configured as follows:
...
```

The bucket should also be valid for the secret credentials specified previously.
The bucket should also be valid for the secret credentials specified previously.

#### On-demand backups - Amazon S3 storage configuration

Expand Down Expand Up @@ -146,7 +146,7 @@ databases field is mandatory. For example, the following will create a backup
of the employees database every 30 minutes:

```yaml
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLBackupSchedule
metadata:
name: mysql-backup-schedule
Expand Down
14 changes: 7 additions & 7 deletions docs/user/clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MySQL cluster examples.
The following example will create a MySQL Cluster with 3 replicas, one primary and 2 secondaries:

```yaml
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql-test-cluster
Expand All @@ -20,7 +20,7 @@ spec:
The following example will create a MySQL Cluster with 3 primary (read/write) replicas:

```yaml
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql-multimaster-cluster
Expand All @@ -40,7 +40,7 @@ $ kubectl create secret generic mysql-root-user-secret --from-literal=password=f
Create your cluster and reference it

```yaml
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: example-mysql-cluster-custom-secret
Expand Down Expand Up @@ -72,7 +72,7 @@ spec:
persistentVolumeReclaimPolicy: Recycle
storageClassName: manual
---
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: example-mysql-cluster-with-volume
Expand Down Expand Up @@ -129,7 +129,7 @@ spec:
persistentVolumeReclaimPolicy: Recycle
storageClassName: manual
---
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: example-mysql-cluster-with-volume
Expand Down Expand Up @@ -179,7 +179,7 @@ kubectl create configmap mycnf --from-file=examples/my.cnf
Now we can reference our config map in our cluster spec definition. For example:

```yaml
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql-cluster-with-config
Expand All @@ -194,7 +194,7 @@ By default, the MySQL Operator starts a cluster with `--server_id` set to `1000`

The following example will create a MySQL Cluster with following `server_id`'s: 42,43,44
```yaml
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql-cluster-with-custom-serverid
Expand Down
2 changes: 1 addition & 1 deletion docs/user/restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ backup that you wish to restore, and the clusterRef is the name of the
destination cluster of the restore operation.

```yaml
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLRestore
metadata:
name: example-restore
Expand Down
2 changes: 1 addition & 1 deletion docs/user/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Typically the MySQL Router is deployed [alongside your application][2].
We'll use WordPress as an example of how you might setup the MySQL Router for a a real application. The first thing we want to do is create our MySQL Cluster using the operator.

```yaml
apiVersion: "mysql.oracle.com/v1"
apiVersion: "mysql.oracle.com/v1alpa1"
kind: MySQLCluster
metadata:
name: mysql-wordpress
Expand Down
2 changes: 1 addition & 1 deletion examples/backup/backup-schedule.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLBackupSchedule
metadata:
name: mysql-backup-schedule
Expand Down
2 changes: 1 addition & 1 deletion examples/backup/backup.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLBackup
metadata:
name: mysql-backup
Expand Down
2 changes: 1 addition & 1 deletion examples/cluster/cluster-with-3-replicas.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/alpha1
kind: MySQLCluster
metadata:
name: mysql
Expand Down
2 changes: 1 addition & 1 deletion examples/cluster/cluster-with-custom-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/alpha1
kind: MySQLCluster
metadata:
name: mysql
Expand Down
2 changes: 1 addition & 1 deletion examples/cluster/cluster-with-custom-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql
Expand Down
2 changes: 1 addition & 1 deletion examples/cluster/cluster-with-custom-ssl-certs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
persistentVolumeReclaimPolicy: Recycle
storageClassName: manual
---
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql
Expand Down
2 changes: 1 addition & 1 deletion examples/cluster/cluster-with-volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
persistentVolumeReclaimPolicy: Recycle
storageClassName: manual
---
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql
Expand Down
2 changes: 1 addition & 1 deletion examples/cluster/cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql
2 changes: 1 addition & 1 deletion examples/cluster/multi-master-cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/wordpress-router/wordpress-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ metadata:
data:
password: bXktc3VwZXItc2VjcmV0LXBhc3M=
---
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql-wordpress
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/wordpress/wordpress-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
persistentVolumeReclaimPolicy: Recycle
storageClassName: manual
---
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLCluster
metadata:
name: mysql-wordpress
Expand Down
2 changes: 1 addition & 1 deletion examples/restore/restore.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: "mysql.oracle.com/v1"
apiVersion: mysql.oracle.com/v1alpha1
kind: MySQLRestore
metadata:
name: mysql-restore
Expand Down
Loading