From 77171fa2e27f3510de02cd8d55fdc5c9009f548d Mon Sep 17 00:00:00 2001 From: travisn Date: Fri, 21 Sep 2018 16:31:42 -0600 Subject: [PATCH] operator: crd updates to support decoupled ceph version Signed-off-by: travisn --- cluster/examples/kubernetes/ceph/cluster.yaml | 11 ++++- .../examples/kubernetes/ceph/operator.yaml | 45 +++++++++++++++++++ pkg/apis/ceph.rook.io/v1beta1/types.go | 15 +++++++ pkg/apis/ceph.rook.io/v1beta1/version.go | 22 +++++++++ .../v1beta1/zz_generated.deepcopy.go | 17 +++++++ 5 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 pkg/apis/ceph.rook.io/v1beta1/version.go diff --git a/cluster/examples/kubernetes/ceph/cluster.yaml b/cluster/examples/kubernetes/ceph/cluster.yaml index 33c012bf2..dc8769d4c 100644 --- a/cluster/examples/kubernetes/ceph/cluster.yaml +++ b/cluster/examples/kubernetes/ceph/cluster.yaml @@ -55,6 +55,15 @@ metadata: name: rook-ceph namespace: rook-ceph spec: + cephVersion: + # The container image used to launch the Ceph daemon pods (mon, mgr, osd, mds, rgw) + image: ceph/ceph:v12.2.7 + # The name of the major release of Ceph. Must be luminous, mimic, or nautilus + name: luminous + # Whether to allow unsupported versions of Ceph. Currently only luminous and mimic are supported. + # After nautilus is released, Rook will be updated to support nautilus. + # Do not set to true in production. + allowUnsupported: false # The path on the host where configuration files will be persisted. If not specified, a kubernetes emptyDir will be created (not recommended). # Important: if you reinstall the cluster, make sure you delete this directory from each host or else the mons will fail to start on the new cluster. # In Minikube, the '/data' directory is configured to persist across reboots. Use "/data/rook" in Minikube environment. @@ -64,7 +73,7 @@ spec: # set the amount of mons to be started mon: count: 3 - allowMultiplePerNode: true + allowMultiplePerNode: True # enable the ceph dashboard for viewing cluster status dashboard: enabled: true diff --git a/cluster/examples/kubernetes/ceph/operator.yaml b/cluster/examples/kubernetes/ceph/operator.yaml index 7f9cb834a..ed463d2c2 100644 --- a/cluster/examples/kubernetes/ceph/operator.yaml +++ b/cluster/examples/kubernetes/ceph/operator.yaml @@ -18,6 +18,51 @@ spec: - rcc scope: Namespaced version: v1beta1 + validation: + openAPIV3Schema: + properties: + spec: + properties: + cephVersion: + properties: + allowUnsupported: + type: boolean + image: + type: string + name: + pattern: ^(luminous|mimic|nautilus)$ + type: string + dashboard: + properties: + enabled: + type: boolean + dataDirHostPath: + pattern: ^/(\S+) + type: string + mon: + properties: + allowMultiplePerNode: + type: boolean + count: + maximum: 9 + minimum: 1 + type: integer + required: + - count + network: + properties: + hostNetwork: + type: boolean + storage: + properties: + nodes: + items: {} + type: array + useAllDevices: {} + useAllNodes: + type: boolean + required: + - mon --- apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition diff --git a/pkg/apis/ceph.rook.io/v1beta1/types.go b/pkg/apis/ceph.rook.io/v1beta1/types.go index 88b84e48a..c7224680f 100644 --- a/pkg/apis/ceph.rook.io/v1beta1/types.go +++ b/pkg/apis/ceph.rook.io/v1beta1/types.go @@ -48,6 +48,9 @@ type ClusterList struct { } type ClusterSpec struct { + // The version information that instructs Rook to orchestrate a particular version of Ceph. + 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"` @@ -73,6 +76,18 @@ type ClusterSpec struct { Dashboard DashboardSpec `json:"dashboard,omitempty"` } +// VersionSpec represents the settings for the Ceph version that Rook is orchestrating. +type CephVersionSpec struct { + // Image is the container image used to launch the ceph daemons, such as ceph/ceph:v12.2.7 or ceph/ceph:v13.2.1 + Image string `json:"image,omitempty"` + + // The name of the major release of Ceph: luminous, mimic, or nautilus + Name string `json:"name,omitempty"` + + // Whether to allow unsupported versions (do not set to true in production) + AllowUnsupported bool `json:"allowUnsupported,omitempty"` +} + // DashboardSpec represents the settings for the Ceph dashboard type DashboardSpec struct { // Whether to enable the dashboard diff --git a/pkg/apis/ceph.rook.io/v1beta1/version.go b/pkg/apis/ceph.rook.io/v1beta1/version.go new file mode 100644 index 000000000..be9c3d68a --- /dev/null +++ b/pkg/apis/ceph.rook.io/v1beta1/version.go @@ -0,0 +1,22 @@ +/* +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 v1beta1 + +const ( + Luminous = "luminous" + Mimic = "mimic" + Nautilus = "nautilus" +) diff --git a/pkg/apis/ceph.rook.io/v1beta1/zz_generated.deepcopy.go b/pkg/apis/ceph.rook.io/v1beta1/zz_generated.deepcopy.go index d1c0f4889..ddb38375f 100644 --- a/pkg/apis/ceph.rook.io/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/ceph.rook.io/v1beta1/zz_generated.deepcopy.go @@ -25,6 +25,22 @@ import ( 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 *CephVersionSpec) DeepCopyInto(out *CephVersionSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CephVersionSpec. +func (in *CephVersionSpec) DeepCopy() *CephVersionSpec { + if in == nil { + return nil + } + out := new(CephVersionSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Cluster) DeepCopyInto(out *Cluster) { *out = *in @@ -89,6 +105,7 @@ func (in *ClusterList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { *out = *in + out.CephVersion = in.CephVersion in.Storage.DeepCopyInto(&out.Storage) if in.Placement != nil { in, out := &in.Placement, &out.Placement