diff --git a/build/codegen/codegen.sh b/build/codegen/codegen.sh index 1a2adc458..354bc85ed 100755 --- a/build/codegen/codegen.sh +++ b/build/codegen/codegen.sh @@ -23,7 +23,7 @@ cd "${scriptdir}/../../vendor/k8s.io/code-generator" && ./generate-groups.sh \ all \ github.com/rook/rook/pkg/client \ github.com/rook/rook/pkg/apis \ - "rook.io:v1alpha2 ceph.rook.io:v1 cockroachdb.rook.io:v1alpha1 nfs.rook.io:v1alpha1 cassandra.rook.io:v1alpha1 edgefs.rook.io:v1 yugabytedb.rook.io:v1alpha1" + "rook.io:v1 rook.io:v1alpha2 ceph.rook.io:v1 cockroachdb.rook.io:v1alpha1 nfs.rook.io:v1alpha1 cassandra.rook.io:v1alpha1 edgefs.rook.io:v1 yugabytedb.rook.io:v1alpha1" # this seems busted in the release-1.8 branch # --go-header-file ${SCRIPT_ROOT}/build/codegen/header.txt diff --git a/pkg/apis/cassandra.rook.io/register.go b/pkg/apis/cassandra.rook.io/register.go index 916fd0e9d..6d454b1bc 100644 --- a/pkg/apis/cassandra.rook.io/register.go +++ b/pkg/apis/cassandra.rook.io/register.go @@ -17,6 +17,6 @@ limitations under the License. package cassandrarookio const ( - // GroupName for the cassandra operator's CRDs - GroupName = "cassandra.rook.io" + // CustomResourceGroupName for the cassandra operator's CRDs + CustomResourceGroupName = "cassandra.rook.io" ) diff --git a/pkg/apis/cassandra.rook.io/v1alpha1/register.go b/pkg/apis/cassandra.rook.io/v1alpha1/register.go index 1a84130b8..aa04a8c97 100644 --- a/pkg/apis/cassandra.rook.io/v1alpha1/register.go +++ b/pkg/apis/cassandra.rook.io/v1alpha1/register.go @@ -29,7 +29,7 @@ const ( ) // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: cassandrarookio.GroupName, Version: Version} +var SchemeGroupVersion = schema.GroupVersion{Group: cassandrarookio.CustomResourceGroupName, Version: Version} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { diff --git a/pkg/apis/cassandra.rook.io/v1alpha1/types.go b/pkg/apis/cassandra.rook.io/v1alpha1/types.go index 6b1565890..fc18652cf 100644 --- a/pkg/apis/cassandra.rook.io/v1alpha1/types.go +++ b/pkg/apis/cassandra.rook.io/v1alpha1/types.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha1 import ( - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -59,7 +59,7 @@ type ClusterList struct { // ClusterSpec is the desired state for a Cassandra Cluster. type ClusterSpec struct { // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.Annotations + Annotations rookv1.Annotations // Version of Cassandra to use. Version string `json:"version"` // Repository to pull the image from. @@ -98,11 +98,11 @@ type RackSpec struct { // User-provided ConfigMap for jmx prometheus exporter JMXExporterConfigMapName *string `json:"jmxExporterConfigMapName,omitempty"` // Storage describes the underlying storage that Cassandra will consume. - Storage rook.StorageScopeSpec `json:"storage"` + Storage rookv1.StorageScopeSpec `json:"storage"` // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.Annotations + Annotations rookv1.Annotations // Placement describes restrictions for the nodes Cassandra is scheduled on. - Placement *rook.Placement `json:"placement,omitempty"` + Placement *rookv1.Placement `json:"placement,omitempty"` // Resources the Cassandra Pods will use. Resources corev1.ResourceRequirements `json:"resources"` } diff --git a/pkg/apis/cassandra.rook.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/cassandra.rook.io/v1alpha1/zz_generated.deepcopy.go index bbf670619..c5035e0c0 100644 --- a/pkg/apis/cassandra.rook.io/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/cassandra.rook.io/v1alpha1/zz_generated.deepcopy.go @@ -21,7 +21,7 @@ limitations under the License. package v1alpha1 import ( - v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + v1 "github.com/rook/rook/pkg/apis/rook.io/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -91,7 +91,7 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { *out = *in if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(v1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -222,14 +222,14 @@ func (in *RackSpec) DeepCopyInto(out *RackSpec) { in.Storage.DeepCopyInto(&out.Storage) if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(v1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } } if in.Placement != nil { in, out := &in.Placement, &out.Placement - *out = new(v1alpha2.Placement) + *out = new(v1.Placement) (*in).DeepCopyInto(*out) } in.Resources.DeepCopyInto(&out.Resources) diff --git a/pkg/apis/ceph.rook.io/register.go b/pkg/apis/ceph.rook.io/register.go index 5b718c006..d722c3836 100644 --- a/pkg/apis/ceph.rook.io/register.go +++ b/pkg/apis/ceph.rook.io/register.go @@ -1,5 +1,5 @@ package cephrookio const ( - GroupName = "ceph.rook.io" + CustomResourceGroupName = "ceph.rook.io" ) diff --git a/pkg/apis/ceph.rook.io/v1/annotations.go b/pkg/apis/ceph.rook.io/v1/annotations.go index 0eecf9e01..af7b64f3b 100644 --- a/pkg/apis/ceph.rook.io/v1/annotations.go +++ b/pkg/apis/ceph.rook.io/v1/annotations.go @@ -17,7 +17,7 @@ limitations under the License. package v1 import ( - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rook "github.com/rook/rook/pkg/apis/rook.io/v1" ) // GetMgrAnnotations returns the Annotations for the MGR service diff --git a/pkg/apis/ceph.rook.io/v1/annotations_test.go b/pkg/apis/ceph.rook.io/v1/annotations_test.go index 0841b72ef..f66df6b74 100644 --- a/pkg/apis/ceph.rook.io/v1/annotations_test.go +++ b/pkg/apis/ceph.rook.io/v1/annotations_test.go @@ -19,7 +19,7 @@ package v1 import ( "testing" - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rook "github.com/rook/rook/pkg/apis/rook.io/v1" "github.com/stretchr/testify/assert" ) diff --git a/pkg/apis/ceph.rook.io/v1/keys.go b/pkg/apis/ceph.rook.io/v1/keys.go index da1d2fbcd..191f7cb6a 100644 --- a/pkg/apis/ceph.rook.io/v1/keys.go +++ b/pkg/apis/ceph.rook.io/v1/keys.go @@ -17,7 +17,7 @@ limitations under the License. package v1 import ( - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rook "github.com/rook/rook/pkg/apis/rook.io/v1" ) const ( diff --git a/pkg/apis/ceph.rook.io/v1/placement.go b/pkg/apis/ceph.rook.io/v1/placement.go index 38ea1d270..44895bd32 100644 --- a/pkg/apis/ceph.rook.io/v1/placement.go +++ b/pkg/apis/ceph.rook.io/v1/placement.go @@ -16,25 +16,25 @@ limitations under the License. package v1 import ( - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1" ) // GetMgrPlacement returns the placement for the MGR service -func GetMgrPlacement(p rook.PlacementSpec) rook.Placement { +func GetMgrPlacement(p rookv1.PlacementSpec) rookv1.Placement { return p.All().Merge(p[KeyMgr]) } // GetMonPlacement returns the placement for the MON service -func GetMonPlacement(p rook.PlacementSpec) rook.Placement { +func GetMonPlacement(p rookv1.PlacementSpec) rookv1.Placement { return p.All().Merge(p[KeyMon]) } // GetOSDPlacement returns the placement for the OSD service -func GetOSDPlacement(p rook.PlacementSpec) rook.Placement { +func GetOSDPlacement(p rookv1.PlacementSpec) rookv1.Placement { return p.All().Merge(p[KeyOSD]) } // GetRBDMirrorPlacement returns the placement for the RBD mirrors -func GetRBDMirrorPlacement(p rook.PlacementSpec) rook.Placement { +func GetRBDMirrorPlacement(p rookv1.PlacementSpec) rookv1.Placement { return p.All().Merge(p[KeyRBDMirror]) } diff --git a/pkg/apis/ceph.rook.io/v1/priorityclasses.go b/pkg/apis/ceph.rook.io/v1/priorityclasses.go index c9b75da1b..63c7ab2bc 100644 --- a/pkg/apis/ceph.rook.io/v1/priorityclasses.go +++ b/pkg/apis/ceph.rook.io/v1/priorityclasses.go @@ -17,7 +17,7 @@ limitations under the License. package v1 import ( - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rook "github.com/rook/rook/pkg/apis/rook.io/v1" ) // GetMgrPriorityClassName returns the priority class name for the MGR service diff --git a/pkg/apis/ceph.rook.io/v1/register.go b/pkg/apis/ceph.rook.io/v1/register.go index 6af35d349..c6cc940e6 100644 --- a/pkg/apis/ceph.rook.io/v1/register.go +++ b/pkg/apis/ceph.rook.io/v1/register.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The Rook Authors. All rights reserved. +Copyright 2020 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package v1 import ( @@ -29,7 +30,7 @@ const ( ) // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: cephrookio.GroupName, Version: Version} +var SchemeGroupVersion = schema.GroupVersion{Group: cephrookio.CustomResourceGroupName, Version: Version} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { diff --git a/pkg/apis/ceph.rook.io/v1/resources.go b/pkg/apis/ceph.rook.io/v1/resources.go index 4ab8c9104..bcbc359f2 100644 --- a/pkg/apis/ceph.rook.io/v1/resources.go +++ b/pkg/apis/ceph.rook.io/v1/resources.go @@ -17,7 +17,7 @@ limitations under the License. package v1 import ( - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rook "github.com/rook/rook/pkg/apis/rook.io/v1" v1 "k8s.io/api/core/v1" ) diff --git a/pkg/apis/ceph.rook.io/v1/spec_test.go b/pkg/apis/ceph.rook.io/v1/spec_test.go index bd36c2465..ed0127977 100644 --- a/pkg/apis/ceph.rook.io/v1/spec_test.go +++ b/pkg/apis/ceph.rook.io/v1/spec_test.go @@ -21,9 +21,8 @@ import ( "testing" "github.com/ghodss/yaml" + rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1" "github.com/stretchr/testify/assert" - - rookalpha "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" ) func TestClusterSpecMarshal(t *testing.T) { @@ -70,9 +69,9 @@ storage: Network: NetworkSpec{ HostNetwork: true, }, - Storage: rookalpha.StorageScopeSpec{ + Storage: rookv1.StorageScopeSpec{ UseAllNodes: false, - Selection: rookalpha.Selection{ + Selection: rookv1.Selection{ UseAllDevices: &useAllDevices, DeviceFilter: "^sd.", DevicePathFilter: "^/dev/disk/by-path/pci-.*", @@ -82,10 +81,10 @@ storage: "journalSizeMB": "1024", "databaseSizeMB": "1024", }, - Nodes: []rookalpha.Node{ + Nodes: []rookv1.Node{ { Name: "node2", - Selection: rookalpha.Selection{ + Selection: rookv1.Selection{ DeviceFilter: "^foo*", DevicePathFilter: "^/dev/disk/by-id/.*foo.*", }, diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go index 591ff8d97..4869ad368 100755 --- a/pkg/apis/ceph.rook.io/v1/types.go +++ b/pkg/apis/ceph.rook.io/v1/types.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The Rook Authors. All rights reserved. +Copyright 2020 The Rook Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,15 +13,15 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package v1 import ( "time" + rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" ) // *************************************************************************** @@ -54,22 +54,22 @@ type ClusterSpec struct { CephVersion CephVersionSpec `json:"cephVersion,omitempty"` // A spec for available storage in the cluster and how it should be used - Storage rook.StorageScopeSpec `json:"storage,omitempty"` + Storage rookv1.StorageScopeSpec `json:"storage,omitempty"` // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.AnnotationsSpec `json:"annotations,omitempty"` + Annotations rookv1.AnnotationsSpec `json:"annotations,omitempty"` // The placement-related configuration to pass to kubernetes (affinity, node selector, tolerations). - Placement rook.PlacementSpec `json:"placement,omitempty"` + Placement rookv1.PlacementSpec `json:"placement,omitempty"` // Network related configuration Network NetworkSpec `json:"network,omitempty"` // Resources set resource requests and limits - Resources rook.ResourceSpec `json:"resources,omitempty"` + Resources rookv1.ResourceSpec `json:"resources,omitempty"` // PriorityClassNames sets priority classes on components - PriorityClassNames rook.PriorityClassNamesSpec `json:"priorityClassNames,omitempty"` + PriorityClassNames rookv1.PriorityClassNamesSpec `json:"priorityClassNames,omitempty"` // The path on the host where config and data can be persisted. DataDirHostPath string `json:"dataDirHostPath,omitempty"` @@ -330,10 +330,10 @@ type MetadataServerSpec struct { ActiveStandby bool `json:"activeStandby"` // The affinity to place the mds pods (default is to place on all available node) with a daemonset - Placement rook.Placement `json:"placement"` + Placement rookv1.Placement `json:"placement"` // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.Annotations `json:"annotations,omitempty"` + Annotations rookv1.Annotations `json:"annotations,omitempty"` // The resource requirements for the rgw pods Resources v1.ResourceRequirements `json:"resources"` @@ -420,10 +420,10 @@ type GatewaySpec struct { SSLCertificateRef string `json:"sslCertificateRef"` // The affinity to place the rgw pods (default is to place on any available node) - Placement rook.Placement `json:"placement"` + Placement rookv1.Placement `json:"placement"` // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.Annotations `json:"annotations,omitempty"` + Annotations rookv1.Annotations `json:"annotations,omitempty"` // The resource requirements for the rgw pods Resources v1.ResourceRequirements `json:"resources"` @@ -471,10 +471,10 @@ type GaneshaServerSpec struct { Active int `json:"active"` // The affinity to place the ganesha pods - Placement rook.Placement `json:"placement"` + Placement rookv1.Placement `json:"placement"` // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.Annotations `json:"annotations,omitempty"` + Annotations rookv1.Annotations `json:"annotations,omitempty"` // Resources set resource requests and limits Resources v1.ResourceRequirements `json:"resources,omitempty"` @@ -485,7 +485,7 @@ type GaneshaServerSpec struct { // NetworkSpec for Ceph includes backward compatibility code type NetworkSpec struct { - rook.NetworkSpec `json:",inline"` + rookv1.NetworkSpec `json:",inline"` // HostNetwork to enable host network HostNetwork bool `json:"hostNetwork"` diff --git a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go index 58559f1ed..8e2495713 100644 --- a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go @@ -21,7 +21,7 @@ limitations under the License. package v1 import ( - v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rookiov1 "github.com/rook/rook/pkg/apis/rook.io/v1" corev1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -557,14 +557,14 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { in.Storage.DeepCopyInto(&out.Storage) if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.AnnotationsSpec, len(*in)) + *out = make(rookiov1.AnnotationsSpec, len(*in)) for key, val := range *in { var outVal map[string]string if val == nil { (*out)[key] = nil } else { in, out := &val, &outVal - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(rookiov1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -574,7 +574,7 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { } if in.Placement != nil { in, out := &in.Placement, &out.Placement - *out = make(v1alpha2.PlacementSpec, len(*in)) + *out = make(rookiov1.PlacementSpec, len(*in)) for key, val := range *in { (*out)[key] = *val.DeepCopy() } @@ -582,14 +582,14 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { in.Network.DeepCopyInto(&out.Network) if in.Resources != nil { in, out := &in.Resources, &out.Resources - *out = make(v1alpha2.ResourceSpec, len(*in)) + *out = make(rookiov1.ResourceSpec, len(*in)) for key, val := range *in { (*out)[key] = *val.DeepCopy() } } if in.PriorityClassNames != nil { in, out := &in.PriorityClassNames, &out.PriorityClassNames - *out = make(v1alpha2.PriorityClassNamesSpec, len(*in)) + *out = make(rookiov1.PriorityClassNamesSpec, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -807,7 +807,7 @@ func (in *GaneshaServerSpec) DeepCopyInto(out *GaneshaServerSpec) { in.Placement.DeepCopyInto(&out.Placement) if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(rookiov1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -832,7 +832,7 @@ func (in *GatewaySpec) DeepCopyInto(out *GatewaySpec) { in.Placement.DeepCopyInto(&out.Placement) if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(rookiov1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -857,7 +857,7 @@ func (in *MetadataServerSpec) DeepCopyInto(out *MetadataServerSpec) { in.Placement.DeepCopyInto(&out.Placement) if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(rookiov1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } diff --git a/pkg/apis/cockroachdb.rook.io/register.go b/pkg/apis/cockroachdb.rook.io/register.go index 54cecdd8e..2692571ab 100644 --- a/pkg/apis/cockroachdb.rook.io/register.go +++ b/pkg/apis/cockroachdb.rook.io/register.go @@ -1,5 +1,5 @@ package cockroachdbrookio const ( - GroupName = "cockroachdb.rook.io" + CustomResourceGroupName = "cockroachdb.rook.io" ) diff --git a/pkg/apis/cockroachdb.rook.io/v1alpha1/register.go b/pkg/apis/cockroachdb.rook.io/v1alpha1/register.go index 65210af18..12952b038 100644 --- a/pkg/apis/cockroachdb.rook.io/v1alpha1/register.go +++ b/pkg/apis/cockroachdb.rook.io/v1alpha1/register.go @@ -29,7 +29,7 @@ const ( ) // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: cockroachdbrookio.GroupName, Version: Version} +var SchemeGroupVersion = schema.GroupVersion{Group: cockroachdbrookio.CustomResourceGroupName, Version: Version} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { diff --git a/pkg/apis/cockroachdb.rook.io/v1alpha1/types.go b/pkg/apis/cockroachdb.rook.io/v1alpha1/types.go index 81c655fc8..e9e8f065c 100644 --- a/pkg/apis/cockroachdb.rook.io/v1alpha1/types.go +++ b/pkg/apis/cockroachdb.rook.io/v1alpha1/types.go @@ -18,7 +18,7 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rook "github.com/rook/rook/pkg/apis/rook.io/v1" ) // *************************************************************************** diff --git a/pkg/apis/cockroachdb.rook.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/cockroachdb.rook.io/v1alpha1/zz_generated.deepcopy.go index b0eb8c44c..5ff690df2 100644 --- a/pkg/apis/cockroachdb.rook.io/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/cockroachdb.rook.io/v1alpha1/zz_generated.deepcopy.go @@ -21,7 +21,7 @@ limitations under the License. package v1alpha1 import ( - v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + v1 "github.com/rook/rook/pkg/apis/rook.io/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -90,7 +90,7 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { *out = *in if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(v1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } diff --git a/pkg/apis/edgefs.rook.io/register.go b/pkg/apis/edgefs.rook.io/register.go index 0bb6bc366..988642c96 100644 --- a/pkg/apis/edgefs.rook.io/register.go +++ b/pkg/apis/edgefs.rook.io/register.go @@ -1,5 +1,5 @@ package edgefsrookio const ( - GroupName = "edgefs.rook.io" + CustomResourceGroupName = "edgefs.rook.io" ) diff --git a/pkg/apis/edgefs.rook.io/v1/annotations.go b/pkg/apis/edgefs.rook.io/v1/annotations.go index 402269d81..e1bda9409 100644 --- a/pkg/apis/edgefs.rook.io/v1/annotations.go +++ b/pkg/apis/edgefs.rook.io/v1/annotations.go @@ -17,7 +17,7 @@ limitations under the License. package v1 import ( - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rook "github.com/rook/rook/pkg/apis/rook.io/v1" ) // GetPrepareAnnotations returns the Annotations for the prepare service diff --git a/pkg/apis/edgefs.rook.io/v1/placement.go b/pkg/apis/edgefs.rook.io/v1/placement.go index 195580bb6..aba8aa288 100644 --- a/pkg/apis/edgefs.rook.io/v1/placement.go +++ b/pkg/apis/edgefs.rook.io/v1/placement.go @@ -16,20 +16,20 @@ limitations under the License. package v1 import ( - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1" ) // GetMgrPlacement returns the placement for the MGR service -func GetMgrPlacement(p rook.PlacementSpec) rook.Placement { +func GetMgrPlacement(p rookv1.PlacementSpec) rookv1.Placement { return p.All().Merge(p[KeyMgr]) } // GetTargetPlacement returns the placement for the Target service -func GetTargetPlacement(p rook.PlacementSpec) rook.Placement { +func GetTargetPlacement(p rookv1.PlacementSpec) rookv1.Placement { return p.All().Merge(p[KeyTarget]) } // GetPreparePlacement returns the placement for the Host Prepare service -func GetPreparePlacement(p rook.PlacementSpec) rook.Placement { +func GetPreparePlacement(p rookv1.PlacementSpec) rookv1.Placement { return p.All().Merge(p[KeyPrepare]) } diff --git a/pkg/apis/edgefs.rook.io/v1/register.go b/pkg/apis/edgefs.rook.io/v1/register.go index 6f26e31da..d355373f4 100644 --- a/pkg/apis/edgefs.rook.io/v1/register.go +++ b/pkg/apis/edgefs.rook.io/v1/register.go @@ -29,7 +29,7 @@ const ( ) // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: edgefsrookio.GroupName, Version: Version} +var SchemeGroupVersion = schema.GroupVersion{Group: edgefsrookio.CustomResourceGroupName, Version: Version} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { diff --git a/pkg/apis/edgefs.rook.io/v1/resources.go b/pkg/apis/edgefs.rook.io/v1/resources.go index 8a5c72097..56322831b 100644 --- a/pkg/apis/edgefs.rook.io/v1/resources.go +++ b/pkg/apis/edgefs.rook.io/v1/resources.go @@ -16,10 +16,11 @@ limitations under the License. package v1 import ( - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" - "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" "strconv" + + rook "github.com/rook/rook/pkg/apis/rook.io/v1" + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" ) const ( diff --git a/pkg/apis/edgefs.rook.io/v1/types.go b/pkg/apis/edgefs.rook.io/v1/types.go index 18477e494..6a4bf8b2c 100644 --- a/pkg/apis/edgefs.rook.io/v1/types.go +++ b/pkg/apis/edgefs.rook.io/v1/types.go @@ -16,7 +16,7 @@ limitations under the License. package v1 import ( - rook "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" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -53,13 +53,13 @@ type ClusterList struct { } type ClusterSpec struct { - Storage rook.StorageScopeSpec `json:"storage,omitempty"` + Storage rookv1.StorageScopeSpec `json:"storage,omitempty"` // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.AnnotationsSpec `json:"annotations,omitempty"` + Annotations rookv1.AnnotationsSpec `json:"annotations,omitempty"` // The placement-related configuration to pass to kubernetes (affinity, node selector, tolerations). - Placement rook.PlacementSpec `json:"placement,omitempty"` - Network rook.NetworkSpec `json:"network,omitempty"` - Dashboard DashboardSpec `json:"dashboard,omitempty"` + Placement rookv1.PlacementSpec `json:"placement,omitempty"` + Network rookv1.NetworkSpec `json:"network,omitempty"` + Dashboard DashboardSpec `json:"dashboard,omitempty"` // Resources set resource requests and limits Resources v1.ResourceRequirements `json:"resources,omitempty"` // The path on the host where config and data can be persisted. @@ -117,9 +117,9 @@ type NFSList struct { // NFSSpec represent the spec of a pool type NFSSpec struct { // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.Annotations `json:"annotations,omitempty"` + Annotations rookv1.Annotations `json:"annotations,omitempty"` // The affinity to place the NFS pods (default is to place on any available nodes in EdgeFS running namespace) - Placement rook.Placement `json:"placement"` + Placement rookv1.Placement `json:"placement"` // Resources set resource requests and limits Resources v1.ResourceRequirements `json:"resources,omitempty"` // The number of pods in the NFS replicaset @@ -150,9 +150,9 @@ type S3List struct { // S3Spec represent the spec of a s3 service type S3Spec struct { // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.Annotations `json:"annotations,omitempty"` + Annotations rookv1.Annotations `json:"annotations,omitempty"` // The affinity to place the S3 pods (default is to place on any available nodes in EdgeFS running namespace) - Placement rook.Placement `json:"placement"` + Placement rookv1.Placement `json:"placement"` // Resources set resource requests and limits Resources v1.ResourceRequirements `json:"resources,omitempty"` // The number of pods in the S3 replicaset @@ -196,7 +196,7 @@ type SWIFTList struct { // SWIFTSpec represent the spec of a swift service type SWIFTSpec struct { // The affinity to place the SWIFT pods (default is to place on any available nodes in EdgeFS running namespace) - Placement rook.Placement `json:"placement"` + Placement rookv1.Placement `json:"placement"` // Resources set resource requests and limits Resources v1.ResourceRequirements `json:"resources,omitempty"` // The number of pods in the S3 replicaset @@ -238,9 +238,9 @@ type S3XList struct { // S3XSpec represent the spec of a s3 service type S3XSpec struct { // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.Annotations `json:"annotations,omitempty"` + Annotations rookv1.Annotations `json:"annotations,omitempty"` // The affinity to place the S3X pods (default is to place on any available nodes in EdgeFS running namespace) - Placement rook.Placement `json:"placement"` + Placement rookv1.Placement `json:"placement"` // Resources set resource requests and limits Resources v1.ResourceRequirements `json:"resources,omitempty"` // The number of pods in the S3X replicaset @@ -282,9 +282,9 @@ type ISCSIList struct { // ISCSISpec represent the spec of a iscsi service type ISCSISpec struct { // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.Annotations `json:"annotations,omitempty"` + Annotations rookv1.Annotations `json:"annotations,omitempty"` // The affinity to place the ISCSI pods (default is to place on any available nodes in EdgeFS running namespace) - Placement rook.Placement `json:"placement"` + Placement rookv1.Placement `json:"placement"` // Resources set resource requests and limits Resources v1.ResourceRequirements `json:"resources,omitempty"` // The number of pods in the ISCSI replicaset @@ -332,9 +332,9 @@ type ISGWConfig struct { // ISGWSpec represent the spec of a isgw service type ISGWSpec struct { // The annotations-related configuration to add/set on each Pod related object. - Annotations rook.Annotations `json:"annotations,omitempty"` + Annotations rookv1.Annotations `json:"annotations,omitempty"` // The affinity to place the ISGW pods (default is to place on any available nodes in EdgeFS running namespace) - Placement rook.Placement `json:"placement"` + Placement rookv1.Placement `json:"placement"` // Resources set resource requests and limits Resources v1.ResourceRequirements `json:"resources,omitempty"` // The number of pods in the ISGW replicaset diff --git a/pkg/apis/edgefs.rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/edgefs.rook.io/v1/zz_generated.deepcopy.go index 6e21a1e51..ca0883dba 100644 --- a/pkg/apis/edgefs.rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/edgefs.rook.io/v1/zz_generated.deepcopy.go @@ -21,7 +21,7 @@ limitations under the License. package v1 import ( - v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rookiov1 "github.com/rook/rook/pkg/apis/rook.io/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -258,14 +258,14 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { in.Storage.DeepCopyInto(&out.Storage) if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.AnnotationsSpec, len(*in)) + *out = make(rookiov1.AnnotationsSpec, len(*in)) for key, val := range *in { var outVal map[string]string if val == nil { (*out)[key] = nil } else { in, out := &val, &outVal - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(rookiov1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -275,7 +275,7 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { } if in.Placement != nil { in, out := &in.Placement, &out.Placement - *out = make(v1alpha2.PlacementSpec, len(*in)) + *out = make(rookiov1.PlacementSpec, len(*in)) for key, val := range *in { (*out)[key] = *val.DeepCopy() } @@ -438,7 +438,7 @@ func (in *ISCSISpec) DeepCopyInto(out *ISCSISpec) { *out = *in if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(rookiov1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -546,7 +546,7 @@ func (in *ISGWSpec) DeepCopyInto(out *ISGWSpec) { *out = *in if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(rookiov1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -633,7 +633,7 @@ func (in *NFSSpec) DeepCopyInto(out *NFSSpec) { *out = *in if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(rookiov1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -830,7 +830,7 @@ func (in *S3Spec) DeepCopyInto(out *S3Spec) { *out = *in if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(rookiov1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -916,7 +916,7 @@ func (in *S3XSpec) DeepCopyInto(out *S3XSpec) { *out = *in if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(rookiov1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } diff --git a/pkg/apis/nfs.rook.io/register.go b/pkg/apis/nfs.rook.io/register.go index e048d750f..0a7b43d6d 100644 --- a/pkg/apis/nfs.rook.io/register.go +++ b/pkg/apis/nfs.rook.io/register.go @@ -16,5 +16,5 @@ limitations under the License. package nfsrookio const ( - GroupName = "nfs.rook.io" + CustomResourceGroupName = "nfs.rook.io" ) diff --git a/pkg/apis/nfs.rook.io/v1alpha1/register.go b/pkg/apis/nfs.rook.io/v1alpha1/register.go index 90361dc65..a44e66114 100644 --- a/pkg/apis/nfs.rook.io/v1alpha1/register.go +++ b/pkg/apis/nfs.rook.io/v1alpha1/register.go @@ -29,7 +29,7 @@ const ( ) // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: nfsrookio.GroupName, Version: Version} +var SchemeGroupVersion = schema.GroupVersion{Group: nfsrookio.CustomResourceGroupName, Version: Version} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { diff --git a/pkg/apis/nfs.rook.io/v1alpha1/types.go b/pkg/apis/nfs.rook.io/v1alpha1/types.go index 6febf79a8..1f08ef98c 100644 --- a/pkg/apis/nfs.rook.io/v1alpha1/types.go +++ b/pkg/apis/nfs.rook.io/v1alpha1/types.go @@ -16,7 +16,7 @@ limitations under the License. package v1alpha1 import ( - 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" ) @@ -48,7 +48,7 @@ type NFSServerList struct { // NFSServerSpec represents the spec of NFS daemon type NFSServerSpec struct { // The annotations-related configuration to add/set on each Pod related object. - Annotations rookalpha.Annotations `json:"annotations,omitempty"` + Annotations rookv1.Annotations `json:"annotations,omitempty"` // Replicas of the NFS daemon Replicas int `json:"replicas,omitempty"` diff --git a/pkg/apis/nfs.rook.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/nfs.rook.io/v1alpha1/zz_generated.deepcopy.go index c04a7cd5f..37f0a7bb6 100644 --- a/pkg/apis/nfs.rook.io/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/nfs.rook.io/v1alpha1/zz_generated.deepcopy.go @@ -21,7 +21,7 @@ limitations under the License. package v1alpha1 import ( - v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + v1 "github.com/rook/rook/pkg/apis/rook.io/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -129,7 +129,7 @@ func (in *NFSServerSpec) DeepCopyInto(out *NFSServerSpec) { *out = *in if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(v1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } diff --git a/pkg/apis/rook.io/register.go b/pkg/apis/rook.io/register.go index b99b0acd5..ad4812857 100644 --- a/pkg/apis/rook.io/register.go +++ b/pkg/apis/rook.io/register.go @@ -1,5 +1,5 @@ package rookio const ( - GroupName = "rook.io" + CustomResourceGroupName = "rook.io" ) diff --git a/pkg/apis/rook.io/v1alpha2/annotations.go b/pkg/apis/rook.io/v1/annotations.go similarity index 98% rename from pkg/apis/rook.io/v1alpha2/annotations.go rename to pkg/apis/rook.io/v1/annotations.go index 21a0cc5b8..30bcb4942 100644 --- a/pkg/apis/rook.io/v1alpha2/annotations.go +++ b/pkg/apis/rook.io/v1/annotations.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/rook.io/v1alpha2/annotations_test.go b/pkg/apis/rook.io/v1/annotations_test.go similarity index 99% rename from pkg/apis/rook.io/v1alpha2/annotations_test.go rename to pkg/apis/rook.io/v1/annotations_test.go index d79915f72..9aea36c9a 100644 --- a/pkg/apis/rook.io/v1alpha2/annotations_test.go +++ b/pkg/apis/rook.io/v1/annotations_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1 import ( "encoding/json" diff --git a/pkg/apis/rook.io/v1/doc.go b/pkg/apis/rook.io/v1/doc.go new file mode 100644 index 000000000..42fcf1d72 --- /dev/null +++ b/pkg/apis/rook.io/v1/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2018 The Rook Authors. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +    http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package,register + +// Package v1 is the v1 version of the rook.io API. +// +groupName=rook.io +package v1 diff --git a/pkg/apis/rook.io/v1alpha2/keys.go b/pkg/apis/rook.io/v1/keys.go similarity index 97% rename from pkg/apis/rook.io/v1alpha2/keys.go rename to pkg/apis/rook.io/v1/keys.go index a29bc7c11..62d86d373 100644 --- a/pkg/apis/rook.io/v1alpha2/keys.go +++ b/pkg/apis/rook.io/v1/keys.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1 const ( KeyAll = "all" diff --git a/pkg/apis/rook.io/v1alpha2/network.go b/pkg/apis/rook.io/v1/network.go similarity index 98% rename from pkg/apis/rook.io/v1alpha2/network.go rename to pkg/apis/rook.io/v1/network.go index 5a5c9ffde..b414f0aab 100644 --- a/pkg/apis/rook.io/v1alpha2/network.go +++ b/pkg/apis/rook.io/v1/network.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1 // IsHost get whether to use host network provider func (net *NetworkSpec) IsHost() bool { diff --git a/pkg/apis/rook.io/v1alpha2/network_test.go b/pkg/apis/rook.io/v1/network_test.go similarity index 98% rename from pkg/apis/rook.io/v1alpha2/network_test.go rename to pkg/apis/rook.io/v1/network_test.go index e0a623e3b..56ecafe04 100644 --- a/pkg/apis/rook.io/v1alpha2/network_test.go +++ b/pkg/apis/rook.io/v1/network_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1 import ( "encoding/json" diff --git a/pkg/apis/rook.io/v1alpha2/placement.go b/pkg/apis/rook.io/v1/placement.go similarity index 97% rename from pkg/apis/rook.io/v1alpha2/placement.go rename to pkg/apis/rook.io/v1/placement.go index fe3abcfc8..b21cfea8a 100644 --- a/pkg/apis/rook.io/v1alpha2/placement.go +++ b/pkg/apis/rook.io/v1/placement.go @@ -13,10 +13,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1 import ( - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" ) func (p PlacementSpec) All() Placement { diff --git a/pkg/apis/rook.io/v1alpha2/placement_test.go b/pkg/apis/rook.io/v1/placement_test.go similarity index 99% rename from pkg/apis/rook.io/v1alpha2/placement_test.go rename to pkg/apis/rook.io/v1/placement_test.go index bc597f46f..8c005beac 100644 --- a/pkg/apis/rook.io/v1alpha2/placement_test.go +++ b/pkg/apis/rook.io/v1/placement_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1 import ( "encoding/json" diff --git a/pkg/apis/rook.io/v1alpha2/priorityclasses.go b/pkg/apis/rook.io/v1/priorityclasses.go similarity index 97% rename from pkg/apis/rook.io/v1alpha2/priorityclasses.go rename to pkg/apis/rook.io/v1/priorityclasses.go index 6d58622e1..70a36364d 100644 --- a/pkg/apis/rook.io/v1alpha2/priorityclasses.go +++ b/pkg/apis/rook.io/v1/priorityclasses.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1 // All returns the priority class name defined for 'all' daemons in the Ceph cluster CRD. func (p PriorityClassNamesSpec) All() string { diff --git a/pkg/apis/rook.io/v1alpha2/priorityclasses_test.go b/pkg/apis/rook.io/v1/priorityclasses_test.go similarity index 98% rename from pkg/apis/rook.io/v1alpha2/priorityclasses_test.go rename to pkg/apis/rook.io/v1/priorityclasses_test.go index 2ea111f29..13b50b421 100644 --- a/pkg/apis/rook.io/v1alpha2/priorityclasses_test.go +++ b/pkg/apis/rook.io/v1/priorityclasses_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1 import ( "encoding/json" diff --git a/pkg/apis/rook.io/v1/register.go b/pkg/apis/rook.io/v1/register.go new file mode 100644 index 000000000..5e7774b44 --- /dev/null +++ b/pkg/apis/rook.io/v1/register.go @@ -0,0 +1,57 @@ +/* +Copyright 2016 The Rook Authors. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +    http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + rookio "github.com/rook/rook/pkg/apis/rook.io" +) + +const ( + Version = "v1" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: rookio.CustomResourceGroupName, Version: Version} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/rook.io/v1alpha2/storage.go b/pkg/apis/rook.io/v1/storage.go similarity index 99% rename from pkg/apis/rook.io/v1alpha2/storage.go rename to pkg/apis/rook.io/v1/storage.go index 2f2cf4d52..a9684ecbf 100644 --- a/pkg/apis/rook.io/v1alpha2/storage.go +++ b/pkg/apis/rook.io/v1/storage.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1 // AnyUseAllDevices gets whether to use all devices func (s *StorageScopeSpec) AnyUseAllDevices() bool { diff --git a/pkg/apis/rook.io/v1alpha2/storage_test.go b/pkg/apis/rook.io/v1/storage_test.go similarity index 99% rename from pkg/apis/rook.io/v1alpha2/storage_test.go rename to pkg/apis/rook.io/v1/storage_test.go index c3889f416..c7ae0575f 100644 --- a/pkg/apis/rook.io/v1alpha2/storage_test.go +++ b/pkg/apis/rook.io/v1/storage_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1 import ( "testing" diff --git a/pkg/apis/rook.io/v1/types.go b/pkg/apis/rook.io/v1/types.go new file mode 100644 index 000000000..9e0e43925 --- /dev/null +++ b/pkg/apis/rook.io/v1/types.go @@ -0,0 +1,126 @@ +/* +Copyright 2018 The Rook Authors. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +    http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ************************************************************************************ +// IMPORTANT FOR CODE GENERATION +// If any of the types with codegen tags in this file are updated, you will need to run +// `make codegen` to generate the new types under the client/clientset folder. +// ************************************************************************************ + +type StorageScopeSpec struct { + Nodes []Node `json:"nodes,omitempty"` + UseAllNodes bool `json:"useAllNodes,omitempty"` + NodeCount int `json:"nodeCount,omitempty"` + Config map[string]string `json:"config"` + Selection + VolumeSources []VolumeSource `json:"volumeSources,omitempty"` + StorageClassDeviceSets []StorageClassDeviceSet `json:"storageClassDeviceSets"` +} + +type Node struct { + Name string `json:"name,omitempty"` + Resources v1.ResourceRequirements `json:"resources,omitempty"` + Config map[string]string `json:"config"` + Selection +} + +type Device struct { + Name string `json:"name,omitempty"` + FullPath string `json:"fullpath,omitempty"` + Config map[string]string `json:"config"` +} + +type Directory struct { + Path string `json:"path,omitempty"` + Config map[string]string `json:"config"` +} + +type Selection struct { + // Whether to consume all the storage devices found on a machine + UseAllDevices *bool `json:"useAllDevices,omitempty"` + // A regular expression to allow more fine-grained selection of devices on nodes across the cluster + DeviceFilter string `json:"deviceFilter,omitempty"` + // A regular expression to allow more fine-grained selection of devices with path names + DevicePathFilter string `json:"devicePathFilter,omitempty"` + // List of devices to use as storage devices + Devices []Device `json:"devices,omitempty"` + // List of host directories to use as storage + Directories []Directory `json:"directories,omitempty"` + // PersistentVolumeClaims to use as storage + VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"` +} + +type PlacementSpec map[KeyType]Placement + +type Placement struct { + NodeAffinity *v1.NodeAffinity `json:"nodeAffinity,omitempty"` + PodAffinity *v1.PodAffinity `json:"podAffinity,omitempty"` + PodAntiAffinity *v1.PodAntiAffinity `json:"podAntiAffinity,omitempty"` + Tolerations []v1.Toleration `json:"tolerations,omitempty"` +} + +type ResourceSpec map[string]v1.ResourceRequirements + +// PriorityClassNamesSpec is a map of priority class names to be assigned to components +type PriorityClassNamesSpec map[KeyType]string + +// NetworkSpec represents cluster network settings +type NetworkSpec struct { + // Provider is what provides network connectivity to the cluster e.g. "host" or "multus" + Provider string `json:"provider"` + + // Selectors string values describe what networks will be used to connect the cluster. + // Meanwhile the keys describe each network respective responsibilities or any metadata + // storage provider decide. + Selectors map[string]string `json:"selectors"` +} + +// KeyType +type KeyType string + +type AnnotationsSpec map[KeyType]Annotations + +type Annotations map[string]string + +type StorageClassDeviceSet struct { + Name string `json:"name,omitempty"` // A unique identifier for the set + Count int `json:"count,omitempty"` // Number of devices in this set + Resources v1.ResourceRequirements `json:"resources,omitempty"` // Requests/limits for the devices + Placement Placement `json:"placement,omitempty"` // Placement constraints for the devices + Config map[string]string `json:"config,omitempty"` // Provider-specific device configuration + VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"` // List of PVC templates for the underlying storage devices + Portable bool `json:"portable,omitempty"` // OSD portability across the hosts + TuneSlowDeviceClass bool `json:"tuneDeviceClass,omitempty"` // TuneSlowDeviceClass Tune the OSD when running on a slow Device Class +} + +// VolumeSource is a volume source spec for Rook +type VolumeSource struct { + Name string `json:"name,omitempty"` + PersistentVolumeClaimSource v1.PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaimSource,omitempty"` + Resources v1.ResourceRequirements `json:"resources,omitempty"` + Placement Placement `json:"placement,omitempty"` + Config map[string]string `json:"config,omitempty"` + Portable bool `json:"portable,omitempty"` // Portable OSD portability across the hosts + TuneSlowDeviceClass bool `json:"tuneDeviceClass,omitempty"` // TuneSlowDeviceClass Tune the OSD when running on a slow Device Class + Type string `json:"type,omitempty"` // Type represents the device type for an OSD, possible values are "data": the bluestore 'block' data and "metadata": the bluestore 'block.db' device + CrushDeviceClass string `json:"crushDeviceClass,omitempty"` // CrushDeviceClass represents the crush device class for an OSD +} diff --git a/pkg/apis/rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/rook.io/v1/zz_generated.deepcopy.go new file mode 100644 index 000000000..d1a5860e8 --- /dev/null +++ b/pkg/apis/rook.io/v1/zz_generated.deepcopy.go @@ -0,0 +1,444 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in Annotations) DeepCopyInto(out *Annotations) { + { + in := &in + *out = make(Annotations, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Annotations. +func (in Annotations) DeepCopy() Annotations { + if in == nil { + return nil + } + out := new(Annotations) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in AnnotationsSpec) DeepCopyInto(out *AnnotationsSpec) { + { + in := &in + *out = make(AnnotationsSpec, len(*in)) + for key, val := range *in { + var outVal map[string]string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make(Annotations, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + (*out)[key] = outVal + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnnotationsSpec. +func (in AnnotationsSpec) DeepCopy() AnnotationsSpec { + if in == nil { + return nil + } + out := new(AnnotationsSpec) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Device) DeepCopyInto(out *Device) { + *out = *in + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Device. +func (in *Device) DeepCopy() *Device { + if in == nil { + return nil + } + out := new(Device) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Directory) DeepCopyInto(out *Directory) { + *out = *in + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Directory. +func (in *Directory) DeepCopy() *Directory { + if in == nil { + return nil + } + out := new(Directory) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) { + *out = *in + if in.Selectors != nil { + in, out := &in.Selectors, &out.Selectors + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec. +func (in *NetworkSpec) DeepCopy() *NetworkSpec { + if in == nil { + return nil + } + out := new(NetworkSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Node) DeepCopyInto(out *Node) { + *out = *in + in.Resources.DeepCopyInto(&out.Resources) + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + in.Selection.DeepCopyInto(&out.Selection) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node. +func (in *Node) DeepCopy() *Node { + if in == nil { + return nil + } + out := new(Node) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in NodesByName) DeepCopyInto(out *NodesByName) { + { + in := &in + *out = make(NodesByName, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodesByName. +func (in NodesByName) DeepCopy() NodesByName { + if in == nil { + return nil + } + out := new(NodesByName) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Placement) DeepCopyInto(out *Placement) { + *out = *in + if in.NodeAffinity != nil { + in, out := &in.NodeAffinity, &out.NodeAffinity + *out = new(corev1.NodeAffinity) + (*in).DeepCopyInto(*out) + } + if in.PodAffinity != nil { + in, out := &in.PodAffinity, &out.PodAffinity + *out = new(corev1.PodAffinity) + (*in).DeepCopyInto(*out) + } + if in.PodAntiAffinity != nil { + in, out := &in.PodAntiAffinity, &out.PodAntiAffinity + *out = new(corev1.PodAntiAffinity) + (*in).DeepCopyInto(*out) + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]corev1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Placement. +func (in *Placement) DeepCopy() *Placement { + if in == nil { + return nil + } + out := new(Placement) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in PlacementSpec) DeepCopyInto(out *PlacementSpec) { + { + in := &in + *out = make(PlacementSpec, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementSpec. +func (in PlacementSpec) DeepCopy() PlacementSpec { + if in == nil { + return nil + } + out := new(PlacementSpec) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in PriorityClassNamesSpec) DeepCopyInto(out *PriorityClassNamesSpec) { + { + in := &in + *out = make(PriorityClassNamesSpec, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityClassNamesSpec. +func (in PriorityClassNamesSpec) DeepCopy() PriorityClassNamesSpec { + if in == nil { + return nil + } + out := new(PriorityClassNamesSpec) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ResourceSpec) DeepCopyInto(out *ResourceSpec) { + { + in := &in + *out = make(ResourceSpec, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSpec. +func (in ResourceSpec) DeepCopy() ResourceSpec { + if in == nil { + return nil + } + out := new(ResourceSpec) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Selection) DeepCopyInto(out *Selection) { + *out = *in + if in.UseAllDevices != nil { + in, out := &in.UseAllDevices, &out.UseAllDevices + *out = new(bool) + **out = **in + } + if in.Devices != nil { + in, out := &in.Devices, &out.Devices + *out = make([]Device, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Directories != nil { + in, out := &in.Directories, &out.Directories + *out = make([]Directory, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.VolumeClaimTemplates != nil { + in, out := &in.VolumeClaimTemplates, &out.VolumeClaimTemplates + *out = make([]corev1.PersistentVolumeClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Selection. +func (in *Selection) DeepCopy() *Selection { + if in == nil { + return nil + } + out := new(Selection) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageClassDeviceSet) DeepCopyInto(out *StorageClassDeviceSet) { + *out = *in + in.Resources.DeepCopyInto(&out.Resources) + in.Placement.DeepCopyInto(&out.Placement) + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.VolumeClaimTemplates != nil { + in, out := &in.VolumeClaimTemplates, &out.VolumeClaimTemplates + *out = make([]corev1.PersistentVolumeClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageClassDeviceSet. +func (in *StorageClassDeviceSet) DeepCopy() *StorageClassDeviceSet { + if in == nil { + return nil + } + out := new(StorageClassDeviceSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageScopeSpec) DeepCopyInto(out *StorageScopeSpec) { + *out = *in + if in.Nodes != nil { + in, out := &in.Nodes, &out.Nodes + *out = make([]Node, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + in.Selection.DeepCopyInto(&out.Selection) + if in.VolumeSources != nil { + in, out := &in.VolumeSources, &out.VolumeSources + *out = make([]VolumeSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.StorageClassDeviceSets != nil { + in, out := &in.StorageClassDeviceSets, &out.StorageClassDeviceSets + *out = make([]StorageClassDeviceSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageScopeSpec. +func (in *StorageScopeSpec) DeepCopy() *StorageScopeSpec { + if in == nil { + return nil + } + out := new(StorageScopeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeSource) DeepCopyInto(out *VolumeSource) { + *out = *in + out.PersistentVolumeClaimSource = in.PersistentVolumeClaimSource + in.Resources.DeepCopyInto(&out.Resources) + in.Placement.DeepCopyInto(&out.Placement) + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSource. +func (in *VolumeSource) DeepCopy() *VolumeSource { + if in == nil { + return nil + } + out := new(VolumeSource) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/rook.io/v1alpha2/register.go b/pkg/apis/rook.io/v1alpha2/register.go index ebfb43a08..00eed21b5 100644 --- a/pkg/apis/rook.io/v1alpha2/register.go +++ b/pkg/apis/rook.io/v1alpha2/register.go @@ -24,12 +24,11 @@ import ( ) const ( - CustomResourceGroup = "rook.io" - Version = "v1alpha2" + Version = "v1alpha2" ) // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: rookio.GroupName, Version: Version} +var SchemeGroupVersion = schema.GroupVersion{Group: rookio.CustomResourceGroupName, Version: Version} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { diff --git a/pkg/apis/rook.io/v1alpha2/types.go b/pkg/apis/rook.io/v1alpha2/types.go index 925187faf..88aa3a810 100644 --- a/pkg/apis/rook.io/v1alpha2/types.go +++ b/pkg/apis/rook.io/v1alpha2/types.go @@ -17,7 +17,6 @@ limitations under the License. package v1alpha2 import ( - v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -27,74 +26,6 @@ import ( // `make codegen` to generate the new types under the client/clientset folder. // ************************************************************************************ -type StorageScopeSpec struct { - Nodes []Node `json:"nodes,omitempty"` - UseAllNodes bool `json:"useAllNodes,omitempty"` - NodeCount int `json:"nodeCount,omitempty"` - Config map[string]string `json:"config"` - Selection - VolumeSources []VolumeSource `json:"volumeSources,omitempty"` - StorageClassDeviceSets []StorageClassDeviceSet `json:"storageClassDeviceSets"` -} - -type Node struct { - Name string `json:"name,omitempty"` - Resources v1.ResourceRequirements `json:"resources,omitempty"` - Config map[string]string `json:"config"` - Selection -} - -type Device struct { - Name string `json:"name,omitempty"` - FullPath string `json:"fullpath,omitempty"` - Config map[string]string `json:"config"` -} - -type Directory struct { - Path string `json:"path,omitempty"` - Config map[string]string `json:"config"` -} - -type Selection struct { - // Whether to consume all the storage devices found on a machine - UseAllDevices *bool `json:"useAllDevices,omitempty"` - // A regular expression to allow more fine-grained selection of devices on nodes across the cluster - DeviceFilter string `json:"deviceFilter,omitempty"` - // A regular expression to allow more fine-grained selection of devices with path names - DevicePathFilter string `json:"devicePathFilter,omitempty"` - // List of devices to use as storage devices - Devices []Device `json:"devices,omitempty"` - // List of host directories to use as storage - Directories []Directory `json:"directories,omitempty"` - // PersistentVolumeClaims to use as storage - VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"` -} - -type PlacementSpec map[KeyType]Placement - -type Placement struct { - NodeAffinity *v1.NodeAffinity `json:"nodeAffinity,omitempty"` - PodAffinity *v1.PodAffinity `json:"podAffinity,omitempty"` - PodAntiAffinity *v1.PodAntiAffinity `json:"podAntiAffinity,omitempty"` - Tolerations []v1.Toleration `json:"tolerations,omitempty"` -} - -type ResourceSpec map[string]v1.ResourceRequirements - -// PriorityClassNamesSpec is a map of priority class names to be assigned to components -type PriorityClassNamesSpec map[KeyType]string - -// NetworkSpec represents cluster network settings -type NetworkSpec struct { - // Provider is what provides network connectivity to the cluster e.g. "host" or "multus" - Provider string `json:"provider"` - - // Selectors string values describe what networks will be used to connect the cluster. - // Meanwhile the keys describe each network respective responsibilities or any metadata - // storage provider decide. - Selectors map[string]string `json:"selectors"` -} - // +genclient // +genclient:noStatus // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -121,34 +52,3 @@ type VolumeList struct { metav1.ListMeta `json:"metadata"` Items []Volume `json:"items"` } - -// KeyType -type KeyType string - -type AnnotationsSpec map[KeyType]Annotations - -type Annotations map[string]string - -type StorageClassDeviceSet struct { - Name string `json:"name,omitempty"` // A unique identifier for the set - Count int `json:"count,omitempty"` // Number of devices in this set - Resources v1.ResourceRequirements `json:"resources,omitempty"` // Requests/limits for the devices - Placement Placement `json:"placement,omitempty"` // Placement constraints for the devices - Config map[string]string `json:"config,omitempty"` // Provider-specific device configuration - VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"` // List of PVC templates for the underlying storage devices - Portable bool `json:"portable,omitempty"` // OSD portability across the hosts - TuneSlowDeviceClass bool `json:"tuneDeviceClass,omitempty"` // TuneSlowDeviceClass Tune the OSD when running on a slow Device Class -} - -// VolumeSource is a volume source spec for Rook -type VolumeSource struct { - Name string `json:"name,omitempty"` - PersistentVolumeClaimSource v1.PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaimSource,omitempty"` - Resources v1.ResourceRequirements `json:"resources,omitempty"` - Placement Placement `json:"placement,omitempty"` - Config map[string]string `json:"config,omitempty"` - Portable bool `json:"portable,omitempty"` // Portable OSD portability across the hosts - TuneSlowDeviceClass bool `json:"tuneDeviceClass,omitempty"` // TuneSlowDeviceClass Tune the OSD when running on a slow Device Class - Type string `json:"type,omitempty"` // Type represents the device type for an OSD, possible values are "data": the bluestore 'block' data and "metadata": the bluestore 'block.db' device - CrushDeviceClass string `json:"crushDeviceClass,omitempty"` // CrushDeviceClass represents the crush device class for an OSD -} diff --git a/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go index 6f472779a..49e2c8f51 100644 --- a/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go +++ b/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go @@ -21,64 +21,9 @@ limitations under the License. package v1alpha2 import ( - v1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in Annotations) DeepCopyInto(out *Annotations) { - { - in := &in - *out = make(Annotations, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Annotations. -func (in Annotations) DeepCopy() Annotations { - if in == nil { - return nil - } - out := new(Annotations) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in AnnotationsSpec) DeepCopyInto(out *AnnotationsSpec) { - { - in := &in - *out = make(AnnotationsSpec, len(*in)) - for key, val := range *in { - var outVal map[string]string - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = make(Annotations, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - (*out)[key] = outVal - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AnnotationsSpec. -func (in AnnotationsSpec) DeepCopy() AnnotationsSpec { - if in == nil { - return nil - } - out := new(AnnotationsSpec) - in.DeepCopyInto(out) - return *out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Attachment) DeepCopyInto(out *Attachment) { *out = *in @@ -95,345 +40,6 @@ func (in *Attachment) DeepCopy() *Attachment { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Device) DeepCopyInto(out *Device) { - *out = *in - if in.Config != nil { - in, out := &in.Config, &out.Config - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Device. -func (in *Device) DeepCopy() *Device { - if in == nil { - return nil - } - out := new(Device) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Directory) DeepCopyInto(out *Directory) { - *out = *in - if in.Config != nil { - in, out := &in.Config, &out.Config - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Directory. -func (in *Directory) DeepCopy() *Directory { - if in == nil { - return nil - } - out := new(Directory) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) { - *out = *in - if in.Selectors != nil { - in, out := &in.Selectors, &out.Selectors - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec. -func (in *NetworkSpec) DeepCopy() *NetworkSpec { - if in == nil { - return nil - } - out := new(NetworkSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Node) DeepCopyInto(out *Node) { - *out = *in - in.Resources.DeepCopyInto(&out.Resources) - if in.Config != nil { - in, out := &in.Config, &out.Config - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - in.Selection.DeepCopyInto(&out.Selection) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node. -func (in *Node) DeepCopy() *Node { - if in == nil { - return nil - } - out := new(Node) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in NodesByName) DeepCopyInto(out *NodesByName) { - { - in := &in - *out = make(NodesByName, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodesByName. -func (in NodesByName) DeepCopy() NodesByName { - if in == nil { - return nil - } - out := new(NodesByName) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Placement) DeepCopyInto(out *Placement) { - *out = *in - if in.NodeAffinity != nil { - in, out := &in.NodeAffinity, &out.NodeAffinity - *out = new(v1.NodeAffinity) - (*in).DeepCopyInto(*out) - } - if in.PodAffinity != nil { - in, out := &in.PodAffinity, &out.PodAffinity - *out = new(v1.PodAffinity) - (*in).DeepCopyInto(*out) - } - if in.PodAntiAffinity != nil { - in, out := &in.PodAntiAffinity, &out.PodAntiAffinity - *out = new(v1.PodAntiAffinity) - (*in).DeepCopyInto(*out) - } - if in.Tolerations != nil { - in, out := &in.Tolerations, &out.Tolerations - *out = make([]v1.Toleration, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Placement. -func (in *Placement) DeepCopy() *Placement { - if in == nil { - return nil - } - out := new(Placement) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in PlacementSpec) DeepCopyInto(out *PlacementSpec) { - { - in := &in - *out = make(PlacementSpec, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementSpec. -func (in PlacementSpec) DeepCopy() PlacementSpec { - if in == nil { - return nil - } - out := new(PlacementSpec) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in PriorityClassNamesSpec) DeepCopyInto(out *PriorityClassNamesSpec) { - { - in := &in - *out = make(PriorityClassNamesSpec, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityClassNamesSpec. -func (in PriorityClassNamesSpec) DeepCopy() PriorityClassNamesSpec { - if in == nil { - return nil - } - out := new(PriorityClassNamesSpec) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in ResourceSpec) DeepCopyInto(out *ResourceSpec) { - { - in := &in - *out = make(ResourceSpec, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSpec. -func (in ResourceSpec) DeepCopy() ResourceSpec { - if in == nil { - return nil - } - out := new(ResourceSpec) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Selection) DeepCopyInto(out *Selection) { - *out = *in - if in.UseAllDevices != nil { - in, out := &in.UseAllDevices, &out.UseAllDevices - *out = new(bool) - **out = **in - } - if in.Devices != nil { - in, out := &in.Devices, &out.Devices - *out = make([]Device, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Directories != nil { - in, out := &in.Directories, &out.Directories - *out = make([]Directory, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.VolumeClaimTemplates != nil { - in, out := &in.VolumeClaimTemplates, &out.VolumeClaimTemplates - *out = make([]v1.PersistentVolumeClaim, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Selection. -func (in *Selection) DeepCopy() *Selection { - if in == nil { - return nil - } - out := new(Selection) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *StorageClassDeviceSet) DeepCopyInto(out *StorageClassDeviceSet) { - *out = *in - in.Resources.DeepCopyInto(&out.Resources) - in.Placement.DeepCopyInto(&out.Placement) - if in.Config != nil { - in, out := &in.Config, &out.Config - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.VolumeClaimTemplates != nil { - in, out := &in.VolumeClaimTemplates, &out.VolumeClaimTemplates - *out = make([]v1.PersistentVolumeClaim, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageClassDeviceSet. -func (in *StorageClassDeviceSet) DeepCopy() *StorageClassDeviceSet { - if in == nil { - return nil - } - out := new(StorageClassDeviceSet) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *StorageScopeSpec) DeepCopyInto(out *StorageScopeSpec) { - *out = *in - if in.Nodes != nil { - in, out := &in.Nodes, &out.Nodes - *out = make([]Node, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Config != nil { - in, out := &in.Config, &out.Config - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - in.Selection.DeepCopyInto(&out.Selection) - if in.VolumeSources != nil { - in, out := &in.VolumeSources, &out.VolumeSources - *out = make([]VolumeSource, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.StorageClassDeviceSets != nil { - in, out := &in.StorageClassDeviceSets, &out.StorageClassDeviceSets - *out = make([]StorageClassDeviceSet, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageScopeSpec. -func (in *StorageScopeSpec) DeepCopy() *StorageScopeSpec { - if in == nil { - return nil - } - out := new(StorageScopeSpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Volume) DeepCopyInto(out *Volume) { *out = *in @@ -497,29 +103,3 @@ func (in *VolumeList) DeepCopyObject() runtime.Object { } return nil } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VolumeSource) DeepCopyInto(out *VolumeSource) { - *out = *in - out.PersistentVolumeClaimSource = in.PersistentVolumeClaimSource - in.Resources.DeepCopyInto(&out.Resources) - in.Placement.DeepCopyInto(&out.Placement) - if in.Config != nil { - in, out := &in.Config, &out.Config - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSource. -func (in *VolumeSource) DeepCopy() *VolumeSource { - if in == nil { - return nil - } - out := new(VolumeSource) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/apis/yugabytedb.rook.io/register.go b/pkg/apis/yugabytedb.rook.io/register.go index d3b34894e..25fe8a9f1 100644 --- a/pkg/apis/yugabytedb.rook.io/register.go +++ b/pkg/apis/yugabytedb.rook.io/register.go @@ -16,5 +16,5 @@ limitations under the License. package yugabytedbrookio const ( - GroupName = "yugabytedb.rook.io" + CustomResourceGroupName = "yugabytedb.rook.io" ) diff --git a/pkg/apis/yugabytedb.rook.io/v1alpha1/register.go b/pkg/apis/yugabytedb.rook.io/v1alpha1/register.go index fe31327e6..2b293ef72 100644 --- a/pkg/apis/yugabytedb.rook.io/v1alpha1/register.go +++ b/pkg/apis/yugabytedb.rook.io/v1alpha1/register.go @@ -29,7 +29,7 @@ const ( ) // Group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: yugabytedbrookio.GroupName, Version: Version} +var SchemeGroupVersion = schema.GroupVersion{Group: yugabytedbrookio.CustomResourceGroupName, Version: Version} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { diff --git a/pkg/apis/yugabytedb.rook.io/v1alpha1/types.go b/pkg/apis/yugabytedb.rook.io/v1alpha1/types.go index 0373c613f..7b965bb58 100644 --- a/pkg/apis/yugabytedb.rook.io/v1alpha1/types.go +++ b/pkg/apis/yugabytedb.rook.io/v1alpha1/types.go @@ -19,7 +19,7 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + rook "github.com/rook/rook/pkg/apis/rook.io/v1" ) // *************************************************************************** diff --git a/pkg/apis/yugabytedb.rook.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/yugabytedb.rook.io/v1alpha1/zz_generated.deepcopy.go index 0f6fa197b..0ff76badb 100644 --- a/pkg/apis/yugabytedb.rook.io/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/yugabytedb.rook.io/v1alpha1/zz_generated.deepcopy.go @@ -21,7 +21,7 @@ limitations under the License. package v1alpha1 import ( - v1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" + v1 "github.com/rook/rook/pkg/apis/rook.io/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -145,7 +145,7 @@ func (in *YBClusterSpec) DeepCopyInto(out *YBClusterSpec) { *out = *in if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make(v1alpha2.Annotations, len(*in)) + *out = make(v1.Annotations, len(*in)) for key, val := range *in { (*out)[key] = val } diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 82ca90a7a..b031d4e7e 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -24,6 +24,7 @@ import ( cockroachdbv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/cockroachdb.rook.io/v1alpha1" edgefsv1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/edgefs.rook.io/v1" nfsv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/nfs.rook.io/v1alpha1" + rookv1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook.io/v1" rookv1alpha2 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook.io/v1alpha2" yugabytedbv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1" discovery "k8s.io/client-go/discovery" @@ -38,6 +39,7 @@ type Interface interface { CockroachdbV1alpha1() cockroachdbv1alpha1.CockroachdbV1alpha1Interface EdgefsV1() edgefsv1.EdgefsV1Interface NfsV1alpha1() nfsv1alpha1.NfsV1alpha1Interface + RookV1() rookv1.RookV1Interface RookV1alpha2() rookv1alpha2.RookV1alpha2Interface YugabytedbV1alpha1() yugabytedbv1alpha1.YugabytedbV1alpha1Interface } @@ -51,6 +53,7 @@ type Clientset struct { cockroachdbV1alpha1 *cockroachdbv1alpha1.CockroachdbV1alpha1Client edgefsV1 *edgefsv1.EdgefsV1Client nfsV1alpha1 *nfsv1alpha1.NfsV1alpha1Client + rookV1 *rookv1.RookV1Client rookV1alpha2 *rookv1alpha2.RookV1alpha2Client yugabytedbV1alpha1 *yugabytedbv1alpha1.YugabytedbV1alpha1Client } @@ -80,6 +83,11 @@ func (c *Clientset) NfsV1alpha1() nfsv1alpha1.NfsV1alpha1Interface { return c.nfsV1alpha1 } +// RookV1 retrieves the RookV1Client +func (c *Clientset) RookV1() rookv1.RookV1Interface { + return c.rookV1 +} + // RookV1alpha2 retrieves the RookV1alpha2Client func (c *Clientset) RookV1alpha2() rookv1alpha2.RookV1alpha2Interface { return c.rookV1alpha2 @@ -126,6 +134,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.rookV1, err = rookv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.rookV1alpha2, err = rookv1alpha2.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -151,6 +163,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { cs.cockroachdbV1alpha1 = cockroachdbv1alpha1.NewForConfigOrDie(c) cs.edgefsV1 = edgefsv1.NewForConfigOrDie(c) cs.nfsV1alpha1 = nfsv1alpha1.NewForConfigOrDie(c) + cs.rookV1 = rookv1.NewForConfigOrDie(c) cs.rookV1alpha2 = rookv1alpha2.NewForConfigOrDie(c) cs.yugabytedbV1alpha1 = yugabytedbv1alpha1.NewForConfigOrDie(c) @@ -166,6 +179,7 @@ func New(c rest.Interface) *Clientset { cs.cockroachdbV1alpha1 = cockroachdbv1alpha1.New(c) cs.edgefsV1 = edgefsv1.New(c) cs.nfsV1alpha1 = nfsv1alpha1.New(c) + cs.rookV1 = rookv1.New(c) cs.rookV1alpha2 = rookv1alpha2.New(c) cs.yugabytedbV1alpha1 = yugabytedbv1alpha1.New(c) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 23d05f802..7f9e64328 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -30,6 +30,8 @@ import ( fakeedgefsv1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/edgefs.rook.io/v1/fake" nfsv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/nfs.rook.io/v1alpha1" fakenfsv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/nfs.rook.io/v1alpha1/fake" + rookv1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook.io/v1" + fakerookv1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook.io/v1/fake" rookv1alpha2 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook.io/v1alpha2" fakerookv1alpha2 "github.com/rook/rook/pkg/client/clientset/versioned/typed/rook.io/v1alpha2/fake" yugabytedbv1alpha1 "github.com/rook/rook/pkg/client/clientset/versioned/typed/yugabytedb.rook.io/v1alpha1" @@ -108,6 +110,11 @@ func (c *Clientset) NfsV1alpha1() nfsv1alpha1.NfsV1alpha1Interface { return &fakenfsv1alpha1.FakeNfsV1alpha1{Fake: &c.Fake} } +// RookV1 retrieves the RookV1Client +func (c *Clientset) RookV1() rookv1.RookV1Interface { + return &fakerookv1.FakeRookV1{Fake: &c.Fake} +} + // RookV1alpha2 retrieves the RookV1alpha2Client func (c *Clientset) RookV1alpha2() rookv1alpha2.RookV1alpha2Interface { return &fakerookv1alpha2.FakeRookV1alpha2{Fake: &c.Fake} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index ab492d0e7..d5df03b87 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -24,6 +24,7 @@ import ( cockroachdbv1alpha1 "github.com/rook/rook/pkg/apis/cockroachdb.rook.io/v1alpha1" edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1" nfsv1alpha1 "github.com/rook/rook/pkg/apis/nfs.rook.io/v1alpha1" + rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1" rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" yugabytedbv1alpha1 "github.com/rook/rook/pkg/apis/yugabytedb.rook.io/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -42,6 +43,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ cockroachdbv1alpha1.AddToScheme, edgefsv1.AddToScheme, nfsv1alpha1.AddToScheme, + rookv1.AddToScheme, rookv1alpha2.AddToScheme, yugabytedbv1alpha1.AddToScheme, } diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 5ee7ebb18..2babfa58f 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -24,6 +24,7 @@ import ( cockroachdbv1alpha1 "github.com/rook/rook/pkg/apis/cockroachdb.rook.io/v1alpha1" edgefsv1 "github.com/rook/rook/pkg/apis/edgefs.rook.io/v1" nfsv1alpha1 "github.com/rook/rook/pkg/apis/nfs.rook.io/v1alpha1" + rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1" rookv1alpha2 "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" yugabytedbv1alpha1 "github.com/rook/rook/pkg/apis/yugabytedb.rook.io/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -42,6 +43,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ cockroachdbv1alpha1.AddToScheme, edgefsv1.AddToScheme, nfsv1alpha1.AddToScheme, + rookv1.AddToScheme, rookv1alpha2.AddToScheme, yugabytedbv1alpha1.AddToScheme, } diff --git a/pkg/client/clientset/versioned/typed/rook.io/v1/doc.go b/pkg/client/clientset/versioned/typed/rook.io/v1/doc.go new file mode 100644 index 000000000..3af5d054f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook.io/v1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/client/clientset/versioned/typed/rook.io/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/rook.io/v1/fake/doc.go new file mode 100644 index 000000000..16f443990 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook.io/v1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/rook.io/v1/fake/fake_rook.io_client.go b/pkg/client/clientset/versioned/typed/rook.io/v1/fake/fake_rook.io_client.go new file mode 100644 index 000000000..cb4e281c2 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook.io/v1/fake/fake_rook.io_client.go @@ -0,0 +1,35 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeRookV1 struct { + *testing.Fake +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeRookV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/rook.io/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/rook.io/v1/generated_expansion.go new file mode 100644 index 000000000..177209ec6 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook.io/v1/generated_expansion.go @@ -0,0 +1,19 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 diff --git a/pkg/client/clientset/versioned/typed/rook.io/v1/rook.io_client.go b/pkg/client/clientset/versioned/typed/rook.io/v1/rook.io_client.go new file mode 100644 index 000000000..230feba99 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/rook.io/v1/rook.io_client.go @@ -0,0 +1,85 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/rook/rook/pkg/apis/rook.io/v1" + "github.com/rook/rook/pkg/client/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type RookV1Interface interface { + RESTClient() rest.Interface +} + +// RookV1Client is used to interact with features provided by the rook.io group. +type RookV1Client struct { + restClient rest.Interface +} + +// NewForConfig creates a new RookV1Client for the given config. +func NewForConfig(c *rest.Config) (*RookV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &RookV1Client{client}, nil +} + +// NewForConfigOrDie creates a new RookV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *RookV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new RookV1Client for the given RESTClient. +func New(c rest.Interface) *RookV1Client { + return &RookV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *RookV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/daemon/ceph/agent/flexvolume/attachment/resource.go b/pkg/daemon/ceph/agent/flexvolume/attachment/resource.go index 1ddbbe1d4..263de46b2 100644 --- a/pkg/daemon/ceph/agent/flexvolume/attachment/resource.go +++ b/pkg/daemon/ceph/agent/flexvolume/attachment/resource.go @@ -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(), } diff --git a/pkg/operator/cassandra/controller/util/util.go b/pkg/operator/cassandra/controller/util/util.go index 355ff1fa2..baa2f242e 100644 --- a/pkg/operator/cassandra/controller/util/util.go +++ b/pkg/operator/cassandra/controller/util/util.go @@ -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", }) diff --git a/pkg/operator/ceph/cluster/cluster.go b/pkg/operator/ceph/cluster/cluster.go index 67ef81fa2..f1504babe 100755 --- a/pkg/operator/ceph/cluster/cluster.go +++ b/pkg/operator/ceph/cluster/cluster.go @@ -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) { diff --git a/pkg/operator/ceph/cluster/controller_test.go b/pkg/operator/ceph/cluster/controller_test.go index 609461e46..e7fa9beb5 100644 --- a/pkg/operator/ceph/cluster/controller_test.go +++ b/pkg/operator/ceph/cluster/controller_test.go @@ -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) diff --git a/pkg/operator/ceph/cluster/mgr/mgr.go b/pkg/operator/ceph/cluster/mgr/mgr.go index 5904e0617..337f14acd 100644 --- a/pkg/operator/ceph/cluster/mgr/mgr.go +++ b/pkg/operator/ceph/cluster/mgr/mgr.go @@ -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, diff --git a/pkg/operator/ceph/cluster/mgr/mgr_test.go b/pkg/operator/ceph/cluster/mgr/mgr_test.go index 7816e01a9..54d711da0 100755 --- a/pkg/operator/ceph/cluster/mgr/mgr_test.go +++ b/pkg/operator/ceph/cluster/mgr/mgr_test.go @@ -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: ""}, diff --git a/pkg/operator/ceph/cluster/mgr/spec.go b/pkg/operator/ceph/cluster/mgr/spec.go index 0d3841477..c6a76fed5 100644 --- a/pkg/operator/ceph/cluster/mgr/spec.go +++ b/pkg/operator/ceph/cluster/mgr/spec.go @@ -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), } diff --git a/pkg/operator/ceph/cluster/mgr/spec_test.go b/pkg/operator/ceph/cluster/mgr/spec_test.go index 2e10c9f11..14f9ad3e6 100644 --- a/pkg/operator/ceph/cluster/mgr/spec_test.go +++ b/pkg/operator/ceph/cluster/mgr/spec_test.go @@ -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 diff --git a/pkg/operator/ceph/cluster/mon/node_test.go b/pkg/operator/ceph/cluster/mon/node_test.go index 47b02ada5..6ea232015 100644 --- a/pkg/operator/ceph/cluster/mon/node_test.go +++ b/pkg/operator/ceph/cluster/mon/node_test.go @@ -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{ { diff --git a/pkg/operator/ceph/cluster/mon/spec_test.go b/pkg/operator/ceph/cluster/mon/spec_test.go index 2151db89b..6e18faacb 100644 --- a/pkg/operator/ceph/cluster/mon/spec_test.go +++ b/pkg/operator/ceph/cluster/mon/spec_test.go @@ -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) diff --git a/pkg/operator/ceph/cluster/osd/deviceSet.go b/pkg/operator/ceph/cluster/osd/deviceSet.go index 83593ebba..51f739ec3 100644 --- a/pkg/operator/ceph/cluster/osd/deviceSet.go +++ b/pkg/operator/ceph/cluster/osd/deviceSet.go @@ -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, diff --git a/pkg/operator/ceph/cluster/osd/osd.go b/pkg/operator/ceph/cluster/osd/osd.go index b74b9d320..6c1bbe283 100644 --- a/pkg/operator/ceph/cluster/osd/osd.go +++ b/pkg/operator/ceph/cluster/osd/osd.go @@ -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 { diff --git a/pkg/operator/ceph/cluster/osd/osd_test.go b/pkg/operator/ceph/cluster/osd/osd_test.go index 2bbd7aa06..b0ad1ba0b 100644 --- a/pkg/operator/ceph/cluster/osd/osd_test.go +++ b/pkg/operator/ceph/cluster/osd/osd_test.go @@ -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{}, } diff --git a/pkg/operator/ceph/cluster/osd/spec_test.go b/pkg/operator/ceph/cluster/osd/spec_test.go index 005f8a870..7eb58ae96 100644 --- a/pkg/operator/ceph/cluster/osd/spec_test.go +++ b/pkg/operator/ceph/cluster/osd/spec_test.go @@ -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{ diff --git a/pkg/operator/ceph/cluster/osd/status_test.go b/pkg/operator/ceph/cluster/osd/status_test.go index 4ec5fe112..9c814ada5 100644 --- a/pkg/operator/ceph/cluster/osd/status_test.go +++ b/pkg/operator/ceph/cluster/osd/status_test.go @@ -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) diff --git a/pkg/operator/ceph/cluster/rbd/mirror.go b/pkg/operator/ceph/cluster/rbd/mirror.go index 4662b407f..61e4bce67 100644 --- a/pkg/operator/ceph/cluster/rbd/mirror.go +++ b/pkg/operator/ceph/cluster/rbd/mirror.go @@ -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, diff --git a/pkg/operator/ceph/cluster/rbd/mirror_test.go b/pkg/operator/ceph/cluster/rbd/mirror_test.go index e983c92a1..9680a5614 100644 --- a/pkg/operator/ceph/cluster/rbd/mirror_test.go +++ b/pkg/operator/ceph/cluster/rbd/mirror_test.go @@ -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{}, diff --git a/pkg/operator/ceph/cluster/rbd/spec_test.go b/pkg/operator/ceph/cluster/rbd/spec_test.go index dad32d6b0..1c4a74174 100644 --- a/pkg/operator/ceph/cluster/rbd/spec_test.go +++ b/pkg/operator/ceph/cluster/rbd/spec_test.go @@ -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{ diff --git a/pkg/operator/cockroachdb/controller.go b/pkg/operator/cockroachdb/controller.go index ea9ae1a7b..afdc5f5aa 100644 --- a/pkg/operator/cockroachdb/controller.go +++ b/pkg/operator/cockroachdb/controller.go @@ -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 } diff --git a/pkg/operator/cockroachdb/controller_test.go b/pkg/operator/cockroachdb/controller_test.go index d0638a268..599cf9cc8 100644 --- a/pkg/operator/cockroachdb/controller_test.go +++ b/pkg/operator/cockroachdb/controller_test.go @@ -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{ diff --git a/pkg/operator/discover/discover.go b/pkg/operator/discover/discover.go index b4838a2cb..ee7823fd7 100644 --- a/pkg/operator/discover/discover.go +++ b/pkg/operator/discover/discover.go @@ -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) diff --git a/pkg/operator/discover/discover_test.go b/pkg/operator/discover/discover_test.go index 862cc379a..12f913dda 100644 --- a/pkg/operator/discover/discover_test.go +++ b/pkg/operator/discover/discover_test.go @@ -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", }, diff --git a/pkg/operator/edgefs/cluster/cluster.go b/pkg/operator/edgefs/cluster/cluster.go index b8665a913..90ef482fa 100644 --- a/pkg/operator/edgefs/cluster/cluster.go +++ b/pkg/operator/edgefs/cluster/cluster.go @@ -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 diff --git a/pkg/operator/edgefs/cluster/cluster_deployment_config.go b/pkg/operator/edgefs/cluster/cluster_deployment_config.go index 266201e8a..952552642 100644 --- a/pkg/operator/edgefs/cluster/cluster_deployment_config.go +++ b/pkg/operator/edgefs/cluster/cluster_deployment_config.go @@ -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) diff --git a/pkg/operator/edgefs/cluster/controller_test.go b/pkg/operator/edgefs/cluster/controller_test.go index 502c1ae55..50f9ceb28 100644 --- a/pkg/operator/edgefs/cluster/controller_test.go +++ b/pkg/operator/edgefs/cluster/controller_test.go @@ -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)) } diff --git a/pkg/operator/edgefs/cluster/mgr/mgr.go b/pkg/operator/edgefs/cluster/mgr/mgr.go index cfea011e7..65a2798e5 100644 --- a/pkg/operator/edgefs/cluster/mgr/mgr.go +++ b/pkg/operator/edgefs/cluster/mgr/mgr.go @@ -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, diff --git a/pkg/operator/edgefs/cluster/mgr/mgr_test.go b/pkg/operator/edgefs/cluster/mgr/mgr_test.go index 0cc101a6f..310a4b379 100644 --- a/pkg/operator/edgefs/cluster/mgr/mgr_test.go +++ b/pkg/operator/edgefs/cluster/mgr/mgr_test.go @@ -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) diff --git a/pkg/operator/edgefs/cluster/prepare/prepare.go b/pkg/operator/edgefs/cluster/prepare/prepare.go index 27f692f10..41c55ee87 100644 --- a/pkg/operator/edgefs/cluster/prepare/prepare.go +++ b/pkg/operator/edgefs/cluster/prepare/prepare.go @@ -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 { diff --git a/pkg/operator/edgefs/cluster/target/layout.go b/pkg/operator/edgefs/cluster/target/layout.go index 368d26c0f..0f07b0c02 100644 --- a/pkg/operator/edgefs/cluster/target/layout.go +++ b/pkg/operator/edgefs/cluster/target/layout.go @@ -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 diff --git a/pkg/operator/edgefs/cluster/target/pod_test.go b/pkg/operator/edgefs/cluster/target/pod_test.go index d75abdd14..8846c8c1f 100644 --- a/pkg/operator/edgefs/cluster/target/pod_test.go +++ b/pkg/operator/edgefs/cluster/target/pod_test.go @@ -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) diff --git a/pkg/operator/edgefs/cluster/target/target.go b/pkg/operator/edgefs/cluster/target/target.go index 0f0d041ff..76771f49e 100644 --- a/pkg/operator/edgefs/cluster/target/target.go +++ b/pkg/operator/edgefs/cluster/target/target.go @@ -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) diff --git a/pkg/operator/edgefs/cluster/utils.go b/pkg/operator/edgefs/cluster/utils.go index 42010bbf9..e75e3e597 100644 --- a/pkg/operator/edgefs/cluster/utils.go +++ b/pkg/operator/edgefs/cluster/utils.go @@ -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) diff --git a/pkg/operator/edgefs/iscsi/controller.go b/pkg/operator/edgefs/iscsi/controller.go index 55914d719..35efdbc81 100644 --- a/pkg/operator/edgefs/iscsi/controller.go +++ b/pkg/operator/edgefs/iscsi/controller.go @@ -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, diff --git a/pkg/operator/edgefs/isgw/controller.go b/pkg/operator/edgefs/isgw/controller.go index 3654a141c..1a5e293e2 100644 --- a/pkg/operator/edgefs/isgw/controller.go +++ b/pkg/operator/edgefs/isgw/controller.go @@ -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, diff --git a/pkg/operator/edgefs/nfs/controller.go b/pkg/operator/edgefs/nfs/controller.go index d9f24cf12..182a4beb9 100644 --- a/pkg/operator/edgefs/nfs/controller.go +++ b/pkg/operator/edgefs/nfs/controller.go @@ -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, diff --git a/pkg/operator/edgefs/s3/controller.go b/pkg/operator/edgefs/s3/controller.go index 33b9770a5..70e4bf7ce 100644 --- a/pkg/operator/edgefs/s3/controller.go +++ b/pkg/operator/edgefs/s3/controller.go @@ -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, diff --git a/pkg/operator/edgefs/s3x/controller.go b/pkg/operator/edgefs/s3x/controller.go index 0f25661de..0831c6ca7 100644 --- a/pkg/operator/edgefs/s3x/controller.go +++ b/pkg/operator/edgefs/s3x/controller.go @@ -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, diff --git a/pkg/operator/edgefs/swift/controller.go b/pkg/operator/edgefs/swift/controller.go index 1ed301a3a..e88722de6 100644 --- a/pkg/operator/edgefs/swift/controller.go +++ b/pkg/operator/edgefs/swift/controller.go @@ -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, diff --git a/pkg/operator/k8sutil/network.go b/pkg/operator/k8sutil/network.go index 3235093f5..22af146ed 100644 --- a/pkg/operator/k8sutil/network.go +++ b/pkg/operator/k8sutil/network.go @@ -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) diff --git a/pkg/operator/k8sutil/network_test.go b/pkg/operator/k8sutil/network_test.go index aed690e0a..0454ed503 100644 --- a/pkg/operator/k8sutil/network_test.go +++ b/pkg/operator/k8sutil/network_test.go @@ -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"}`, diff --git a/pkg/operator/k8sutil/node.go b/pkg/operator/k8sutil/node.go index 2e32a9192..f950f87c5 100644 --- a/pkg/operator/k8sutil/node.go +++ b/pkg/operator/k8sutil/node.go @@ -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 diff --git a/pkg/operator/k8sutil/node_test.go b/pkg/operator/k8sutil/node_test.go index 1238f72a1..ea3eba066 100644 --- a/pkg/operator/k8sutil/node_test.go +++ b/pkg/operator/k8sutil/node_test.go @@ -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"}} diff --git a/pkg/operator/k8sutil/pod.go b/pkg/operator/k8sutil/pod.go index f15373639..50fbbac64 100644 --- a/pkg/operator/k8sutil/pod.go +++ b/pkg/operator/k8sutil/pod.go @@ -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 diff --git a/pkg/operator/k8sutil/pod_test.go b/pkg/operator/k8sutil/pod_test.go index e0ed30194..aef5bae14 100644 --- a/pkg/operator/k8sutil/pod_test.go +++ b/pkg/operator/k8sutil/pod_test.go @@ -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) diff --git a/pkg/operator/yugabytedb/controller.go b/pkg/operator/yugabytedb/controller.go index bb7a1131a..4252f2e90 100644 --- a/pkg/operator/yugabytedb/controller.go +++ b/pkg/operator/yugabytedb/controller.go @@ -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 }