Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pkg import only once #909

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions pkg/controller/internal/testutil/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
gomegatypes "github.com/onsi/gomega/types"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

core "k8s.io/api/core/v1"
Expand Down Expand Up @@ -111,7 +110,7 @@ func HaveClusterStatusReadyNodes(nodes int) gomegatypes.GomegaMatcher {
}

// HaveClusterCond is a helper func that returns a matcher to check for an existing condition in a ClusterCondition list.
func HaveClusterCond(condType api.ClusterConditionType, status corev1.ConditionStatus) gomegatypes.GomegaMatcher {
func HaveClusterCond(condType api.ClusterConditionType, status core.ConditionStatus) gomegatypes.GomegaMatcher {
return PointTo(MatchFields(IgnoreExtras, Fields{
"Status": MatchFields(IgnoreExtras, Fields{
"Conditions": ContainElement(MatchFields(IgnoreExtras, Fields{
Expand Down
5 changes: 2 additions & 3 deletions pkg/controller/mysqlcluster/mysqlcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (

mysqlv1alpha1 "github.com/bitpoke/mysql-operator/pkg/apis/mysql/v1alpha1"

api "github.com/bitpoke/mysql-operator/pkg/apis/mysql/v1alpha1"
cleaner "github.com/bitpoke/mysql-operator/pkg/controller/mysqlcluster/internal/cleaner"
clustersyncer "github.com/bitpoke/mysql-operator/pkg/controller/mysqlcluster/internal/syncer"
"github.com/bitpoke/mysql-operator/pkg/controller/mysqlcluster/internal/upgrades"
Expand Down Expand Up @@ -191,11 +190,11 @@ func (r *ReconcileMysqlCluster) Reconcile(ctx context.Context, request reconcile
// condition will be true all the time. When user set cluster's replicas to a value greater than 0,
// the pods of the cluster will boot one by one, but node controller will not init mysql when FailoverInProgress
// is true.
fip := cluster.GetClusterCondition(api.ClusterConditionFailoverInProgress)
fip := cluster.GetClusterCondition(mysqlv1alpha1.ClusterConditionFailoverInProgress)
if fip != nil && fip.Status == corev1.ConditionTrue &&
*cluster.Spec.Replicas == 0 && cluster.Status.ReadyNodes == 0 {

cluster.UpdateStatusCondition(api.ClusterConditionFailoverInProgress, corev1.ConditionFalse,
cluster.UpdateStatusCondition(mysqlv1alpha1.ClusterConditionFailoverInProgress, corev1.ConditionFalse,
"ClusterNotRunning", "cluster is not running")

if sErr := r.Status().Update(context.TODO(), cluster.Unwrap()); sErr != nil {
Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/mysqldatabase/db_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes/scheme"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -185,7 +184,7 @@ var _ = Describe("MySQL database controller", func() {
It("should succeed if the cluster has been deleted", func() {
// delete the cluster
cluster := &mysqlv1alpha1.MysqlCluster{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: clusterName, Namespace: db.Namespace,
},
}
Expand Down