Skip to content

Commit

Permalink
Move all packages containing source code to pkg/
Browse files Browse the repository at this point in the history
  • Loading branch information
earlgreyz committed Apr 25, 2018
1 parent 9324ae0 commit 5ad301c
Show file tree
Hide file tree
Showing 90 changed files with 107 additions and 122 deletions.
2 changes: 1 addition & 1 deletion cli/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

import "github.com/grtl/mysql-operator/cli/cmd"
import "github.com/grtl/mysql-operator/pkg/cmd"

func main() {
cmd.Execute()
Expand Down
13 changes: 7 additions & 6 deletions e2e/startup/crd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ import (
. "github.com/onsi/gomega"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/grtl/mysql-operator/pkg/crd/backup"
"github.com/grtl/mysql-operator/pkg/crd/cluster"
)

var _ = Describe("On operator startup", func() {
It("should register MySQLCluster crd", func() {
const clusterCRD = "mysqlclusters.cr.mysqloperator.grtl.github.com"
crd, err := operator.ExtClientset().ApiextensionsV1beta1().
CustomResourceDefinitions().Get(clusterCRD, metav1.GetOptions{})
crdInterface := operator.ExtClientset().ApiextensionsV1beta1().CustomResourceDefinitions()
crd, err := crdInterface.Get(cluster.CustomResourceName, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
Expect(crd.Spec.Names.Kind).To(Equal("MySQLCluster"))
})

It("should register MySQLBackup crd", func() {
const backupCRD = "mysqlbackups.cr.mysqloperator.grtl.github.com"
crd, err := operator.ExtClientset().ApiextensionsV1beta1().
CustomResourceDefinitions().Get(backupCRD, metav1.GetOptions{})
crdInterface := operator.ExtClientset().ApiextensionsV1beta1().CustomResourceDefinitions()
crd, err := crdInterface.Get(backup.CustomResourceName, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
Expect(crd.Spec.Names.Kind).To(Equal("MySQLBackup"))
})
Expand Down
2 changes: 1 addition & 1 deletion e2e/startup/startup_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/grtl/mysql-operator/testing/e2e"
"github.com/grtl/mysql-operator/pkg/testing/e2e"
)

var operator e2e.Operator
Expand Down
10 changes: 5 additions & 5 deletions operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import (

"github.com/sirupsen/logrus"

"github.com/grtl/mysql-operator/controller/backup"
"github.com/grtl/mysql-operator/controller/cluster"
backupcrd "github.com/grtl/mysql-operator/crd/backup"
clustercrd "github.com/grtl/mysql-operator/crd/cluster"
operator "github.com/grtl/mysql-operator/operator/cluster"
"github.com/grtl/mysql-operator/pkg/client/clientset/versioned"
"github.com/grtl/mysql-operator/pkg/controller/backup"
"github.com/grtl/mysql-operator/pkg/controller/cluster"
backupcrd "github.com/grtl/mysql-operator/pkg/crd/backup"
clustercrd "github.com/grtl/mysql-operator/pkg/crd/cluster"
operator "github.com/grtl/mysql-operator/pkg/operator/cluster"
)

var (
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions cli/cmd/backup/create.go → pkg/cmd/backup/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/grtl/mysql-operator/cli/config"
"github.com/grtl/mysql-operator/cli/options"
"github.com/grtl/mysql-operator/cli/util"
crv1 "github.com/grtl/mysql-operator/pkg/apis/cr/v1"
"github.com/grtl/mysql-operator/pkg/cmd/util/config"
"github.com/grtl/mysql-operator/pkg/cmd/util/options"
"github.com/grtl/mysql-operator/pkg/cmd/util/util"
)

var (
Expand Down
8 changes: 4 additions & 4 deletions cli/cmd/backup/delete.go → pkg/cmd/backup/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/errors"

"github.com/grtl/mysql-operator/cli/config"
"github.com/grtl/mysql-operator/cli/options"
"github.com/grtl/mysql-operator/cli/util"
"github.com/grtl/mysql-operator/operator/backup"
"github.com/grtl/mysql-operator/pkg/cmd/util/config"
"github.com/grtl/mysql-operator/pkg/cmd/util/options"
"github.com/grtl/mysql-operator/pkg/cmd/util/util"
"github.com/grtl/mysql-operator/pkg/operator/backup"
)

var removePVC bool
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions cli/cmd/cluster/create.go → pkg/cmd/cluster/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
errorsAgg "k8s.io/apimachinery/pkg/util/errors"

"github.com/grtl/mysql-operator/cli/config"
"github.com/grtl/mysql-operator/cli/options"
"github.com/grtl/mysql-operator/cli/util"
mysqlv1 "github.com/grtl/mysql-operator/pkg/apis/cr/v1"
"github.com/grtl/mysql-operator/pkg/cmd/util/config"
"github.com/grtl/mysql-operator/pkg/cmd/util/options"
"github.com/grtl/mysql-operator/pkg/cmd/util/util"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/cluster/delete.go → pkg/cmd/cluster/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/errors"

"github.com/grtl/mysql-operator/cli/config"
"github.com/grtl/mysql-operator/cli/options"
"github.com/grtl/mysql-operator/cli/util"
"github.com/grtl/mysql-operator/pkg/cmd/util/config"
"github.com/grtl/mysql-operator/pkg/cmd/util/options"
"github.com/grtl/mysql-operator/pkg/cmd/util/util"
)

var removePVC bool
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions cli/cmd/root.go → pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

"k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/grtl/mysql-operator/cli/cmd/backup"
"github.com/grtl/mysql-operator/cli/cmd/cluster"
"github.com/grtl/mysql-operator/cli/config"
"github.com/grtl/mysql-operator/pkg/cmd/backup"
"github.com/grtl/mysql-operator/pkg/cmd/cluster"
"github.com/grtl/mysql-operator/pkg/cmd/util/config"
)

// rootCmd represents the base command when called without any subcommands
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion cli/util/error.go → pkg/cmd/util/util/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

"github.com/grtl/mysql-operator/cli/options"
"github.com/grtl/mysql-operator/pkg/cmd/util/options"
)

// FailOnErrorOrForceContinue checks if error occurred and stops the execution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ import (

func TestBackup(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Backup Suite")
RunSpecs(t, "Controller Backup Suite")
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"

"github.com/grtl/mysql-operator/controller"
operator "github.com/grtl/mysql-operator/operator/backup"
crv1 "github.com/grtl/mysql-operator/pkg/apis/cr/v1"
"github.com/grtl/mysql-operator/pkg/client/clientset/versioned"
"github.com/grtl/mysql-operator/pkg/client/informers/externalversions"
"github.com/grtl/mysql-operator/pkg/controller"
operator "github.com/grtl/mysql-operator/pkg/operator/backup"
)

// NewBackupController returns new backup controller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

. "github.com/grtl/mysql-operator/controller/backup"
. "github.com/grtl/mysql-operator/pkg/controller/backup"

"context"
"io/ioutil"
Expand All @@ -14,9 +14,9 @@ import (
"github.com/nauyey/factory"
"github.com/sirupsen/logrus"

"github.com/grtl/mysql-operator/controller"
crv1 "github.com/grtl/mysql-operator/pkg/apis/cr/v1"
testingFactory "github.com/grtl/mysql-operator/testing/factory"
"github.com/grtl/mysql-operator/pkg/controller"
testingFactory "github.com/grtl/mysql-operator/pkg/testing/factory"
)

var _ = Describe("Backup Controller", func() {
Expand Down
4 changes: 2 additions & 2 deletions controller/backup/fake.go → pkg/controller/backup/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
kubeFake "k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/testing"

"github.com/grtl/mysql-operator/controller"
operator "github.com/grtl/mysql-operator/operator/backup"
"github.com/grtl/mysql-operator/pkg/client/clientset/versioned/fake"
"github.com/grtl/mysql-operator/pkg/controller"
operator "github.com/grtl/mysql-operator/pkg/operator/backup"
)

// NewFakeBackupController returns new operator controller among with prepended
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package backup_test

import (
. "github.com/onsi/ginkgo"
//. "github.com/onsi/gomega"
//. "github.com/grtl/mysql-operator/operator/backup"
)

var _ = Describe("Fake", func() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package backup

import (
"github.com/grtl/mysql-operator/logging"
crv1 "github.com/grtl/mysql-operator/pkg/apis/cr/v1"
"github.com/grtl/mysql-operator/pkg/logging"
)

// Event represents an event processed by backup controller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gstruct"

. "github.com/grtl/mysql-operator/controller/backup"
. "github.com/grtl/mysql-operator/pkg/controller/backup"

"context"
"io/ioutil"
Expand All @@ -16,9 +16,9 @@ import (
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"

"github.com/grtl/mysql-operator/controller"
crv1 "github.com/grtl/mysql-operator/pkg/apis/cr/v1"
testingFactory "github.com/grtl/mysql-operator/testing/factory"
"github.com/grtl/mysql-operator/pkg/controller"
testingFactory "github.com/grtl/mysql-operator/pkg/testing/factory"
)

var _ = Describe("Logging", func() {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion controller/base_test.go → pkg/controller/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

. "github.com/grtl/mysql-operator/controller"
. "github.com/grtl/mysql-operator/pkg/controller"
)

var _ = Describe("Base", func() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ import (

func TestCluster(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Cluster Suite")
RunSpecs(t, "Controller Cluster Suite")
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"

"github.com/grtl/mysql-operator/controller"
"github.com/grtl/mysql-operator/logging"
operator "github.com/grtl/mysql-operator/operator/cluster"
crv1 "github.com/grtl/mysql-operator/pkg/apis/cr/v1"
"github.com/grtl/mysql-operator/pkg/client/clientset/versioned"
"github.com/grtl/mysql-operator/pkg/client/informers/externalversions"
"github.com/grtl/mysql-operator/pkg/controller"
"github.com/grtl/mysql-operator/pkg/logging"
operator "github.com/grtl/mysql-operator/pkg/operator/cluster"
)

// NewClusterController returns new cluster controller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

. "github.com/grtl/mysql-operator/controller/cluster"
. "github.com/grtl/mysql-operator/pkg/controller/cluster"

"context"
"io/ioutil"
Expand All @@ -14,9 +14,9 @@ import (
"github.com/nauyey/factory"
"github.com/sirupsen/logrus"

"github.com/grtl/mysql-operator/controller"
crv1 "github.com/grtl/mysql-operator/pkg/apis/cr/v1"
testingFactory "github.com/grtl/mysql-operator/testing/factory"
"github.com/grtl/mysql-operator/pkg/controller"
testingFactory "github.com/grtl/mysql-operator/pkg/testing/factory"
)

var _ = Describe("Cluster Controller", func() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
kubeFake "k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/testing"

operator "github.com/grtl/mysql-operator/operator/cluster"
"github.com/grtl/mysql-operator/pkg/client/clientset/versioned/fake"
operator "github.com/grtl/mysql-operator/pkg/operator/cluster"
)

// FakeClusterController can be used as a cluster controller in tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package cluster_test

import (
. "github.com/onsi/ginkgo"
//. "github.com/onsi/gomega"
//. "github.com/grtl/mysql-operator/controller/cluster"
)

var _ = Describe("Fake", func() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cluster

import (
"github.com/grtl/mysql-operator/logging"
crv1 "github.com/grtl/mysql-operator/pkg/apis/cr/v1"
"github.com/grtl/mysql-operator/pkg/logging"
)

// Event represents an event processed by cluster controller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gstruct"

. "github.com/grtl/mysql-operator/controller/cluster"
. "github.com/grtl/mysql-operator/pkg/controller/cluster"

"context"
"io/ioutil"
Expand All @@ -17,9 +17,9 @@ import (
"github.com/sirupsen/logrus/hooks/test"

"fmt"
"github.com/grtl/mysql-operator/controller"
crv1 "github.com/grtl/mysql-operator/pkg/apis/cr/v1"
testingFactory "github.com/grtl/mysql-operator/testing/factory"
"github.com/grtl/mysql-operator/pkg/controller"
testingFactory "github.com/grtl/mysql-operator/pkg/testing/factory"
)

var _ = Describe("Logging", func() {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package controller_test

import (
. "github.com/onsi/ginkgo"
//. "github.com/onsi/gomega"
//. "github.com/grtl/mysql-operator/controller"
)

var _ = Describe("Controller", func() {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions controller/events_test.go → pkg/controller/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

. "github.com/grtl/mysql-operator/controller"
. "github.com/grtl/mysql-operator/pkg/controller"

"github.com/nauyey/factory"

crv1 "github.com/grtl/mysql-operator/pkg/apis/cr/v1"
testingFactory "github.com/grtl/mysql-operator/testing/factory"
testingFactory "github.com/grtl/mysql-operator/pkg/testing/factory"
)

var _ = Describe("Events", func() {
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions controller/hook_test.go → pkg/controller/hook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package controller_test

import (
. "github.com/onsi/ginkgo"
//. "github.com/onsi/gomega"
//. "github.com/grtl/mysql-operator/controller"
)

var _ = Describe("Hook", func() {
Expand Down
Loading

0 comments on commit 5ad301c

Please sign in to comment.