Skip to content

Commit

Permalink
Merge pull request #343 from gibizer/database-helper
Browse files Browse the repository at this point in the history
Use database helpers from mariadb-operator/api
  • Loading branch information
openshift-ci[bot] authored Oct 6, 2023
2 parents fbbd260 + e6204ff commit 4d73854
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
5 changes: 2 additions & 3 deletions controllers/ironic_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
common_rbac "github.com/openstack-k8s-operators/lib-common/modules/common/rbac"
oko_secret "github.com/openstack-k8s-operators/lib-common/modules/common/secret"
util "github.com/openstack-k8s-operators/lib-common/modules/common/util"
database "github.com/openstack-k8s-operators/lib-common/modules/database"

ironicv1 "github.com/openstack-k8s-operators/ironic-operator/api/v1beta1"
keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1"
Expand Down Expand Up @@ -221,7 +220,7 @@ func (r *IronicReconciler) reconcileDelete(ctx context.Context, instance *ironic
r.Log.Info("Reconciling Ironic delete")

// remove db finalizer first
db, err := database.GetDatabaseByName(ctx, helper, instance.Name)
db, err := mariadbv1.GetDatabaseByName(ctx, helper, instance.Name)
if err != nil && !k8s_errors.IsNotFound(err) {
return ctrl.Result{}, err
}
Expand Down Expand Up @@ -584,7 +583,7 @@ func (r *IronicReconciler) reconcileInit(
//
// create service DB instance
//
db := database.NewDatabase(
db := mariadbv1.NewDatabase(
instance.Name,
instance.Name,
instance.Spec.Secret,
Expand Down
6 changes: 3 additions & 3 deletions controllers/ironicinspector_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/go-logr/logr"
ironic "github.com/openstack-k8s-operators/ironic-operator/pkg/ironic"
ironicinspector "github.com/openstack-k8s-operators/ironic-operator/pkg/ironicinspector"
mariadbv1 "github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1"

common "github.com/openstack-k8s-operators/lib-common/modules/common"
configmap "github.com/openstack-k8s-operators/lib-common/modules/common/configmap"
Expand All @@ -37,7 +38,6 @@ import (
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
"github.com/openstack-k8s-operators/lib-common/modules/common/statefulset"
util "github.com/openstack-k8s-operators/lib-common/modules/common/util"
database "github.com/openstack-k8s-operators/lib-common/modules/database"

routev1 "github.com/openshift/api/route/v1"
k8s_errors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -727,7 +727,7 @@ func (r *IronicInspectorReconciler) reconcileDeleteDatabase(
helper *helper.Helper,
) (ctrl.Result, error) {
// remove db finalizer first
db, err := database.GetDatabaseByName(ctx, helper, instance.Name)
db, err := mariadbv1.GetDatabaseByName(ctx, helper, instance.Name)
if err != nil && !k8s_errors.IsNotFound(err) {
return ctrl.Result{}, err
}
Expand Down Expand Up @@ -775,7 +775,7 @@ func (r *IronicInspectorReconciler) reconcileServiceDBinstance(
serviceLabels map[string]string,
) (ctrl.Result, error) {
databaseName := strings.Replace(instance.Name, "-", "_", -1)
db := database.NewDatabase(
db := mariadbv1.NewDatabase(
databaseName,
databaseName,
instance.Spec.Secret,
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ require (
github.com/openstack-k8s-operators/ironic-operator/api v0.1.1-0.20230901035810-610538e222c9
github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230925133339-116a3a39cdfa
github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20231001084618-12369665b166
github.com/openstack-k8s-operators/lib-common/modules/database v0.1.1-0.20230927082538-4f614f333d17
github.com/openstack-k8s-operators/lib-common/modules/test v0.1.2-0.20230927082538-4f614f333d17
github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230928103342-106bb85983f4
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.0
k8s.io/api v0.26.9
k8s.io/apimachinery v0.27.1
k8s.io/client-go v0.26.9
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,12 @@ github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230925133339
github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230925133339-116a3a39cdfa/go.mod h1:Zyp4nHS/JggPqlsMNM8WZN546oYINvGVlHA1NivE3sU=
github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20231001084618-12369665b166 h1:pZPl9njjTchHSFf2OSuzyRxrRW8LLb1OscPxVNoATrk=
github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20231001084618-12369665b166/go.mod h1:Ozg6SxfwOtMkiH553c0XQBWuygZQq4jDQCpR4hZqlxM=
github.com/openstack-k8s-operators/lib-common/modules/database v0.1.1-0.20230927082538-4f614f333d17 h1:pjpbv2RqrBkAO7Gt/6wZ3SSjkd/1//c3s9TAOQ7Z0d4=
github.com/openstack-k8s-operators/lib-common/modules/database v0.1.1-0.20230927082538-4f614f333d17/go.mod h1:RroLfB6Wstc+z7JVJY9o+6YPu+wBIzTAAfMpwhv7pDI=
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230927082538-4f614f333d17 h1:d3HP0nEGNd8cQ088beQbyWzcgdMppD+Zs8HeoMdzRws=
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230927082538-4f614f333d17/go.mod h1:+iJZo5alCeOGD/524hWWdlINA6zqY+MjfWT7cDcbvBE=
github.com/openstack-k8s-operators/lib-common/modules/test v0.1.2-0.20230927082538-4f614f333d17 h1:zJguNin+9IwRnGKy1A7ranxASKO1vTvWxoXwkCz8MWw=
github.com/openstack-k8s-operators/lib-common/modules/test v0.1.2-0.20230927082538-4f614f333d17/go.mod h1:YOFHrNK/QqCvZUPlDJYmDyaCkbKIB98V04uyofiC9a8=
github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230928103342-106bb85983f4 h1:37bbJ9XzpCvB+zZckdweJEEH3pqM6Q88OHH8eHFvlpI=
github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230928103342-106bb85983f4/go.mod h1:xhiz5wFdKWwVM7BF/VYon4TT3NuUPXp/Pyn2hWcp0CE=
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.0 h1:FB0xB6whYM6W4XIncYo2mPiOJWkFsIOWtCT+UOtvOaQ=
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.0/go.mod h1:xhiz5wFdKWwVM7BF/VYon4TT3NuUPXp/Pyn2hWcp0CE=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down

0 comments on commit 4d73854

Please sign in to comment.