diff --git a/Documentation/CRDs/specification.md b/Documentation/CRDs/specification.md index 54f0810d5..57c79c9ab 100644 --- a/Documentation/CRDs/specification.md +++ b/Documentation/CRDs/specification.md @@ -8754,6 +8754,46 @@ StatesSpec

States is the various state for all mirrored images

+ + +image_states
+ + +StatesSpec + + + + +(Optional) +

ImageStates is the various state for all mirrored images

+ + + + +group_health
+ +string + + + +(Optional) +

GroupHealth is the health of the mirrored image group

+ + + + +group_states
+ + +StatesSpec + + + + +(Optional) +

GroupStates is the various state for all mirrored image groups

+ +

Module diff --git a/deploy/charts/rook-ceph/templates/resources.yaml b/deploy/charts/rook-ceph/templates/resources.yaml index 99a367d62..a4ad7fb2b 100644 --- a/deploy/charts/rook-ceph/templates/resources.yaml +++ b/deploy/charts/rook-ceph/templates/resources.yaml @@ -187,12 +187,68 @@ spec: daemon_health: description: DaemonHealth is the health of the mirroring daemon type: string + group_health: + description: GroupHealth is the health of the mirrored image group + nullable: true + type: string + group_states: + description: GroupStates is the various state for all mirrored image groups + nullable: true + properties: + error: + description: Error is when the mirroring state is errored + type: integer + replaying: + description: Replaying is when the replay of the mirroring journal is on-going + type: integer + starting_replay: + description: StartingReplay is when the replay of the mirroring journal starts + type: integer + stopped: + description: Stopped is when the mirroring state is stopped + type: integer + stopping_replay: + description: StopReplaying is when the replay of the mirroring journal stops + type: integer + syncing: + description: Syncing is when the image is syncing + type: integer + unknown: + description: Unknown is when the mirroring state is unknown + type: integer + type: object health: description: Health is the mirroring health type: string image_health: description: ImageHealth is the health of the mirrored image type: string + image_states: + description: ImageStates is the various state for all mirrored images + nullable: true + properties: + error: + description: Error is when the mirroring state is errored + type: integer + replaying: + description: Replaying is when the replay of the mirroring journal is on-going + type: integer + starting_replay: + description: StartingReplay is when the replay of the mirroring journal starts + type: integer + stopped: + description: Stopped is when the mirroring state is stopped + type: integer + stopping_replay: + description: StopReplaying is when the replay of the mirroring journal stops + type: integer + syncing: + description: Syncing is when the image is syncing + type: integer + unknown: + description: Unknown is when the mirroring state is unknown + type: integer + type: object states: description: States is the various state for all mirrored images nullable: true @@ -619,12 +675,68 @@ spec: daemon_health: description: DaemonHealth is the health of the mirroring daemon type: string + group_health: + description: GroupHealth is the health of the mirrored image group + nullable: true + type: string + group_states: + description: GroupStates is the various state for all mirrored image groups + nullable: true + properties: + error: + description: Error is when the mirroring state is errored + type: integer + replaying: + description: Replaying is when the replay of the mirroring journal is on-going + type: integer + starting_replay: + description: StartingReplay is when the replay of the mirroring journal starts + type: integer + stopped: + description: Stopped is when the mirroring state is stopped + type: integer + stopping_replay: + description: StopReplaying is when the replay of the mirroring journal stops + type: integer + syncing: + description: Syncing is when the image is syncing + type: integer + unknown: + description: Unknown is when the mirroring state is unknown + type: integer + type: object health: description: Health is the mirroring health type: string image_health: description: ImageHealth is the health of the mirrored image type: string + image_states: + description: ImageStates is the various state for all mirrored images + nullable: true + properties: + error: + description: Error is when the mirroring state is errored + type: integer + replaying: + description: Replaying is when the replay of the mirroring journal is on-going + type: integer + starting_replay: + description: StartingReplay is when the replay of the mirroring journal starts + type: integer + stopped: + description: Stopped is when the mirroring state is stopped + type: integer + stopping_replay: + description: StopReplaying is when the replay of the mirroring journal stops + type: integer + syncing: + description: Syncing is when the image is syncing + type: integer + unknown: + description: Unknown is when the mirroring state is unknown + type: integer + type: object states: description: States is the various state for all mirrored images nullable: true diff --git a/deploy/examples/crds.yaml b/deploy/examples/crds.yaml index be7bc6ef0..779028579 100644 --- a/deploy/examples/crds.yaml +++ b/deploy/examples/crds.yaml @@ -190,12 +190,68 @@ spec: daemon_health: description: DaemonHealth is the health of the mirroring daemon type: string + group_health: + description: GroupHealth is the health of the mirrored image group + nullable: true + type: string + group_states: + description: GroupStates is the various state for all mirrored image groups + nullable: true + properties: + error: + description: Error is when the mirroring state is errored + type: integer + replaying: + description: Replaying is when the replay of the mirroring journal is on-going + type: integer + starting_replay: + description: StartingReplay is when the replay of the mirroring journal starts + type: integer + stopped: + description: Stopped is when the mirroring state is stopped + type: integer + stopping_replay: + description: StopReplaying is when the replay of the mirroring journal stops + type: integer + syncing: + description: Syncing is when the image is syncing + type: integer + unknown: + description: Unknown is when the mirroring state is unknown + type: integer + type: object health: description: Health is the mirroring health type: string image_health: description: ImageHealth is the health of the mirrored image type: string + image_states: + description: ImageStates is the various state for all mirrored images + nullable: true + properties: + error: + description: Error is when the mirroring state is errored + type: integer + replaying: + description: Replaying is when the replay of the mirroring journal is on-going + type: integer + starting_replay: + description: StartingReplay is when the replay of the mirroring journal starts + type: integer + stopped: + description: Stopped is when the mirroring state is stopped + type: integer + stopping_replay: + description: StopReplaying is when the replay of the mirroring journal stops + type: integer + syncing: + description: Syncing is when the image is syncing + type: integer + unknown: + description: Unknown is when the mirroring state is unknown + type: integer + type: object states: description: States is the various state for all mirrored images nullable: true @@ -621,12 +677,68 @@ spec: daemon_health: description: DaemonHealth is the health of the mirroring daemon type: string + group_health: + description: GroupHealth is the health of the mirrored image group + nullable: true + type: string + group_states: + description: GroupStates is the various state for all mirrored image groups + nullable: true + properties: + error: + description: Error is when the mirroring state is errored + type: integer + replaying: + description: Replaying is when the replay of the mirroring journal is on-going + type: integer + starting_replay: + description: StartingReplay is when the replay of the mirroring journal starts + type: integer + stopped: + description: Stopped is when the mirroring state is stopped + type: integer + stopping_replay: + description: StopReplaying is when the replay of the mirroring journal stops + type: integer + syncing: + description: Syncing is when the image is syncing + type: integer + unknown: + description: Unknown is when the mirroring state is unknown + type: integer + type: object health: description: Health is the mirroring health type: string image_health: description: ImageHealth is the health of the mirrored image type: string + image_states: + description: ImageStates is the various state for all mirrored images + nullable: true + properties: + error: + description: Error is when the mirroring state is errored + type: integer + replaying: + description: Replaying is when the replay of the mirroring journal is on-going + type: integer + starting_replay: + description: StartingReplay is when the replay of the mirroring journal starts + type: integer + stopped: + description: Stopped is when the mirroring state is stopped + type: integer + stopping_replay: + description: StopReplaying is when the replay of the mirroring journal stops + type: integer + syncing: + description: Syncing is when the image is syncing + type: integer + unknown: + description: Unknown is when the mirroring state is unknown + type: integer + type: object states: description: States is the various state for all mirrored images nullable: true diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go index a707926a9..a251f9254 100755 --- a/pkg/apis/ceph.rook.io/v1/types.go +++ b/pkg/apis/ceph.rook.io/v1/types.go @@ -937,6 +937,18 @@ type MirroringStatusSummarySpec struct { // +optional // +nullable States StatesSpec `json:"states,omitempty"` + // ImageStates is the various state for all mirrored images + // +optional + // +nullable + ImageStates *StatesSpec `json:"image_states,omitempty"` + // GroupHealth is the health of the mirrored image group + // +optional + // +nullable + GroupHealth string `json:"group_health,omitempty"` + // GroupStates is the various state for all mirrored image groups + // +optional + // +nullable + GroupStates StatesSpec `json:"group_states,omitempty"` } // StatesSpec are rbd images mirroring state 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 987aa341b..6fe32d193 100644 --- a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go @@ -3295,7 +3295,7 @@ func (in *MirroringStatus) DeepCopyInto(out *MirroringStatus) { if in.Summary != nil { in, out := &in.Summary, &out.Summary *out = new(MirroringStatusSummarySpec) - **out = **in + (*in).DeepCopyInto(*out) } return } @@ -3331,6 +3331,12 @@ func (in *MirroringStatusSpec) DeepCopy() *MirroringStatusSpec { func (in *MirroringStatusSummarySpec) DeepCopyInto(out *MirroringStatusSummarySpec) { *out = *in out.States = in.States + if in.ImageStates != nil { + in, out := &in.ImageStates, &out.ImageStates + *out = new(StatesSpec) + **out = **in + } + out.GroupStates = in.GroupStates return } diff --git a/pkg/daemon/ceph/client/mirror.go b/pkg/daemon/ceph/client/mirror.go index 06eb6c895..0f29f5f9a 100644 --- a/pkg/daemon/ceph/client/mirror.go +++ b/pkg/daemon/ceph/client/mirror.go @@ -205,6 +205,14 @@ func GetPoolMirroringStatus(context *clusterd.Context, clusterInfo *ClusterInfo, return nil, errors.Wrap(err, "failed to unmarshal mirror pool status response") } + if poolMirroringStatus.Summary != nil { + // for backward compatibility, we need to set the states field + // so to avoid breaking changes in the CRD that rook user might be using + if poolMirroringStatus.Summary.ImageStates != nil { + poolMirroringStatus.Summary.States = *poolMirroringStatus.Summary.ImageStates + } + } + return &poolMirroringStatus, nil }