Skip to content

Commit

Permalink
lose odfv1alpha1 - tmp not complete - still need to go over all occur…
Browse files Browse the repository at this point in the history
…ences and see they're still valid
  • Loading branch information
shlomitn committed Sep 1, 2024
1 parent 3891621 commit e2083a2
Show file tree
Hide file tree
Showing 16 changed files with 124 additions and 124 deletions.
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ resources:
domain: ibm.com
group: odf
kind: FlashSystemCluster
path: github.com/IBM/ibm-storage-odf-operator/api/v1alpha1
path: github.com/IBM/ibm-storage-odf-operator/api/v1
version: v1alpha1
version: "3"
4 changes: 2 additions & 2 deletions controllers/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"os"
"strings"

odfv1alpha1 "github.com/IBM/ibm-storage-odf-operator/api/v1alpha1"
odfv1 "github.com/IBM/ibm-storage-odf-operator/api/v1"
"github.com/IBM/ibm-storage-odf-operator/controllers/util"
storagev1 "k8s.io/api/storage/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -49,7 +49,7 @@ const (
FlashSystemCRFilePathEnvVar = "TEST_FS_CR_FILEPATH"
)

func InitDefaultStorageClass(instance *odfv1alpha1.FlashSystemCluster) *storagev1.StorageClass {
func InitDefaultStorageClass(instance *odfv1.FlashSystemCluster) *storagev1.StorageClass {
selectLabels := util.GetLabels()
secret := instance.Spec.Secret
pool := instance.Spec.DefaultPool
Expand Down
10 changes: 5 additions & 5 deletions controllers/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"reflect"
"strings"

odfv1alpha1 "github.com/IBM/ibm-storage-odf-operator/api/v1alpha1"
odfv1 "github.com/IBM/ibm-storage-odf-operator/api/v1"
"github.com/IBM/ibm-storage-odf-operator/controllers/util"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -85,7 +85,7 @@ func isOwnerExist(ownerReferences []metav1.OwnerReference, newOwner metav1.Owner
return false
}

func InitExporterMetricsService(instance *odfv1alpha1.FlashSystemCluster) *corev1.Service {
func InitExporterMetricsService(instance *odfv1.FlashSystemCluster) *corev1.Service {
serviceName := getExporterMetricsServiceName()
labels := util.GetLabels()

Expand Down Expand Up @@ -161,7 +161,7 @@ func updateExporterMetricsService(foundService *corev1.Service, expectedService
}

func InitExporterDeployment(
instance *odfv1alpha1.FlashSystemCluster,
instance *odfv1.FlashSystemCluster,
pullPolicy corev1.PullPolicy,
image string) (*appsv1.Deployment, error) {

Expand Down Expand Up @@ -300,7 +300,7 @@ func updateExporterDeployment(found *appsv1.Deployment, expected *appsv1.Deploym
return nil
}

func InitExporterMetricsServiceMonitor(instance *odfv1alpha1.FlashSystemCluster) *monitoringv1.ServiceMonitor {
func InitExporterMetricsServiceMonitor(instance *odfv1.FlashSystemCluster) *monitoringv1.ServiceMonitor {
selectLabels := util.GetLabels()

serviceMonitor := &monitoringv1.ServiceMonitor{
Expand Down Expand Up @@ -363,7 +363,7 @@ func getFlashSystemPrometheusRuleFilepath() string {
return FlashSystemPrometheusRuleFilepath
}

func getPrometheusRules(instance *odfv1alpha1.FlashSystemCluster, newOwnerDetails metav1.OwnerReference) (*monitoringv1.PrometheusRule, error) {
func getPrometheusRules(instance *odfv1.FlashSystemCluster, newOwnerDetails metav1.OwnerReference) (*monitoringv1.PrometheusRule, error) {
ruleFile, err := os.ReadFile(filepath.Clean(getFlashSystemPrometheusRuleFilepath()))
if err != nil {
return nil, fmt.Errorf("PrometheusRules file could not be fetched. %v", err)
Expand Down
82 changes: 41 additions & 41 deletions controllers/flashsystemcluster_controller.go

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions controllers/flashsystemcluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"time"

odfv1alpha1 "github.com/IBM/ibm-storage-odf-operator/api/v1alpha1"
odfv1 "github.com/IBM/ibm-storage-odf-operator/api/v1"
"github.com/IBM/ibm-storage-odf-operator/controllers/util"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -108,12 +108,12 @@ var _ = Describe("FlashSystemClusterReconciler", func() {
})

It("should create CSI operator CR successfully", func() {
instance := &odfv1alpha1.FlashSystemCluster{
instance := &odfv1.FlashSystemCluster{
ObjectMeta: metav1.ObjectMeta{
Name: FlashSystemName,
Namespace: namespace,
},
Spec: odfv1alpha1.FlashSystemClusterSpec{
Spec: odfv1.FlashSystemClusterSpec{
Name: FlashSystemName,
Secret: corev1.SecretReference{
Name: secretName,
Expand All @@ -137,19 +137,19 @@ var _ = Describe("FlashSystemClusterReconciler", func() {
It("should create FlashSystemCluster successfully", func() {
By("By creating a new FlashSystemCluster")
ctx := context.TODO()
instance := &odfv1alpha1.FlashSystemCluster{
instance := &odfv1.FlashSystemCluster{
ObjectMeta: metav1.ObjectMeta{
Name: FlashSystemName,
Namespace: namespace,
},
Spec: odfv1alpha1.FlashSystemClusterSpec{
Spec: odfv1.FlashSystemClusterSpec{
Name: FlashSystemName,
Secret: corev1.SecretReference{
Name: secretName,
Namespace: namespace,
},
InsecureSkipVerify: true,
DefaultPool: &odfv1alpha1.StorageClassConfig{
DefaultPool: &odfv1.StorageClassConfig{
StorageClassName: storageClassName,
PoolName: poolName,
FsType: fsType,
Expand All @@ -165,7 +165,7 @@ var _ = Describe("FlashSystemClusterReconciler", func() {
Name: FlashSystemName,
Namespace: namespace,
}
createdFs := &odfv1alpha1.FlashSystemCluster{}
createdFs := &odfv1.FlashSystemCluster{}

Eventually(func() bool {
err := k8sClient.Get(ctx, fsLookupKey, createdFs)
Expand Down Expand Up @@ -268,7 +268,7 @@ var _ = Describe("FlashSystemClusterReconciler", func() {
return err == nil
}, timeout, interval).Should(BeTrue())

currentFS := &odfv1alpha1.FlashSystemCluster{}
currentFS := &odfv1.FlashSystemCluster{}

Eventually(func() bool {
err := k8sClient.Get(ctx, fsLookupKey, currentFS)
Expand All @@ -278,16 +278,16 @@ var _ = Describe("FlashSystemClusterReconciler", func() {
isNotReady := currentFS.Status.Phase == util.PhaseNotReady
Expect(isNotReady).Should(BeTrue())

util.SetReconcileCompleteCondition(&currentFS.Status.Conditions, odfv1alpha1.ReasonReconcileCompleted, "reconciling done")
util.SetReconcileCompleteCondition(&currentFS.Status.Conditions, odfv1.ReasonReconcileCompleted, "reconciling done")

// simulate driver ready
util.SetStatusCondition(&currentFS.Status.Conditions, odfv1alpha1.Condition{
Type: odfv1alpha1.ExporterReady,
util.SetStatusCondition(&currentFS.Status.Conditions, odfv1.Condition{
Type: odfv1.ExporterReady,
Status: corev1.ConditionTrue,
})

util.SetStatusCondition(&currentFS.Status.Conditions, odfv1alpha1.Condition{
Type: odfv1alpha1.StorageClusterReady,
util.SetStatusCondition(&currentFS.Status.Conditions, odfv1.Condition{
Type: odfv1.StorageClusterReady,
Status: corev1.ConditionTrue,
})

Expand All @@ -309,7 +309,7 @@ var _ = Describe("FlashSystemClusterReconciler", func() {
Name: FlashSystemName,
Namespace: namespace,
}
createdFs := &odfv1alpha1.FlashSystemCluster{}
createdFs := &odfv1.FlashSystemCluster{}
Eventually(func() bool {
err := k8sClient.Get(ctx, fsLookupKey, createdFs)
return err == nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/IBM/ibm-storage-odf-operator/api/v1alpha1"
"github.com/IBM/ibm-storage-odf-operator/api/v1"
"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
Expand Down
12 changes: 6 additions & 6 deletions controllers/persistentvolume/persistentvolume_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package persistentvolume

import (
"context"
_ "github.com/IBM/ibm-storage-odf-operator/api/v1alpha1"
odfv1alpha1 "github.com/IBM/ibm-storage-odf-operator/api/v1alpha1"
_ "github.com/IBM/ibm-storage-odf-operator/api/v1"
odfv1 "github.com/IBM/ibm-storage-odf-operator/api/v1"
"github.com/IBM/ibm-storage-odf-operator/controllers/util"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -156,19 +156,19 @@ var _ = Describe("PersistentVolume Controller", func() {
}

By("By creating a new FlashSystemCluster")
instance := &odfv1alpha1.FlashSystemCluster{
instance := &odfv1.FlashSystemCluster{
ObjectMeta: metav1.ObjectMeta{
Name: FlashSystemName,
Namespace: namespace,
},
Spec: odfv1alpha1.FlashSystemClusterSpec{
Spec: odfv1.FlashSystemClusterSpec{
Name: FlashSystemName,
Secret: corev1.SecretReference{
Name: secretName,
Namespace: namespace,
},
InsecureSkipVerify: true,
DefaultPool: &odfv1alpha1.StorageClassConfig{
DefaultPool: &odfv1.StorageClassConfig{
StorageClassName: storageClassName,
PoolName: poolName,
FsType: fsType,
Expand All @@ -185,7 +185,7 @@ var _ = Describe("PersistentVolume Controller", func() {
Name: FlashSystemName,
Namespace: namespace,
}
createdFsc := &odfv1alpha1.FlashSystemCluster{}
createdFsc := &odfv1.FlashSystemCluster{}

Eventually(func() bool {
err := k8sClient.Get(ctx, fscLoopUpKey, createdFsc)
Expand Down
4 changes: 2 additions & 2 deletions controllers/persistentvolume/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package persistentvolume

import (
"fmt"
odfv1alpha1 "github.com/IBM/ibm-storage-odf-operator/api/v1alpha1"
odfv1 "github.com/IBM/ibm-storage-odf-operator/api/v1"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -108,7 +108,7 @@ var _ = BeforeSuite(func() {
ns, err := util.GetWatchNamespace()
Expect(err).ToNot(HaveOccurred())

err = odfv1alpha1.AddToScheme(scheme.Scheme)
err = odfv1.AddToScheme(scheme.Scheme)
Expect(err).NotTo(HaveOccurred())

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Expand Down
2 changes: 1 addition & 1 deletion controllers/storageclass/storageclass_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"bytes"
"context"
"fmt"
"github.com/IBM/ibm-storage-odf-operator/api/v1alpha1"
"github.com/IBM/ibm-storage-odf-operator/api/v1"
"github.com/IBM/ibm-storage-odf-operator/controllers"
"github.com/IBM/ibm-storage-odf-operator/controllers/util"
"github.com/go-logr/logr"
Expand Down
18 changes: 9 additions & 9 deletions controllers/storageclass/storageclass_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package storageclass
import (
"context"
"encoding/json"
odfv1alpha1 "github.com/IBM/ibm-storage-odf-operator/api/v1alpha1"
odfv1 "github.com/IBM/ibm-storage-odf-operator/api/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -114,19 +114,19 @@ var _ = Describe("StorageClassWatcher", func() {
}, timeout, interval).Should(BeTrue())

By("By creating a new FlashSystemCluster")
instance := &odfv1alpha1.FlashSystemCluster{
instance := &odfv1.FlashSystemCluster{
ObjectMeta: metav1.ObjectMeta{
Name: FlashSystemName,
Namespace: namespace,
},
Spec: odfv1alpha1.FlashSystemClusterSpec{
Spec: odfv1.FlashSystemClusterSpec{
Name: FlashSystemName,
Secret: corev1.SecretReference{
Name: secretName,
Namespace: namespace,
},
InsecureSkipVerify: true,
DefaultPool: &odfv1alpha1.StorageClassConfig{
DefaultPool: &odfv1.StorageClassConfig{
StorageClassName: storageClassName,
PoolName: poolName,
FsType: fsType,
Expand All @@ -143,7 +143,7 @@ var _ = Describe("StorageClassWatcher", func() {
Name: FlashSystemName,
Namespace: namespace,
}
createdFsc := &odfv1alpha1.FlashSystemCluster{}
createdFsc := &odfv1.FlashSystemCluster{}

Eventually(func() bool {
err := k8sClient.Get(ctx, fscLoopUpKey, createdFsc)
Expand Down Expand Up @@ -270,19 +270,19 @@ var _ = Describe("StorageClassWatcher", func() {
By("By creating the additional FlashSystemClusters")
fscToSecretMap := map[string]string{SecondFlashSystemName: secondSecretName, ThirdFlashSystemName: thirdSecretName}
for fscName, secretName := range fscToSecretMap {
instance := &odfv1alpha1.FlashSystemCluster{
instance := &odfv1.FlashSystemCluster{
ObjectMeta: metav1.ObjectMeta{
Name: fscName,
Namespace: namespace,
},
Spec: odfv1alpha1.FlashSystemClusterSpec{
Spec: odfv1.FlashSystemClusterSpec{
Name: fscName,
Secret: corev1.SecretReference{
Name: secretName,
Namespace: namespace,
},
InsecureSkipVerify: true,
DefaultPool: &odfv1alpha1.StorageClassConfig{
DefaultPool: &odfv1.StorageClassConfig{
StorageClassName: topologyStorageClassName,
PoolName: poolName,
FsType: fsType,
Expand All @@ -299,7 +299,7 @@ var _ = Describe("StorageClassWatcher", func() {
Name: fscName,
Namespace: namespace,
}
createdFsc := &odfv1alpha1.FlashSystemCluster{}
createdFsc := &odfv1.FlashSystemCluster{}

Eventually(func() bool {
err := k8sClient.Get(ctx, fscLoopUpKey, createdFsc)
Expand Down
4 changes: 2 additions & 2 deletions controllers/storageclass/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package storageclass

import (
"fmt"
odfv1alpha1 "github.com/IBM/ibm-storage-odf-operator/api/v1alpha1"
odfv1 "github.com/IBM/ibm-storage-odf-operator/api/v1"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -109,7 +109,7 @@ var _ = BeforeSuite(func() {
ns, err := util.GetWatchNamespace()
Expect(err).ToNot(HaveOccurred())

err = odfv1alpha1.AddToScheme(scheme.Scheme)
err = odfv1.AddToScheme(scheme.Scheme)
Expect(err).NotTo(HaveOccurred())

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Expand Down
4 changes: 2 additions & 2 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/metrics"

odfv1alpha1 "github.com/IBM/ibm-storage-odf-operator/api/v1alpha1"
odfv1 "github.com/IBM/ibm-storage-odf-operator/api/v1"
"github.com/IBM/ibm-storage-odf-operator/controllers/util"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
//+kubebuilder:scaffold:imports
Expand Down Expand Up @@ -96,7 +96,7 @@ var _ = BeforeSuite(func() {
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

err = odfv1alpha1.AddToScheme(scheme.Scheme)
err = odfv1.AddToScheme(scheme.Scheme)
Expect(err).NotTo(HaveOccurred())

err = monitoringv1.AddToScheme(scheme.Scheme)
Expand Down
Loading

0 comments on commit e2083a2

Please sign in to comment.