crds: pick up the rook types in the v1 package

The rook types used across the storage providers moved from the v1alpha2
package to the v1 package. This commit points the packages at their new
location. Implementation is expected to remain unchanged.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
Travis Nielsen committed 2020-02-26 11:18:17 -07:00
1 parent 6807a0566d
commit bcb99d86ce
45 files changed
+285 -283

No files matched your search

@@ -20,6 +20,7 @@ package attachment
import (
"reflect"
rook "github.com/rook/rook/pkg/apis/rook.io"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
"github.com/rook/rook/pkg/operator/k8sutil"
)
@@ -33,7 +34,7 @@ const (
var VolumeResource = k8sutil.CustomResource{
Name: CustomResourceName,
Plural: CustomResourceNamePlural,
Group: rookalpha.CustomResourceGroup,
Group: rook.CustomResourceGroupName,
Version: rookalpha.Version,
Kind: reflect.TypeOf(rookalpha.Volume{}).Name(),
}
@@ -18,7 +18,10 @@ package util
import (
"fmt"
"github.com/rook/rook/pkg/apis/cassandra.rook.io"
"strconv"
"strings"
cassandrarookio "github.com/rook/rook/pkg/apis/cassandra.rook.io"
cassandrav1alpha1 "github.com/rook/rook/pkg/apis/cassandra.rook.io/v1alpha1"
"github.com/rook/rook/pkg/operator/cassandra/constants"
appsv1 "k8s.io/api/apps/v1"
@@ -30,8 +33,6 @@ import (
"k8s.io/client-go/kubernetes"
appslisters "k8s.io/client-go/listers/apps/v1"
corelisters "k8s.io/client-go/listers/core/v1"
"strconv"
"strings"
)
// GetPodsForCluster returns the existing Pods for
@@ -90,7 +91,7 @@ func VerifyOwner(obj, owner metav1.Object) error {
// the provided Cluster Object
func NewControllerRef(c *cassandrav1alpha1.Cluster) metav1.OwnerReference {
return *metav1.NewControllerRef(c, schema.GroupVersionKind{
Group: cassandrarookio.GroupName,
Group: cassandrarookio.CustomResourceGroupName,
Version: "v1alpha1",
Kind: "Cluster",
})
+3 -3
View File
@@ -28,7 +28,7 @@ import (
"github.com/google/go-cmp/cmp"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/daemon/ceph/client"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
@@ -322,8 +322,8 @@ func (c *cluster) doOrchestration(rookImage string, cephVersion cephver.CephVers
func clusterChanged(oldCluster, newCluster cephv1.ClusterSpec, clusterRef *cluster) (bool, string) {
// sort the nodes by name then compare to see if there are changes
sort.Sort(rookv1alpha2.NodesByName(oldCluster.Storage.Nodes))
sort.Sort(rookv1alpha2.NodesByName(newCluster.Storage.Nodes))
sort.Sort(rookv1.NodesByName(oldCluster.Storage.Nodes))
sort.Sort(rookv1.NodesByName(newCluster.Storage.Nodes))
// any change in the crd will trigger an orchestration
if !reflect.DeepEqual(oldCluster, newCluster) {
+19 -18
View File
@@ -23,6 +23,7 @@ import (
"github.com/pkg/errors"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookfake "github.com/rook/rook/pkg/client/clientset/versioned/fake"
"github.com/rook/rook/pkg/clusterd"
@@ -151,17 +152,17 @@ func TestClusterDeleteFlexDisabled(t *testing.T) {
func TestClusterChanged(t *testing.T) {
// a new node added, should be a change
old := cephv1.ClusterSpec{
Storage: rookalpha.StorageScopeSpec{
Nodes: []rookalpha.Node{
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
Storage: rookv1.StorageScopeSpec{
Nodes: []rookv1.Node{
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
},
},
}
new := cephv1.ClusterSpec{
Storage: rookalpha.StorageScopeSpec{
Nodes: []rookalpha.Node{
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
Storage: rookv1.StorageScopeSpec{
Nodes: []rookv1.Node{
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
},
},
}
@@ -172,25 +173,25 @@ func TestClusterChanged(t *testing.T) {
assert.Equal(t, 0, c.Spec.Mon.Count)
// a node was removed, should be a change
old.Storage.Nodes = []rookalpha.Node{
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
old.Storage.Nodes = []rookv1.Node{
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
}
new.Storage.Nodes = []rookalpha.Node{
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
new.Storage.Nodes = []rookv1.Node{
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
}
changed, diff = clusterChanged(old, new, c)
assert.True(t, changed)
assert.NotEqual(t, diff, "")
// the nodes being in a different order should not be a change
old.Storage.Nodes = []rookalpha.Node{
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
old.Storage.Nodes = []rookv1.Node{
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
}
new.Storage.Nodes = []rookalpha.Node{
{Name: "node2", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
new.Storage.Nodes = []rookv1.Node{
{Name: "node2", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
}
changed, diff = clusterChanged(old, new, c)
assert.False(t, changed)
+5 -5
View File
@@ -28,7 +28,7 @@ import (
"github.com/coreos/pkg/capnslog"
"github.com/pkg/errors"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/daemon/ceph/client"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
@@ -67,8 +67,8 @@ type Cluster struct {
clusterInfo *cephconfig.ClusterInfo
Namespace string
Replicas int
placement rookalpha.Placement
annotations rookalpha.Annotations
placement rookv1.Placement
annotations rookv1.Annotations
context *clusterd.Context
dataDir string
Network cephv1.NetworkSpec
@@ -92,8 +92,8 @@ func New(
context *clusterd.Context,
namespace, rookVersion string,
cephVersion cephv1.CephVersionSpec,
placement rookalpha.Placement,
annotations rookalpha.Annotations,
placement rookv1.Placement,
annotations rookv1.Annotations,
network cephv1.NetworkSpec,
dashboard cephv1.DashboardSpec,
monitoringSpec cephv1.MonitoringSpec,
+3 -3
View File
@@ -23,7 +23,7 @@ import (
"testing"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
cephver "github.com/rook/rook/pkg/operator/ceph/version"
@@ -62,8 +62,8 @@ func TestStartMGR(t *testing.T) {
"ns",
"myversion",
cephv1.CephVersionSpec{},
rookalpha.Placement{},
rookalpha.Annotations{"my": "annotation"},
rookv1.Placement{},
rookv1.Annotations{"my": "annotation"},
cephv1.NetworkSpec{},
cephv1.DashboardSpec{Enabled: true, SSL: true},
cephv1.MonitoringSpec{Enabled: true, RulesNamespace: ""},
+2 -2
View File
@@ -24,7 +24,7 @@ import (
"github.com/pkg/errors"
rookcephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/daemon/ceph/client"
"github.com/rook/rook/pkg/operator/ceph/cluster/mon"
"github.com/rook/rook/pkg/operator/ceph/config"
@@ -313,7 +313,7 @@ func (c *Cluster) getPodLabels(daemonName string) map[string]string {
func (c *Cluster) applyPrometheusAnnotations(objectMeta *metav1.ObjectMeta) {
if len(c.annotations) == 0 {
t := rookalpha.Annotations{
t := rookv1.Annotations{
"prometheus.io/scrape": "true",
"prometheus.io/port": strconv.Itoa(metricsPort),
}
+12 -12
View File
@@ -20,7 +20,7 @@ import (
"testing"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
"github.com/rook/rook/pkg/operator/ceph/config"
@@ -42,8 +42,8 @@ func TestPodSpec(t *testing.T) {
"ns",
"rook/rook:myversion",
cephv1.CephVersionSpec{Image: "ceph/ceph:myceph"},
rookalpha.Placement{},
rookalpha.Annotations{},
rookv1.Placement{},
rookv1.Annotations{},
cephv1.NetworkSpec{},
cephv1.DashboardSpec{Port: 1234},
cephv1.MonitoringSpec{},
@@ -96,8 +96,8 @@ func TestServiceSpec(t *testing.T) {
"ns",
"myversion",
cephv1.CephVersionSpec{},
rookalpha.Placement{},
rookalpha.Annotations{},
rookv1.Placement{},
rookv1.Annotations{},
cephv1.NetworkSpec{},
cephv1.DashboardSpec{},
cephv1.MonitoringSpec{},
@@ -124,8 +124,8 @@ func TestHostNetwork(t *testing.T) {
"ns",
"myversion",
cephv1.CephVersionSpec{},
rookalpha.Placement{},
rookalpha.Annotations{},
rookv1.Placement{},
rookv1.Annotations{},
cephv1.NetworkSpec{HostNetwork: true},
cephv1.DashboardSpec{Port: 1234},
cephv1.MonitoringSpec{},
@@ -159,8 +159,8 @@ func TestHttpBindFix(t *testing.T) {
"ns",
"myversion",
cephv1.CephVersionSpec{},
rookalpha.Placement{},
rookalpha.Annotations{},
rookv1.Placement{},
rookv1.Annotations{},
cephv1.NetworkSpec{},
cephv1.DashboardSpec{Port: 1234},
cephv1.MonitoringSpec{},
@@ -195,8 +195,8 @@ func TestApplyPrometheusAnnotations(t *testing.T) {
"ns",
"myversion",
cephv1.CephVersionSpec{},
rookalpha.Placement{},
rookalpha.Annotations{},
rookv1.Placement{},
rookv1.Annotations{},
cephv1.NetworkSpec{},
cephv1.DashboardSpec{},
cephv1.MonitoringSpec{},
@@ -225,7 +225,7 @@ func TestApplyPrometheusAnnotations(t *testing.T) {
// re-initialize "d"
d = c.makeDeployment(&mgrTestConfig)
fakeAnnotations := rookalpha.Annotations{
fakeAnnotations := rookv1.Annotations{
"foo.io/bar": "foobar",
}
c.annotations = fakeAnnotations
+3 -3
View File
@@ -22,7 +22,7 @@ import (
"testing"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
cephver "github.com/rook/rook/pkg/operator/ceph/version"
"github.com/rook/rook/pkg/operator/test"
@@ -37,8 +37,8 @@ func TestNodeAffinity(t *testing.T) {
c := New(&clusterd.Context{Clientset: clientset}, "ns", "", cephv1.NetworkSpec{}, metav1.OwnerReference{}, &sync.Mutex{})
setCommonMonProperties(c, 0, cephv1.MonSpec{Count: 3, AllowMultiplePerNode: true}, "myversion")
c.spec.Placement = map[rookalpha.KeyType]rookalpha.Placement{}
c.spec.Placement[cephv1.KeyMon] = rookalpha.Placement{NodeAffinity: &v1.NodeAffinity{
c.spec.Placement = map[rookv1.KeyType]rookv1.Placement{}
c.spec.Placement[cephv1.KeyMon] = rookv1.Placement{NodeAffinity: &v1.NodeAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
NodeSelectorTerms: []v1.NodeSelectorTerm{
{
+2 -2
View File
@@ -21,7 +21,7 @@ import (
"testing"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/ceph/config"
opspec "github.com/rook/rook/pkg/operator/ceph/spec"
@@ -63,7 +63,7 @@ func testPodSpec(t *testing.T, monID string, pvc bool) {
v1.ResourceMemory: *resource.NewQuantity(500.0, resource.BinarySI),
},
}
c.spec.PriorityClassNames = map[rook.KeyType]string{
c.spec.PriorityClassNames = map[rookv1.KeyType]string{
cephv1.KeyMon: "my-priority-class",
}
monConfig := testGenMonConfig(monID)
+4 -4
View File
@@ -18,14 +18,14 @@ package osd
import (
"github.com/pkg/errors"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
opspec "github.com/rook/rook/pkg/operator/ceph/spec"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func (c *Cluster) prepareStorageClassDeviceSets(config *provisionConfig) []rookalpha.VolumeSource {
volumeSources := []rookalpha.VolumeSource{}
func (c *Cluster) prepareStorageClassDeviceSets(config *provisionConfig) []rookv1.VolumeSource {
volumeSources := []rookv1.VolumeSource{}
// Iterate over storageClassDeviceSet
for _, storageClassDeviceSet := range c.DesiredStorage.StorageClassDeviceSets {
@@ -45,7 +45,7 @@ func (c *Cluster) prepareStorageClassDeviceSets(config *provisionConfig) []rooka
config.addError("failed to create osd for storageClassDeviceSet %q for count %d. %v", storageClassDeviceSet.Name, i, err)
continue
}
volumeSources = append(volumeSources, rookalpha.VolumeSource{
volumeSources = append(volumeSources, rookv1.VolumeSource{
Name: storageClassDeviceSet.Name,
Resources: storageClassDeviceSet.Resources,
Placement: storageClassDeviceSet.Placement,
+13 -13
View File
@@ -29,7 +29,7 @@ import (
"github.com/coreos/pkg/capnslog"
"github.com/pkg/errors"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/daemon/ceph/client"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
@@ -78,13 +78,13 @@ type Cluster struct {
clusterInfo *cephconfig.ClusterInfo
context *clusterd.Context
Namespace string
placement rookalpha.Placement
annotations rookalpha.Annotations
placement rookv1.Placement
annotations rookv1.Annotations
Keyring string
rookVersion string
cephVersion cephv1.CephVersionSpec
DesiredStorage rookalpha.StorageScopeSpec // user-defined storage scope spec
ValidStorage rookalpha.StorageScopeSpec // valid subset of `Storage`, computed at runtime
DesiredStorage rookv1.StorageScopeSpec // user-defined storage scope spec
ValidStorage rookv1.StorageScopeSpec // valid subset of `Storage`, computed at runtime
dataDirHostPath string
Network cephv1.NetworkSpec
resources v1.ResourceRequirements
@@ -103,10 +103,10 @@ func New(
namespace string,
rookVersion string,
cephVersion cephv1.CephVersionSpec,
storageSpec rookalpha.StorageScopeSpec,
storageSpec rookv1.StorageScopeSpec,
dataDirHostPath string,
placement rookalpha.Placement,
annotations rookalpha.Annotations,
placement rookv1.Placement,
annotations rookv1.Annotations,
network cephv1.NetworkSpec,
resources v1.ResourceRequirements,
prepareResources v1.ResourceRequirements,
@@ -163,13 +163,13 @@ type OrchestrationStatus struct {
type osdProperties struct {
//crushHostname refers to the hostname or PVC name when the OSD is provisioned on Nodes or PVC block device, respectively.
crushHostname string
devices []rookalpha.Device
devices []rookv1.Device
pvc v1.PersistentVolumeClaimVolumeSource
metadataPVC v1.PersistentVolumeClaimVolumeSource
selection rookalpha.Selection
selection rookv1.Selection
resources v1.ResourceRequirements
storeConfig osdconfig.StoreConfig
placement rookalpha.Placement
placement rookv1.Placement
metadataDevice string
location string
portable bool
@@ -358,7 +358,7 @@ func (c *Cluster) startProvisioningOverNodes(config *provisionConfig) {
}
c.DesiredStorage.Nodes = nil
for _, hostname := range hostnameMap {
storageNode := rookalpha.Node{
storageNode := rookv1.Node{
Name: hostname,
}
c.DesiredStorage.Nodes = append(c.DesiredStorage.Nodes, storageNode)
@@ -655,7 +655,7 @@ func (c *Cluster) discoverStorageNodes() (map[string][]*apps.Deployment, error)
return discoveredNodes, nil
}
func (c *Cluster) resolveNode(nodeName string) *rookalpha.Node {
func (c *Cluster) resolveNode(nodeName string) *rookv1.Node {
// fully resolve the storage config and resources for this node
rookNode := c.ValidStorage.ResolveNode(nodeName)
if rookNode == nil {
+16 -16
View File
@@ -21,7 +21,7 @@ import (
"github.com/pkg/errors"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
discoverDaemon "github.com/rook/rook/pkg/daemon/discover"
@@ -46,7 +46,7 @@ func TestStart(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "myversion", cephv1.CephVersionSpec{},
rookalpha.StorageScopeSpec{}, "", rookalpha.Placement{}, rookalpha.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
rookv1.StorageScopeSpec{}, "", rookv1.Placement{}, rookv1.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
// Start the first time
err := c.Start()
@@ -95,12 +95,12 @@ func createNode(nodeName string, condition v1.NodeConditionType, clientset *fake
func TestAddRemoveNode(t *testing.T) {
// create a storage spec with the given nodes/devices/dirs
nodeName := "node8230"
storageSpec := rookalpha.StorageScopeSpec{
Nodes: []rookalpha.Node{
storageSpec := rookv1.StorageScopeSpec{
Nodes: []rookv1.Node{
{
Name: nodeName,
Selection: rookalpha.Selection{
Devices: []rookalpha.Device{{Name: "sdx"}},
Selection: rookv1.Selection{
Devices: []rookv1.Device{{Name: "sdx"}},
},
},
},
@@ -130,7 +130,7 @@ func TestAddRemoveNode(t *testing.T) {
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: executor}, "ns-add-remove", "myversion", cephv1.CephVersionSpec{},
storageSpec, "/foo", rookalpha.Placement{}, rookalpha.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
storageSpec, "/foo", rookv1.Placement{}, rookv1.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
// kick off the start of the orchestration in a goroutine
var startErr error
@@ -207,9 +207,9 @@ func TestAddRemoveNode(t *testing.T) {
}
// modify the storage spec to remove the node from the cluster
storageSpec.Nodes = []rookalpha.Node{}
storageSpec.Nodes = []rookv1.Node{}
c = New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: mockExec}, "ns-add-remove", "myversion", cephv1.CephVersionSpec{},
storageSpec, "", rookalpha.Placement{}, rookalpha.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
storageSpec, "", rookv1.Placement{}, rookv1.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
// reset the orchestration status watcher
statusMapWatcher = watch.NewFake()
@@ -237,12 +237,12 @@ func TestAddRemoveNode(t *testing.T) {
func TestAddNodeFailure(t *testing.T) {
// create a storage spec with the given nodes/devices/dirs
nodeName := "node1672"
storageSpec := rookalpha.StorageScopeSpec{
Nodes: []rookalpha.Node{
storageSpec := rookv1.StorageScopeSpec{
Nodes: []rookv1.Node{
{
Name: nodeName,
Selection: rookalpha.Selection{
Devices: []rookalpha.Device{{Name: "sdx"}},
Selection: rookv1.Selection{
Devices: []rookv1.Device{{Name: "sdx"}},
},
},
},
@@ -266,7 +266,7 @@ func TestAddNodeFailure(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns-add-remove", "myversion", cephv1.CephVersionSpec{},
storageSpec, "/foo", rookalpha.Placement{}, rookalpha.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
storageSpec, "/foo", rookv1.Placement{}, rookv1.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
// kick off the start of the orchestration in a goroutine
var startErr error
@@ -286,7 +286,7 @@ func TestAddNodeFailure(t *testing.T) {
func TestGetOSDInfo(t *testing.T) {
c := New(&cephconfig.ClusterInfo{}, &clusterd.Context{}, "ns", "myversion", cephv1.CephVersionSpec{},
rookalpha.StorageScopeSpec{}, "", rookalpha.Placement{}, rookalpha.Annotations{}, cephv1.NetworkSpec{},
rookv1.StorageScopeSpec{}, "", rookv1.Placement{}, rookv1.Annotations{}, cephv1.NetworkSpec{},
v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
node := "n1"
@@ -296,7 +296,7 @@ func TestGetOSDInfo(t *testing.T) {
osdProp := osdProperties{
crushHostname: node,
pvc: v1.PersistentVolumeClaimVolumeSource{ClaimName: "pvc"},
selection: rookalpha.Selection{},
selection: rookv1.Selection{},
resources: v1.ResourceRequirements{},
storeConfig: config.StoreConfig{},
}
+15 -15
View File
@@ -21,7 +21,7 @@ import (
"testing"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
"github.com/rook/rook/pkg/operator/ceph/cluster/osd/config"
@@ -40,7 +40,7 @@ func TestPodContainer(t *testing.T) {
cluster := &Cluster{Namespace: "myosd", rookVersion: "23", cephVersion: cephv1.CephVersionSpec{}, clusterInfo: &cephconfig.ClusterInfo{}}
osdProps := osdProperties{
crushHostname: "node",
devices: []rookalpha.Device{},
devices: []rookv1.Device{},
resources: v1.ResourceRequirements{},
storeConfig: config.StoreConfig{},
}
@@ -72,11 +72,11 @@ func TestDaemonset(t *testing.T) {
}
func testPodDevices(t *testing.T, dataDir, deviceName string, allDevices bool) {
storageSpec := rookalpha.StorageScopeSpec{
Selection: rookalpha.Selection{UseAllDevices: &allDevices, DeviceFilter: deviceName},
Nodes: []rookalpha.Node{{Name: "node1"}},
storageSpec := rookv1.StorageScopeSpec{
Selection: rookv1.Selection{UseAllDevices: &allDevices, DeviceFilter: deviceName},
Nodes: []rookv1.Node{{Name: "node1"}},
}
devices := []rookalpha.Device{
devices := []rookv1.Device{
{Name: deviceName},
}
@@ -86,7 +86,7 @@ func testPodDevices(t *testing.T, dataDir, deviceName string, allDevices bool) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "rook/rook:myversion", cephVersion,
storageSpec, dataDir, rookalpha.Placement{}, rookalpha.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
storageSpec, dataDir, rookv1.Placement{}, rookv1.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
devMountNeeded := deviceName != "" || allDevices
@@ -234,8 +234,8 @@ func verifyEnvVar(t *testing.T, envVars []v1.EnvVar, expectedName, expectedValue
}
func TestStorageSpecConfig(t *testing.T) {
storageSpec := rookalpha.StorageScopeSpec{
Nodes: []rookalpha.Node{
storageSpec := rookv1.StorageScopeSpec{
Nodes: []rookv1.Node{
{
Name: "node1",
Config: map[string]string{
@@ -243,7 +243,7 @@ func TestStorageSpecConfig(t *testing.T) {
"walSizeMB": "20",
"metadataDevice": "nvme093",
},
Selection: rookalpha.Selection{},
Selection: rookv1.Selection{},
Resources: v1.ResourceRequirements{
Limits: v1.ResourceList{
v1.ResourceCPU: *resource.NewQuantity(1024.0, resource.BinarySI),
@@ -263,7 +263,7 @@ func TestStorageSpecConfig(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "rook/rook:myversion", cephv1.CephVersionSpec{},
storageSpec, "", rookalpha.Placement{}, rookalpha.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
storageSpec, "", rookv1.Placement{}, rookv1.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
n := c.DesiredStorage.ResolveNode(storageSpec.Nodes[0].Name)
storeConfig := config.ToStoreConfig(storageSpec.Nodes[0].Config)
@@ -296,8 +296,8 @@ func TestStorageSpecConfig(t *testing.T) {
}
func TestHostNetwork(t *testing.T) {
storageSpec := rookalpha.StorageScopeSpec{
Nodes: []rookalpha.Node{
storageSpec := rookv1.StorageScopeSpec{
Nodes: []rookv1.Node{
{
Name: "node1",
Config: map[string]string{
@@ -313,7 +313,7 @@ func TestHostNetwork(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "myversion", cephv1.CephVersionSpec{},
storageSpec, "", rookalpha.Placement{}, rookalpha.Annotations{}, cephv1.NetworkSpec{HostNetwork: true}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
storageSpec, "", rookv1.Placement{}, rookv1.Annotations{}, cephv1.NetworkSpec{HostNetwork: true}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
n := c.DesiredStorage.ResolveNode(storageSpec.Nodes[0].Name)
osd := OSDInfo{
@@ -355,7 +355,7 @@ func TestOsdOnSDNFlag(t *testing.T) {
func TestOsdPrepareResources(t *testing.T) {
clientset := fake.NewSimpleClientset()
c := New(&cephconfig.ClusterInfo{}, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "myversion", cephv1.CephVersionSpec{},
rookalpha.StorageScopeSpec{}, "", rookalpha.Placement{}, rookalpha.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
rookv1.StorageScopeSpec{}, "", rookv1.Placement{}, rookv1.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
// TEST 2: NOT running on PVC and some prepareResources are specificied
rr := v1.ResourceRequirements{
+2 -2
View File
@@ -22,7 +22,7 @@ import (
"time"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
cephver "github.com/rook/rook/pkg/operator/ceph/version"
@@ -42,7 +42,7 @@ func TestOrchestrationStatus(t *testing.T) {
CephVersion: cephver.Nautilus,
}
c := New(clusterInfo, &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "myversion", cephv1.CephVersionSpec{},
rookalpha.StorageScopeSpec{}, "", rookalpha.Placement{}, rookalpha.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
rookv1.StorageScopeSpec{}, "", rookv1.Placement{}, rookv1.Annotations{}, cephv1.NetworkSpec{}, v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
kv := k8sutil.NewConfigMapKVStore(c.Namespace, clientset, metav1.OwnerReference{})
nodeName := "mynode"
cmName := fmt.Sprintf(orchestrationStatusMapName, nodeName)
+5 -5
View File
@@ -24,7 +24,7 @@ import (
"github.com/coreos/pkg/capnslog"
"github.com/pkg/errors"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/daemon/ceph/client"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
@@ -51,8 +51,8 @@ const (
type Mirroring struct {
ClusterInfo *cephconfig.ClusterInfo
Namespace string
placement rookalpha.Placement
annotations rookalpha.Annotations
placement rookv1.Placement
annotations rookv1.Annotations
context *clusterd.Context
resources v1.ResourceRequirements
priorityClassName string
@@ -71,8 +71,8 @@ func New(
context *clusterd.Context,
namespace, rookVersion string,
cephVersion cephv1.CephVersionSpec,
placement rookalpha.Placement,
annotations rookalpha.Annotations,
placement rookv1.Placement,
annotations rookv1.Annotations,
network cephv1.NetworkSpec,
spec cephv1.RBDMirroringSpec,
resources v1.ResourceRequirements,
+3 -3
View File
@@ -20,7 +20,7 @@ import (
"testing"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
testop "github.com/rook/rook/pkg/operator/test"
@@ -50,8 +50,8 @@ func TestRBDMirror(t *testing.T) {
"ns",
"rook/rook:myversion",
cephv1.CephVersionSpec{Image: "ceph/ceph:myceph"},
rookalpha.Placement{},
rookalpha.Annotations{},
rookv1.Placement{},
rookv1.Annotations{},
cephv1.NetworkSpec{},
cephv1.RBDMirroringSpec{Workers: 2},
v1.ResourceRequirements{},
+3 -3
View File
@@ -20,7 +20,7 @@ import (
"testing"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
"github.com/rook/rook/pkg/operator/ceph/config"
@@ -40,8 +40,8 @@ func TestPodSpec(t *testing.T) {
"ns",
"rook/rook:myversion",
cephv1.CephVersionSpec{Image: "ceph/ceph:myceph"},
rookalpha.Placement{},
rookalpha.Annotations{},
rookv1.Placement{},
rookv1.Annotations{},
cephv1.NetworkSpec{},
cephv1.RBDMirroringSpec{Workers: 2},
v1.ResourceRequirements{
+2 -2
View File
@@ -27,7 +27,7 @@ import (
"time"
cockroachdbv1alpha1 "github.com/rook/rook/pkg/apis/cockroachdb.rook.io/v1alpha1"
rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
appsv1 "k8s.io/api/apps/v1"
@@ -85,7 +85,7 @@ type cluster struct {
context *clusterd.Context
namespace string
spec cockroachdbv1alpha1.ClusterSpec
annotations rookv1alpha2.Annotations
annotations rookv1.Annotations
ownerRef metav1.OwnerReference
}
+8 -8
View File
@@ -22,7 +22,7 @@ import (
"time"
cockroachdbv1alpha1 "github.com/rook/rook/pkg/apis/cockroachdb.rook.io/v1alpha1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
testop "github.com/rook/rook/pkg/operator/test"
@@ -38,7 +38,7 @@ import (
func TestValidateClusterSpec(t *testing.T) {
// invalid node count
spec := cockroachdbv1alpha1.ClusterSpec{
Storage: rookalpha.StorageScopeSpec{NodeCount: 0},
Storage: rookv1.StorageScopeSpec{NodeCount: 0},
Network: cockroachdbv1alpha1.NetworkSpec{
Ports: []cockroachdbv1alpha1.PortSpec{
{Name: "http", Port: 123},
@@ -52,7 +52,7 @@ func TestValidateClusterSpec(t *testing.T) {
// invalid cache percent
spec = cockroachdbv1alpha1.ClusterSpec{
Storage: rookalpha.StorageScopeSpec{NodeCount: 1},
Storage: rookv1.StorageScopeSpec{NodeCount: 1},
Network: cockroachdbv1alpha1.NetworkSpec{
Ports: []cockroachdbv1alpha1.PortSpec{
{Name: "http", Port: 123},
@@ -67,7 +67,7 @@ func TestValidateClusterSpec(t *testing.T) {
// invalid max SQL memory percent
spec = cockroachdbv1alpha1.ClusterSpec{
Storage: rookalpha.StorageScopeSpec{NodeCount: 1},
Storage: rookv1.StorageScopeSpec{NodeCount: 1},
Network: cockroachdbv1alpha1.NetworkSpec{
Ports: []cockroachdbv1alpha1.PortSpec{
{Name: "http", Port: 123},
@@ -82,7 +82,7 @@ func TestValidateClusterSpec(t *testing.T) {
// invalid port spec
spec = cockroachdbv1alpha1.ClusterSpec{
Storage: rookalpha.StorageScopeSpec{NodeCount: 1},
Storage: rookv1.StorageScopeSpec{NodeCount: 1},
Network: cockroachdbv1alpha1.NetworkSpec{
Ports: []cockroachdbv1alpha1.PortSpec{
{Name: "foo-port", Port: 123},
@@ -95,7 +95,7 @@ func TestValidateClusterSpec(t *testing.T) {
// valid spec
spec = cockroachdbv1alpha1.ClusterSpec{
Storage: rookalpha.StorageScopeSpec{NodeCount: 1},
Storage: rookv1.StorageScopeSpec{NodeCount: 1},
Network: cockroachdbv1alpha1.NetworkSpec{
Ports: []cockroachdbv1alpha1.PortSpec{
{Name: "http", Port: 123},
@@ -115,9 +115,9 @@ func TestOnAdd(t *testing.T) {
Namespace: namespace,
},
Spec: cockroachdbv1alpha1.ClusterSpec{
Storage: rookalpha.StorageScopeSpec{
Storage: rookv1.StorageScopeSpec{
NodeCount: 5,
Selection: rookalpha.Selection{
Selection: rookv1.Selection{
VolumeClaimTemplates: []v1.PersistentVolumeClaim{
{
ObjectMeta: metav1.ObjectMeta{
+5 -5
View File
@@ -26,7 +26,7 @@ import (
"time"
"github.com/coreos/pkg/capnslog"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
discoverDaemon "github.com/rook/rook/pkg/daemon/discover"
k8sutil "github.com/rook/rook/pkg/operator/k8sutil"
@@ -349,8 +349,8 @@ func matchDeviceFullPath(devLinks, fullpath string) bool {
}
// GetAvailableDevices conducts outer join using input filters with free devices that a node has. It marks the devices from join result as in-use.
func GetAvailableDevices(context *clusterd.Context, nodeName, clusterName string, devices []rookalpha.Device, filter string, useAllDevices bool) ([]rookalpha.Device, error) {
results := []rookalpha.Device{}
func GetAvailableDevices(context *clusterd.Context, nodeName, clusterName string, devices []rookv1.Device, filter string, useAllDevices bool) ([]rookv1.Device, error) {
results := []rookv1.Device{}
if len(devices) == 0 && len(filter) == 0 && !useAllDevices {
return results, nil
}
@@ -404,7 +404,7 @@ func GetAvailableDevices(context *clusterd.Context, nodeName, clusterName string
//TODO support filter based on other keys
matched, err := regexp.Match(filter, []byte(nodeDevices[i].Name))
if err == nil && matched {
d := rookalpha.Device{
d := rookv1.Device{
Name: nodeDevices[i].Name,
}
claimedDevices = append(claimedDevices, nodeDevices[i])
@@ -413,7 +413,7 @@ func GetAvailableDevices(context *clusterd.Context, nodeName, clusterName string
}
} else if useAllDevices {
for i := range nodeDevices {
d := rookalpha.Device{
d := rookv1.Device{
Name: nodeDevices[i].Name,
}
results = append(results, d)
+2 -2
View File
@@ -21,7 +21,7 @@ import (
"os"
"testing"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
discoverDaemon "github.com/rook/rook/pkg/daemon/discover"
"github.com/rook/rook/pkg/operator/k8sutil"
@@ -117,7 +117,7 @@ func TestGetAvailableDevices(t *testing.T) {
context := &clusterd.Context{
Clientset: clientset,
}
d := []rookalpha.Device{
d := []rookv1.Device{
{
Name: "sdc",
},
+3 -3
View File
@@ -23,7 +23,7 @@ import (
"github.com/google/go-cmp/cmp"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/edgefs/cluster/mgr"
"github.com/rook/rook/pkg/operator/edgefs/cluster/prepare"
@@ -312,8 +312,8 @@ func (c *cluster) validateClusterSpec() error {
func clusterChanged(oldCluster, newCluster edgefsv1.ClusterSpec) bool {
// sort the nodes by name then compare to see if there are changes
sort.Sort(rookv1alpha2.NodesByName(oldCluster.Storage.Nodes))
sort.Sort(rookv1alpha2.NodesByName(newCluster.Storage.Nodes))
sort.Sort(rookv1.NodesByName(oldCluster.Storage.Nodes))
sort.Sort(rookv1.NodesByName(newCluster.Storage.Nodes))
var diff string
// any change in the crd will trigger an orchestration
@@ -21,7 +21,7 @@ import (
"strings"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/operator/discover"
"github.com/rook/rook/pkg/operator/edgefs/cluster/target"
"github.com/rook/rook/pkg/operator/edgefs/cluster/target/config"
@@ -35,7 +35,7 @@ type ClusterReconfigureSpec struct {
ClusterNodesToAdd []string
}
func (c *cluster) createClusterReconfigurationSpec(existingConfig edgefsv1.ClusterDeploymentConfig, validNodes []rookv1alpha2.Node, dro edgefsv1.DevicesResurrectOptions) (ClusterReconfigureSpec, error) {
func (c *cluster) createClusterReconfigurationSpec(existingConfig edgefsv1.ClusterDeploymentConfig, validNodes []rookv1.Node, dro edgefsv1.DevicesResurrectOptions) (ClusterReconfigureSpec, error) {
deploymentType, err := c.getClusterDeploymentType()
if err != nil {
@@ -181,7 +181,7 @@ func getClusterTransportKey(deploymentType string) string {
}
// createDevicesConfig creates DevicesConfig for specific node
func (c *cluster) createDevicesConfig(deploymentType string, node rookv1alpha2.Node, dro edgefsv1.DevicesResurrectOptions) (edgefsv1.DevicesConfig, error) {
func (c *cluster) createDevicesConfig(deploymentType string, node rookv1.Node, dro edgefsv1.DevicesResurrectOptions) (edgefsv1.DevicesConfig, error) {
devicesConfig := edgefsv1.DevicesConfig{}
devicesConfig.Rtrd.Devices = make([]edgefsv1.RTDevice, 0)
devicesConfig.RtrdSlaves = make([]edgefsv1.RTDevices, 0)
+19 -19
View File
@@ -21,7 +21,7 @@ import (
"time"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
rookfake "github.com/rook/rook/pkg/client/clientset/versioned/fake"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
@@ -53,40 +53,40 @@ func TestClusterDelete(t *testing.T) {
func TestClusterChanged(t *testing.T) {
// a new node added, should be a change
old := edgefsv1.ClusterSpec{
Storage: rookalpha.StorageScopeSpec{
Nodes: []rookalpha.Node{
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
Storage: rookv1.StorageScopeSpec{
Nodes: []rookv1.Node{
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
},
},
}
new := edgefsv1.ClusterSpec{
Storage: rookalpha.StorageScopeSpec{
Nodes: []rookalpha.Node{
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
Storage: rookv1.StorageScopeSpec{
Nodes: []rookv1.Node{
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
},
},
}
assert.True(t, clusterChanged(old, new))
// a node was removed, should be a change
old.Storage.Nodes = []rookalpha.Node{
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
old.Storage.Nodes = []rookv1.Node{
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
}
new.Storage.Nodes = []rookalpha.Node{
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
new.Storage.Nodes = []rookv1.Node{
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
}
assert.True(t, clusterChanged(old, new))
// the nodes being in a different order should not be a change
old.Storage.Nodes = []rookalpha.Node{
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
old.Storage.Nodes = []rookv1.Node{
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
{Name: "node2", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
}
new.Storage.Nodes = []rookalpha.Node{
{Name: "node2", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
{Name: "node1", Selection: rookalpha.Selection{Devices: []rookalpha.Device{{Name: "sda"}}}},
new.Storage.Nodes = []rookv1.Node{
{Name: "node2", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
{Name: "node1", Selection: rookv1.Selection{Devices: []rookv1.Device{{Name: "sda"}}}},
}
assert.False(t, clusterChanged(old, new))
}
+7 -7
View File
@@ -25,7 +25,7 @@ import (
"github.com/coreos/pkg/capnslog"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
apps "k8s.io/api/apps/v1"
@@ -63,10 +63,10 @@ type Cluster struct {
Replicas int
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
annotations rookv1.Annotations
placement rookv1.Placement
context *clusterd.Context
NetworkSpec rookalpha.NetworkSpec
NetworkSpec rookv1.NetworkSpec
dashboardSpec edgefsv1.DashboardSpec
resources v1.ResourceRequirements
resourceProfile string
@@ -80,9 +80,9 @@ func New(
serviceAccount string,
dataDirHostPath string,
dataVolumeSize resource.Quantity,
annotations rookalpha.Annotations,
placement rookalpha.Placement,
NetworkSpec rookalpha.NetworkSpec,
annotations rookv1.Annotations,
placement rookv1.Placement,
NetworkSpec rookv1.NetworkSpec,
dashboardSpec edgefsv1.DashboardSpec,
resources v1.ResourceRequirements,
resourceProfile string,
+8 -8
View File
@@ -22,7 +22,7 @@ import (
"testing"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
testop "github.com/rook/rook/pkg/operator/test"
exectest "github.com/rook/rook/pkg/util/exec/test"
@@ -47,7 +47,7 @@ func TestStartMGR(t *testing.T) {
ConfigDir: configDir,
Clientset: clientset}
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
c := New(context, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{}, rookalpha.NetworkSpec{},
c := New(context, "ns", "myversion", "", "", *volSize, rookv1.Annotations{}, rookv1.Placement{}, rookv1.NetworkSpec{},
edgefsv1.DashboardSpec{}, v1.ResourceRequirements{}, "", metav1.OwnerReference{}, false)
// start a basic service
@@ -68,8 +68,8 @@ func validateStart(t *testing.T, c *Cluster) {
func TestPodSpec(t *testing.T) {
clientset := testop.New(t, 1)
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
c := New(&clusterd.Context{Clientset: clientset}, "ns", "rook/rook:myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{},
rookalpha.NetworkSpec{}, edgefsv1.DashboardSpec{}, v1.ResourceRequirements{
c := New(&clusterd.Context{Clientset: clientset}, "ns", "rook/rook:myversion", "", "", *volSize, rookv1.Annotations{}, rookv1.Placement{},
rookv1.NetworkSpec{}, edgefsv1.DashboardSpec{}, v1.ResourceRequirements{
Limits: v1.ResourceList{
v1.ResourceCPU: *resource.NewQuantity(100.0, resource.BinarySI),
},
@@ -110,8 +110,8 @@ func TestPodSpec(t *testing.T) {
func TestServiceSpec(t *testing.T) {
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
c := New(&clusterd.Context{}, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{},
rookalpha.NetworkSpec{}, edgefsv1.DashboardSpec{}, v1.ResourceRequirements{},
c := New(&clusterd.Context{}, "ns", "myversion", "", "", *volSize, rookv1.Annotations{}, rookv1.Placement{},
rookv1.NetworkSpec{}, edgefsv1.DashboardSpec{}, v1.ResourceRequirements{},
"", metav1.OwnerReference{}, false)
s := c.makeMgrService("rook-edgefs-mgr")
@@ -123,13 +123,13 @@ func TestServiceSpec(t *testing.T) {
func TestHostNetwork(t *testing.T) {
clientset := testop.New(t, 1)
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
net := rookalpha.NetworkSpec{
net := rookv1.NetworkSpec{
Provider: "host",
Selectors: map[string]string{
"server": "eth0",
},
}
c := New(&clusterd.Context{Clientset: clientset}, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{},
c := New(&clusterd.Context{Clientset: clientset}, "ns", "myversion", "", "", *volSize, rookv1.Annotations{}, rookv1.Placement{},
net, edgefsv1.DashboardSpec{}, v1.ResourceRequirements{},
"", metav1.OwnerReference{}, false)
@@ -22,7 +22,7 @@ import (
"fmt"
"github.com/coreos/pkg/capnslog"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
batch "k8s.io/api/batch/v1"
@@ -45,8 +45,8 @@ type Cluster struct {
Namespace string
Version string
serviceAccount string
annotations rookalpha.Annotations
placement rookalpha.Placement
annotations rookv1.Annotations
placement rookv1.Placement
context *clusterd.Context
resources v1.ResourceRequirements
ownerRef metav1.OwnerReference
@@ -57,8 +57,8 @@ type Cluster struct {
func New(
context *clusterd.Context, namespace, version string,
serviceAccount string,
annotations rookalpha.Annotations,
placement rookalpha.Placement,
annotations rookv1.Annotations,
placement rookv1.Placement,
resources v1.ResourceRequirements,
ownerRef metav1.OwnerReference,
) *Cluster {
+3 -3
View File
@@ -23,7 +23,7 @@ import (
"strings"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/operator/edgefs/cluster/target/config"
"github.com/rook/rook/pkg/util/sys"
"k8s.io/apimachinery/pkg/api/resource"
@@ -320,7 +320,7 @@ func getRTDevices(cntDevs ContainerDevices, storeConfig *config.StoreConfig) (rt
return rtDevices, nil
}
func GetRtlfsDevices(directories []rookalpha.Directory, storeConfig *config.StoreConfig) []edgefsv1.RtlfsDevice {
func GetRtlfsDevices(directories []rookv1.Directory, storeConfig *config.StoreConfig) []edgefsv1.RtlfsDevice {
rtlfsDevices := make([]edgefsv1.RtlfsDevice, 0)
walDisabled := 0
if storeConfig.WalMode > 0 {
@@ -347,7 +347,7 @@ func GetRtlfsDevices(directories []rookalpha.Directory, storeConfig *config.Stor
return rtlfsDevices
}
func GetRtkvsDevices(disks []string, directories []rookalpha.Directory, storeConfig *config.StoreConfig) edgefsv1.RtkvsDevices {
func GetRtkvsDevices(disks []string, directories []rookv1.Directory, storeConfig *config.StoreConfig) edgefsv1.RtkvsDevices {
rc := edgefsv1.RtkvsDevices{}
rc.Devices = make([]edgefsv1.RtkvsDevice, 0)
rc.Backend = storeConfig.UseRtkvsBackend
@@ -20,7 +20,7 @@ import (
"testing"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/edgefs/cluster/target/config"
exectest "github.com/rook/rook/pkg/util/exec/test"
@@ -32,13 +32,13 @@ import (
)
func TestStorageSpecConfig(t *testing.T) {
storageSpec := rookalpha.StorageScopeSpec{
storageSpec := rookv1.StorageScopeSpec{
Config: map[string]string{
"useAllSSD": "false",
"useBCacheWB": "true",
"useBCache": "true",
},
Nodes: []rookalpha.Node{
Nodes: []rookv1.Node{
{
Name: "node1",
Config: map[string]string{
@@ -46,8 +46,8 @@ func TestStorageSpecConfig(t *testing.T) {
"useAllSSD": "true",
"useMetadataOffload": "false",
},
Selection: rookalpha.Selection{
Devices: []rookalpha.Device{{Name: "sda"}, {Name: "sdb"}},
Selection: rookv1.Selection{
Devices: []rookv1.Device{{Name: "sda"}, {Name: "sdb"}},
},
Resources: v1.ResourceRequirements{
Limits: v1.ResourceList{
@@ -65,7 +65,7 @@ func TestStorageSpecConfig(t *testing.T) {
deploymentConfig := edgefsv1.ClusterDeploymentConfig{}
c := New(&clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}, "ns", "rook/rook:myversion", "",
storageSpec, "", *resource.NewQuantity(100000.0, resource.BinarySI),
rookalpha.Annotations{}, rookalpha.Placement{}, rookalpha.NetworkSpec{}, v1.ResourceRequirements{}, "", *resource.NewQuantity(0.0, resource.BinarySI),
rookv1.Annotations{}, rookv1.Placement{}, rookv1.NetworkSpec{}, v1.ResourceRequirements{}, "", *resource.NewQuantity(0.0, resource.BinarySI),
metav1.OwnerReference{}, deploymentConfig, false)
n := c.Storage.ResolveNode(storageSpec.Nodes[0].Name)
+10 -10
View File
@@ -23,7 +23,7 @@ import (
"github.com/coreos/pkg/capnslog"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
@@ -49,13 +49,13 @@ const (
type Cluster struct {
context *clusterd.Context
Namespace string
annotations rookalpha.Annotations
placement rookalpha.Placement
annotations rookv1.Annotations
placement rookv1.Placement
Version string
Storage rookalpha.StorageScopeSpec
Storage rookv1.StorageScopeSpec
dataDirHostPath string
dataVolumeSize resource.Quantity
NetworkSpec rookalpha.NetworkSpec
NetworkSpec rookv1.NetworkSpec
Privileged bool
resources v1.ResourceRequirements
resourceProfile string
@@ -72,12 +72,12 @@ func New(
namespace,
version,
serviceAccount string,
storageSpec rookalpha.StorageScopeSpec,
storageSpec rookv1.StorageScopeSpec,
dataDirHostPath string,
dataVolumeSize resource.Quantity,
annotations rookalpha.Annotations,
placement rookalpha.Placement,
NetworkSpec rookalpha.NetworkSpec,
annotations rookv1.Annotations,
placement rookv1.Placement,
NetworkSpec rookv1.NetworkSpec,
resources v1.ResourceRequirements,
resourceProfile string,
chunkCacheSize resource.Quantity,
@@ -113,7 +113,7 @@ func New(
}
// Start the target management
func (c *Cluster) Start(rookImage string, nodes []rookalpha.Node, dro edgefsv1.DevicesResurrectOptions) (err error) {
func (c *Cluster) Start(rookImage string, nodes []rookv1.Node, dro edgefsv1.DevicesResurrectOptions) (err error) {
logger.Infof("start running targets in namespace %s", c.Namespace)
logger.Infof("Target Image is %s", rookImage)
+5 -5
View File
@@ -24,7 +24,7 @@ import (
"time"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/operator/discover"
"github.com/rook/rook/pkg/operator/k8sutil"
v1 "k8s.io/api/core/v1"
@@ -84,7 +84,7 @@ func ToJSON(obj interface{}) string {
return string(bytes)
}
func (c *cluster) getClusterNodes() ([]rookv1alpha2.Node, error) {
func (c *cluster) getClusterNodes() ([]rookv1.Node, error) {
if c.Spec.Storage.UseAllNodes {
c.Spec.Storage.Nodes = nil
// Resolve all storage nodes
@@ -95,7 +95,7 @@ func (c *cluster) getClusterNodes() ([]rookv1alpha2.Node, error) {
return nil, err
}
for nodeName := range allNodeDevices {
storageNode := rookv1alpha2.Node{
storageNode := rookv1.Node{
Name: nodeName,
}
c.Spec.Storage.Nodes = append(c.Spec.Storage.Nodes, storageNode)
@@ -254,7 +254,7 @@ func (c *cluster) PrintDeploymentConfig(deploymentConfig *edgefsv1.ClusterDeploy
}
}
func (c *cluster) resolveNode(nodeName string) *rookv1alpha2.Node {
func (c *cluster) resolveNode(nodeName string) *rookv1.Node {
// Fully resolve the storage config and resources for this node
rookNode := c.Spec.Storage.ResolveNode(nodeName)
if rookNode == nil {
@@ -267,7 +267,7 @@ func (c *cluster) resolveNode(nodeName string) *rookv1alpha2.Node {
rookNode.Resources = k8sutil.MergeResourceRequirements(rookNode.Resources, c.Spec.Resources)
// Ensure no invalid dirs are specified
var validDirs []rookv1alpha2.Directory
var validDirs []rookv1.Directory
for _, dir := range rookNode.Directories {
if dir.Path == k8sutil.DataDir || dir.Path == c.Spec.DataDirHostPath {
logger.Warningf("skipping directory %s that would conflict with the dataDirHostPath", dir.Path)
+6 -6
View File
@@ -24,7 +24,7 @@ import (
"github.com/coreos/pkg/capnslog"
"github.com/google/go-cmp/cmp"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
v1 "k8s.io/api/core/v1"
@@ -54,11 +54,11 @@ type ISCSIController struct {
context *clusterd.Context
namespace string
rookImage string
NetworkSpec rookalpha.NetworkSpec
NetworkSpec rookv1.NetworkSpec
dataDirHostPath string
dataVolumeSize resource.Quantity
placement rookalpha.Placement
annotations rookalpha.Annotations
placement rookv1.Placement
annotations rookv1.Annotations
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
@@ -70,10 +70,10 @@ func NewISCSIController(
context *clusterd.Context,
namespace string,
rookImage string,
NetworkSpec rookalpha.NetworkSpec,
NetworkSpec rookv1.NetworkSpec,
dataDirHostPath string,
dataVolumeSize resource.Quantity,
placement rookalpha.Placement,
placement rookv1.Placement,
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
+6 -6
View File
@@ -24,7 +24,7 @@ import (
"github.com/coreos/pkg/capnslog"
"github.com/google/go-cmp/cmp"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
v1 "k8s.io/api/core/v1"
@@ -54,11 +54,11 @@ type ISGWController struct {
context *clusterd.Context
namespace string
rookImage string
NetworkSpec rookalpha.NetworkSpec
NetworkSpec rookv1.NetworkSpec
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
annotations rookv1.Annotations
placement rookv1.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
@@ -70,10 +70,10 @@ func NewISGWController(
context *clusterd.Context,
namespace string,
rookImage string,
NetworkSpec rookalpha.NetworkSpec,
NetworkSpec rookv1.NetworkSpec,
dataDirHostPath string,
dataVolumeSize resource.Quantity,
placement rookalpha.Placement,
placement rookv1.Placement,
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
+6 -6
View File
@@ -24,7 +24,7 @@ import (
"github.com/coreos/pkg/capnslog"
"github.com/google/go-cmp/cmp"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
v1 "k8s.io/api/core/v1"
@@ -54,11 +54,11 @@ type NFSController struct {
context *clusterd.Context
namespace string
rookImage string
NetworkSpec rookalpha.NetworkSpec
NetworkSpec rookv1.NetworkSpec
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
annotations rookv1.Annotations
placement rookv1.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
@@ -70,10 +70,10 @@ func NewNFSController(
context *clusterd.Context,
namespace string,
rookImage string,
NetworkSpec rookalpha.NetworkSpec,
NetworkSpec rookv1.NetworkSpec,
dataDirHostPath string,
dataVolumeSize resource.Quantity,
placement rookalpha.Placement,
placement rookv1.Placement,
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
+6 -6
View File
@@ -24,7 +24,7 @@ import (
"github.com/coreos/pkg/capnslog"
"github.com/google/go-cmp/cmp"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
v1 "k8s.io/api/core/v1"
@@ -54,11 +54,11 @@ type S3Controller struct {
context *clusterd.Context
namespace string
rookImage string
NetworkSpec rookalpha.NetworkSpec
NetworkSpec rookv1.NetworkSpec
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
annotations rookv1.Annotations
placement rookv1.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
@@ -70,10 +70,10 @@ func NewS3Controller(
context *clusterd.Context,
namespace string,
rookImage string,
NetworkSpec rookalpha.NetworkSpec,
NetworkSpec rookv1.NetworkSpec,
dataDirHostPath string,
dataVolumeSize resource.Quantity,
placement rookalpha.Placement,
placement rookv1.Placement,
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
+6 -6
View File
@@ -24,7 +24,7 @@ import (
"github.com/coreos/pkg/capnslog"
"github.com/google/go-cmp/cmp"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
v1 "k8s.io/api/core/v1"
@@ -54,11 +54,11 @@ type S3XController struct {
context *clusterd.Context
namespace string
rookImage string
NetworkSpec rookalpha.NetworkSpec
NetworkSpec rookv1.NetworkSpec
dataDirHostPath string
dataVolumeSize resource.Quantity
annotations rookalpha.Annotations
placement rookalpha.Placement
annotations rookv1.Annotations
placement rookv1.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
@@ -70,10 +70,10 @@ func NewS3XController(
context *clusterd.Context,
namespace string,
rookImage string,
NetworkSpec rookalpha.NetworkSpec,
NetworkSpec rookv1.NetworkSpec,
dataDirHostPath string,
dataVolumeSize resource.Quantity,
placement rookalpha.Placement,
placement rookv1.Placement,
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
+5 -5
View File
@@ -24,7 +24,7 @@ import (
"github.com/coreos/pkg/capnslog"
"github.com/google/go-cmp/cmp"
edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
v1 "k8s.io/api/core/v1"
@@ -54,10 +54,10 @@ type SWIFTController struct {
context *clusterd.Context
namespace string
rookImage string
NetworkSpec rookalpha.NetworkSpec
NetworkSpec rookv1.NetworkSpec
dataDirHostPath string
dataVolumeSize resource.Quantity
placement rookalpha.Placement
placement rookv1.Placement
resources v1.ResourceRequirements
resourceProfile string
ownerRef metav1.OwnerReference
@@ -69,10 +69,10 @@ func NewSWIFTController(
context *clusterd.Context,
namespace string,
rookImage string,
NetworkSpec rookalpha.NetworkSpec,
NetworkSpec rookv1.NetworkSpec,
dataDirHostPath string,
dataVolumeSize resource.Quantity,
placement rookalpha.Placement,
placement rookv1.Placement,
resources v1.ResourceRequirements,
resourceProfile string,
ownerRef metav1.OwnerReference,
+3 -3
View File
@@ -21,7 +21,7 @@ import (
"fmt"
"strings"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -85,7 +85,7 @@ func GetMultusIfName(selector string) (string, error) {
// ApplyMultus apply multus selector to Pods
// Multus supports short and json syntax, use only one kind at a time.
func ApplyMultus(net rookalpha.NetworkSpec, objectMeta *metav1.ObjectMeta) error {
func ApplyMultus(net rookv1.NetworkSpec, objectMeta *metav1.ObjectMeta) error {
v := make([]string, 0, 2)
shortSyntax := false
jsonSyntax := false
@@ -112,7 +112,7 @@ func ApplyMultus(net rookalpha.NetworkSpec, objectMeta *metav1.ObjectMeta) error
networks = "[" + networks + "]"
}
t := rookalpha.Annotations{
t := rookv1.Annotations{
"k8s.v1.cni.cncf.io/networks": networks,
}
t.ApplyToObjectMeta(objectMeta)
+4 -4
View File
@@ -19,7 +19,7 @@ package k8sutil
import (
"testing"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/stretchr/testify/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -77,7 +77,7 @@ func TestNetwork_parseMultusSelectorError(t *testing.T) {
}
func TestNetwork_ApplyMultusShort(t *testing.T) {
net := rookalpha.NetworkSpec{
net := rookv1.NetworkSpec{
Provider: "multus",
Selectors: map[string]string{
"server": "macvlan@net1",
@@ -94,7 +94,7 @@ func TestNetwork_ApplyMultusShort(t *testing.T) {
}
func TestNetwork_ApplyMultusJSON(t *testing.T) {
net := rookalpha.NetworkSpec{
net := rookv1.NetworkSpec{
Provider: "multus",
Selectors: map[string]string{
"server": `{"name": "macvlan", "interface": "net1"}`,
@@ -111,7 +111,7 @@ func TestNetwork_ApplyMultusJSON(t *testing.T) {
}
func TestNetwork_ApplyMultusMixedError(t *testing.T) {
net := rookalpha.NetworkSpec{
net := rookv1.NetworkSpec{
Provider: "multus",
Selectors: map[string]string{
"server": `{"name": "macvlan", "interface": "net1"}`,
+11 -11
View File
@@ -23,7 +23,7 @@ import (
"k8s.io/apimachinery/pkg/util/validation"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
@@ -44,7 +44,7 @@ var validTopologyLabelKeys = []string{
// ValidNodeNoSched returns true if the node (1) meets Rook's placement terms,
// and (2) is ready. Unlike ValidNode, this method will ignore the
// Node.Spec.Unschedulable flag. False otherwise.
func ValidNodeNoSched(node v1.Node, placement rookalpha.Placement) (bool, error) {
func ValidNodeNoSched(node v1.Node, placement rookv1.Placement) (bool, error) {
p, err := NodeMeetsPlacementTerms(node, placement, false)
if err != nil {
return false, fmt.Errorf("failed to check if node meets Rook placement terms. %+v", err)
@@ -62,7 +62,7 @@ func ValidNodeNoSched(node v1.Node, placement rookalpha.Placement) (bool, error)
// ValidNode returns true if the node (1) is schedulable, (2) meets Rook's placement terms, and
// (3) is ready. False otherwise.
func ValidNode(node v1.Node, placement rookalpha.Placement) (bool, error) {
func ValidNode(node v1.Node, placement rookv1.Placement) (bool, error) {
if !GetNodeSchedulable(node) {
return false, nil
}
@@ -72,12 +72,12 @@ func ValidNode(node v1.Node, placement rookalpha.Placement) (bool, error) {
// GetValidNodes returns all nodes that (1) are not cordoned, (2) meet Rook's placement terms, and
// (3) are ready.
func GetValidNodes(rookStorage rookalpha.StorageScopeSpec, clientset kubernetes.Interface, placement rookalpha.Placement) []rookalpha.Node {
func GetValidNodes(rookStorage rookv1.StorageScopeSpec, clientset kubernetes.Interface, placement rookv1.Placement) []rookv1.Node {
matchingK8sNodes, err := GetKubernetesNodesMatchingRookNodes(rookStorage.Nodes, clientset)
if err != nil {
// cannot list nodes, return empty nodes
logger.Errorf("failed to list nodes: %+v", err)
return []rookalpha.Node{}
return []rookv1.Node{}
}
validK8sNodes := []v1.Node{}
@@ -163,7 +163,7 @@ func GetNodeSchedulable(node v1.Node) bool {
// and (2) its taints are tolerated by the placements tolerations.
// There is the option to ignore well known taints defined in WellKnownTaints. See WellKnownTaints
// for more information.
func NodeMeetsPlacementTerms(node v1.Node, placement rookalpha.Placement, ignoreWellKnownTaints bool) (bool, error) {
func NodeMeetsPlacementTerms(node v1.Node, placement rookv1.Placement, ignoreWellKnownTaints bool) (bool, error) {
a, err := NodeMeetsAffinityTerms(node, placement.NodeAffinity)
if err != nil {
return false, fmt.Errorf("failed to check if node %s meets affinity terms. regarding as not match. %+v", node.Name, err)
@@ -229,7 +229,7 @@ func NodeIsReady(node v1.Node) bool {
return false
}
func rookNodeMatchesKubernetesNode(rookNode rookalpha.Node, kubernetesNode v1.Node) bool {
func rookNodeMatchesKubernetesNode(rookNode rookv1.Node, kubernetesNode v1.Node) bool {
hostname := normalizeHostname(kubernetesNode)
return rookNode.Name == hostname || rookNode.Name == kubernetesNode.Name
}
@@ -245,7 +245,7 @@ func normalizeHostname(kubernetesNode v1.Node) string {
// GetKubernetesNodesMatchingRookNodes lists all the nodes in Kubernetes and returns all the
// Kubernetes nodes that have a corresponding match in the list of Rook nodes.
func GetKubernetesNodesMatchingRookNodes(rookNodes []rookalpha.Node, clientset kubernetes.Interface) ([]v1.Node, error) {
func GetKubernetesNodesMatchingRookNodes(rookNodes []rookv1.Node, clientset kubernetes.Interface) ([]v1.Node, error) {
nodes := []v1.Node{}
nodeOptions := metav1.ListOptions{}
nodeOptions.TypeMeta.Kind = "Node"
@@ -265,8 +265,8 @@ func GetKubernetesNodesMatchingRookNodes(rookNodes []rookalpha.Node, clientset k
// RookNodesMatchingKubernetesNodes returns only the given Rook nodes which have a corresponding
// match in the list of Kubernetes nodes.
func RookNodesMatchingKubernetesNodes(rookStorage rookalpha.StorageScopeSpec, kubernetesNodes []v1.Node) []rookalpha.Node {
nodes := []rookalpha.Node{}
func RookNodesMatchingKubernetesNodes(rookStorage rookv1.StorageScopeSpec, kubernetesNodes []v1.Node) []rookv1.Node {
nodes := []rookv1.Node{}
for _, kn := range kubernetesNodes {
for _, rn := range rookStorage.Nodes {
if rookNodeMatchesKubernetesNode(rn, kn) {
@@ -300,7 +300,7 @@ func nodeTopologyLocation(kubeNode v1.Node, location string) string {
}
// NodeIsInRookNodeList will return true if the target node is found in a given list of Rook nodes.
func NodeIsInRookNodeList(targetNodeName string, rookNodes []rookalpha.Node) bool {
func NodeIsInRookNodeList(targetNodeName string, rookNodes []rookv1.Node) bool {
for _, rn := range rookNodes {
if targetNodeName == rn.Name {
return true
+18 -18
View File
@@ -21,7 +21,7 @@ import (
"reflect"
"testing"
rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
optest "github.com/rook/rook/pkg/operator/test"
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
@@ -51,8 +51,8 @@ func TestValidNode(t *testing.T) {
nodeA := "nodeA"
nodeB := "nodeB"
storage := rookalpha.StorageScopeSpec{
Nodes: []rookalpha.Node{
storage := rookv1.StorageScopeSpec{
Nodes: []rookv1.Node{
{
Name: nodeA,
},
@@ -61,7 +61,7 @@ func TestValidNode(t *testing.T) {
},
},
}
var placement rookalpha.Placement
var placement rookv1.Placement
// set up a fake k8s client set and watcher to generate events that the operator will listen to
clientset := fake.NewSimpleClientset()
@@ -209,7 +209,7 @@ func TestNodeIsReady(t *testing.T) {
func TestGetRookNodesMatchingKubernetesNodes(t *testing.T) {
clientset := optest.New(t, 3) // create nodes 0, 1, and 2
rookNodes := []rookalpha.Node{}
rookNodes := []rookv1.Node{}
getNode := func(name string) v1.Node {
n, err := clientset.CoreV1().Nodes().Get(name, metav1.GetOptions{})
@@ -223,7 +223,7 @@ func TestGetRookNodesMatchingKubernetesNodes(t *testing.T) {
assert.Empty(t, nodes)
// more rook nodes specified than nodes exist
rookNodes = []rookalpha.Node{
rookNodes = []rookv1.Node{
{Name: "node0"},
{Name: "node2"},
{Name: "node5"}}
@@ -234,7 +234,7 @@ func TestGetRookNodesMatchingKubernetesNodes(t *testing.T) {
assert.Contains(t, nodes, getNode("node2"))
// rook nodes match k8s nodes
rookNodes = []rookalpha.Node{
rookNodes = []rookv1.Node{
{Name: "node0"},
{Name: "node1"},
{Name: "node2"}}
@@ -268,33 +268,33 @@ func TestRookNodesMatchingKubernetesNodes(t *testing.T) {
k8sNodes := []v1.Node{n0, n1, n2}
// no rook nodes specified for input
rookStorage := rookalpha.StorageScopeSpec{
Nodes: []rookalpha.Node{},
rookStorage := rookv1.StorageScopeSpec{
Nodes: []rookv1.Node{},
}
retNodes := RookNodesMatchingKubernetesNodes(rookStorage, k8sNodes)
assert.Len(t, retNodes, 0)
// all rook nodes specified
rookStorage.Nodes = []rookalpha.Node{
rookStorage.Nodes = []rookv1.Node{
{Name: "node0"},
{Name: "node1"},
{Name: "node2"}}
retNodes = RookNodesMatchingKubernetesNodes(rookStorage, k8sNodes)
assert.Len(t, retNodes, 3)
// this should return nodes named by hostname if that is available
assert.Contains(t, retNodes, rookalpha.Node{Name: "node0-hostname"})
assert.Contains(t, retNodes, rookalpha.Node{Name: "node1"})
assert.Contains(t, retNodes, rookalpha.Node{Name: "node2"})
assert.Contains(t, retNodes, rookv1.Node{Name: "node0-hostname"})
assert.Contains(t, retNodes, rookv1.Node{Name: "node1"})
assert.Contains(t, retNodes, rookv1.Node{Name: "node2"})
// more rook nodes specified than exist
rookStorage.Nodes = []rookalpha.Node{
rookStorage.Nodes = []rookv1.Node{
{Name: "node0-hostname"},
{Name: "node2"},
{Name: "node5"}}
retNodes = RookNodesMatchingKubernetesNodes(rookStorage, k8sNodes)
assert.Len(t, retNodes, 2)
assert.Contains(t, retNodes, rookalpha.Node{Name: "node0-hostname"})
assert.Contains(t, retNodes, rookalpha.Node{Name: "node2"})
assert.Contains(t, retNodes, rookv1.Node{Name: "node0-hostname"})
assert.Contains(t, retNodes, rookv1.Node{Name: "node2"})
// no k8s nodes specified
retNodes = RookNodesMatchingKubernetesNodes(rookStorage, []v1.Node{})
@@ -302,11 +302,11 @@ func TestRookNodesMatchingKubernetesNodes(t *testing.T) {
}
func TestNodeIsInRookList(t *testing.T) {
rookNodes := []rookalpha.Node{}
rookNodes := []rookv1.Node{}
assert.False(t, NodeIsInRookNodeList("node0", rookNodes))
rookNodes = []rookalpha.Node{
rookNodes = []rookv1.Node{
{Name: "node0-hostname"},
{Name: "node2"},
{Name: "node5"}}
+4 -5
View File
@@ -19,18 +19,17 @@ package k8sutil
import (
"fmt"
rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
"io"
"os"
"path"
"strconv"
"strings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)
const (
@@ -295,7 +294,7 @@ func ClusterDaemonEnvVars(image string) []v1.EnvVar {
}
// SetNodeAntiAffinityForPod assign pod anti-affinity when pod should not be co-located
func SetNodeAntiAffinityForPod(pod *v1.PodSpec, p rook.Placement, requiredDuringScheduling, preferredDuringScheduling bool,
func SetNodeAntiAffinityForPod(pod *v1.PodSpec, p rookv1.Placement, requiredDuringScheduling, preferredDuringScheduling bool,
labels, nodeSelector map[string]string) {
p.ApplyToPodSpec(pod)
pod.NodeSelector = nodeSelector
+5 -5
View File
@@ -16,10 +16,10 @@ limitations under the License.
package k8sutil
import (
rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
"os"
"testing"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -176,7 +176,7 @@ func TestAddUnreachableNodeToleration(t *testing.T) {
}
func testPodSpecPlacement(t *testing.T, requiredDuringScheduling, preferredDuringScheduling bool, req, pref int, placement *rook.Placement) {
func testPodSpecPlacement(t *testing.T, requiredDuringScheduling, preferredDuringScheduling bool, req, pref int, placement *rookv1.Placement) {
spec := v1.PodSpec{
InitContainers: []v1.Container{},
Containers: []v1.Container{},
@@ -194,8 +194,8 @@ func testPodSpecPlacement(t *testing.T, requiredDuringScheduling, preferredDurin
len(spec.Affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution))
}
func makePlacement() rook.Placement {
return rook.Placement{
func makePlacement() rookv1.Placement {
return rookv1.Placement{
PodAntiAffinity: &v1.PodAntiAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []v1.PodAffinityTerm{
{
@@ -215,7 +215,7 @@ func makePlacement() rook.Placement {
func TestPodSpecPlacement(t *testing.T) {
// no placement settings in the crd
p := rook.Placement{}
p := rookv1.Placement{}
testPodSpecPlacement(t, true, true, 1, 0, &p)
testPodSpecPlacement(t, true, false, 1, 0, &p)
testPodSpecPlacement(t, false, true, 0, 1, &p)
+2 -2
View File
@@ -21,7 +21,7 @@ import (
"reflect"
"strings"
rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2"
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
yugabytedbv1alpha1 "github.com/rook/rook/pkg/apis/yugabytedb.rook.io/v1alpha1"
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
@@ -99,7 +99,7 @@ type cluster struct {
name string
namespace string
spec yugabytedbv1alpha1.YBClusterSpec
annotations rookv1alpha2.Annotations
annotations rookv1.Annotations
ownerRef metav1.OwnerReference
}