Skip to content

Commit

Permalink
Merge pull request #14187 from travisn/legacy-osd-status
Browse files Browse the repository at this point in the history
osd: Add cephcluster status for deprecated osds to replace
  • Loading branch information
satoru-takeuchi committed May 13, 2024
2 parents 5e3d623 + 3628e83 commit 39f8852
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 10 deletions.
10 changes: 10 additions & 0 deletions Documentation/CRDs/specification.md
Expand Up @@ -4054,6 +4054,16 @@ OSDStatus
<td>
</td>
</tr>
<tr>
<td>
<code>deprecatedOSDs</code><br/>
<em>
map[string][]int
</em>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<h3 id="ceph.rook.io/v1.CephVersionSpec">CephVersionSpec
Expand Down
6 changes: 6 additions & 0 deletions deploy/charts/rook-ceph/templates/resources.yaml
Expand Up @@ -5159,6 +5159,12 @@ spec:
storage:
description: CephStorage represents flavors of Ceph Cluster Storage
properties:
deprecatedOSDs:
additionalProperties:
items:
type: integer
type: array
type: object
deviceClasses:
items:
description: DeviceClasses represents device classes of a Ceph Cluster
Expand Down
6 changes: 6 additions & 0 deletions deploy/examples/crds.yaml
Expand Up @@ -5157,6 +5157,12 @@ spec:
storage:
description: CephStorage represents flavors of Ceph Cluster Storage
properties:
deprecatedOSDs:
additionalProperties:
items:
type: integer
type: array
type: object
deviceClasses:
items:
description: DeviceClasses represents device classes of a Ceph Cluster
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/ceph.rook.io/v1/types.go
Expand Up @@ -473,8 +473,9 @@ type Capacity struct {

// CephStorage represents flavors of Ceph Cluster Storage
type CephStorage struct {
DeviceClasses []DeviceClasses `json:"deviceClasses,omitempty"`
OSD OSDStatus `json:"osd,omitempty"`
DeviceClasses []DeviceClasses `json:"deviceClasses,omitempty"`
OSD OSDStatus `json:"osd,omitempty"`
DeprecatedOSDs map[string][]int `json:"deprecatedOSDs,omitempty"`
}

// DeviceClasses represents device classes of a Ceph Cluster
Expand Down
20 changes: 12 additions & 8 deletions pkg/operator/ceph/cluster/osd/osd.go
Expand Up @@ -77,14 +77,15 @@ const (

// Cluster keeps track of the OSDs
type Cluster struct {
context *clusterd.Context
clusterInfo *cephclient.ClusterInfo
rookVersion string
spec cephv1.ClusterSpec
ValidStorage cephv1.StorageScopeSpec // valid subset of `Storage`, computed at runtime
kv *k8sutil.ConfigMapKVStore
deviceSets []deviceSet
replaceOSD *OSDReplaceInfo
context *clusterd.Context
clusterInfo *cephclient.ClusterInfo
rookVersion string
spec cephv1.ClusterSpec
ValidStorage cephv1.StorageScopeSpec // valid subset of `Storage`, computed at runtime
kv *k8sutil.ConfigMapKVStore
deviceSets []deviceSet
replaceOSD *OSDReplaceInfo
deprecatedOSDs map[string][]int
}

// New creates an instance of the OSD manager
Expand Down Expand Up @@ -902,6 +903,9 @@ func (c *Cluster) updateCephStorageStatus() error {

cephClusterStorage.OSD = *osdStore

// Add the status about deprecated OSDs
cephClusterStorage.DeprecatedOSDs = c.deprecatedOSDs

err = c.context.Client.Get(c.clusterInfo.Context, c.clusterInfo.NamespacedName(), &cephCluster)
if err != nil {
if kerrors.IsNotFound(err) {
Expand Down
7 changes: 7 additions & 0 deletions pkg/operator/ceph/cluster/osd/spec.go
Expand Up @@ -555,6 +555,13 @@ func (c *Cluster) makeDeployment(osdProps osdProperties, osd OSDInfo, provisionC
if osdProps.onPVC() {
if osd.CVMode == "lvm" {
initContainers = append(initContainers, c.getPVCInitContainer(osdProps))

// This is a deprecated OSD and should be replaced for future supportability
if c.deprecatedOSDs == nil {
c.deprecatedOSDs = make(map[string][]int)
}
reason := "LVM-based OSDs on a PVC are deprecated, see documentation on replacing OSDs"
c.deprecatedOSDs[reason] = append(c.deprecatedOSDs[reason], osd.ID)
} else {
// Raw mode on PVC needs this path so that OSD's metadata files can be chown after 'ceph-bluestore-tool' ran
dataPath = activateOSDMountPath + osdID
Expand Down

0 comments on commit 39f8852

Please sign in to comment.