Skip to content

Commit

Permalink
Merge pull request #774 from red-hat-storage/sync_ds--master
Browse files Browse the repository at this point in the history
Syncing latest changes from master for rook
  • Loading branch information
openshift-merge-bot[bot] authored Nov 18, 2024
2 parents ffa2b08 + 793bbb0 commit 400b307
Show file tree
Hide file tree
Showing 18 changed files with 133 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
uses: github/codeql-action/upload-sarif@4f3212b61783c3c68e8309a0f18a699764811cda # v3.27.1
with:
sarif_file: results.sarif
11 changes: 11 additions & 0 deletions Documentation/CRDs/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -3395,6 +3395,17 @@ MirroringInfoSpec
</tr>
<tr>
<td>
<code>poolID</code><br/>
<em>
int
</em>
</td>
<td>
<p>optional</p>
</td>
</tr>
<tr>
<td>
<code>snapshotScheduleStatus</code><br/>
<em>
<a href="#ceph.rook.io/v1.SnapshotScheduleStatusSpec">
Expand Down
4 changes: 2 additions & 2 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export GOOS
GOOS=$(go env GOOS)
export GOARCH
GOARCH=$(go env GOARCH)
DEFAULT_CSV_VERSION="4.17.0"
DEFAULT_CSV_VERSION="4.18.0"
CSV_VERSION="${CSV_VERSION:-${DEFAULT_CSV_VERSION}}"
SKIP_RANGE="${SKIP_RANGE:-""}"
REPLACES_CSV_VERSION="${REPLACES_CSV_VERSION:-""}"
LATEST_ROOK_IMAGE="docker.io/rook/ceph:v1.15.0.133.g04eecf7ab"
LATEST_ROOK_IMAGE="docker.io/rook/ceph:v1.15.0.369.g7822e6b19"
ROOK_IMAGE=${ROOK_IMAGE:-${LATEST_ROOK_IMAGE}}
DEFAULT_BUNDLE_IMAGE=quay.io/ocs-dev/rook-ceph-operator-bundle:"${VERSION}"
BUNDLE_IMAGE="${BUNDLE_IMAGE:-${DEFAULT_BUNDLE_IMAGE}}"
Expand Down
2 changes: 2 additions & 0 deletions build/csv/ceph/ceph.rook.io_cephblockpools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ spec:
type: integer
phase:
type: string
poolID:
type: integer
snapshotScheduleStatus:
properties:
details:
Expand Down
31 changes: 26 additions & 5 deletions build/csv/ceph/rook-ceph-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ metadata:
operators.operatorframework.io/project_layout: unknown
tectonic-visibility: ocs
repository: https://github.com/red-hat-storage/rook
containerImage: docker.io/rook/ceph:v1.15.0.133.g04eecf7ab
containerImage: docker.io/rook/ceph:v1.15.0.369.g7822e6b19
operators.operatorframework.io/operator-type: non-standalone
externalClusterScript: |-
IiIiCkNvcHlyaWdodCAyMDIwIFRoZSBSb29rIEF1dGhvcnMuIEFsbCByaWdodHMgcmVzZXJ2ZWQu
Expand Down Expand Up @@ -1900,7 +1900,7 @@ metadata:
OiB7a0Vycn0iKQogICAgZXhjZXB0IE9TRXJyb3IgYXMgb3NFcnI6CiAgICAgICAgcHJpbnQoZiJF
cnJvciB3aGlsZSB0cnlpbmcgdG8gb3V0cHV0IHRoZSBkYXRhOiB7b3NFcnJ9IikKICAgIGZpbmFs
bHk6CiAgICAgICAgcmpPYmouc2h1dGRvd24oKQo=
name: rook-ceph-operator.v4.17.0
name: rook-ceph-operator.v4.18.0
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -3165,7 +3165,7 @@ spec:
fieldPath: metadata.namespace
- name: ROOK_OBC_WATCH_OPERATOR_NAMESPACE
value: "true"
image: docker.io/rook/ceph:v1.15.0.133.g04eecf7ab
image: docker.io/rook/ceph:v1.15.0.369.g7822e6b19
name: rook-ceph-operator
resources: {}
securityContext:
Expand Down Expand Up @@ -3463,6 +3463,13 @@ spec:
- replicasets
verbs:
- get
- apiGroups:
- apps
resources:
- deployments/finalizers
- daemonsets/finalizers
verbs:
- update
serviceAccountName: rook-csi-cephfs-provisioner-sa
- rules:
- apiGroups:
Expand All @@ -3485,6 +3492,13 @@ spec:
- replicasets
verbs:
- get
- apiGroups:
- apps
resources:
- deployments/finalizers
- daemonsets/finalizers
verbs:
- update
serviceAccountName: rook-csi-rbd-plugin-sa
- rules:
- apiGroups:
Expand Down Expand Up @@ -3518,6 +3532,13 @@ spec:
- replicasets
verbs:
- get
- apiGroups:
- apps
resources:
- deployments/finalizers
- daemonsets/finalizers
verbs:
- update
serviceAccountName: rook-csi-rbd-provisioner-sa
strategy: deployment
installModes:
Expand Down Expand Up @@ -3547,10 +3568,10 @@ spec:
provider:
name: Red Hat
url: https://www.redhat.com
version: 4.17.0
version: 4.18.0
minKubeVersion: 1.16.0
relatedImages:
- image: docker.io/rook/ceph:v1.15.0.133.g04eecf7ab
- image: docker.io/rook/ceph:v1.15.0.369.g7822e6b19
name: rook-container
- image: quay.io/csiaddons/k8s-sidecar:v0.8.0
name: csiaddons-sidecar
Expand Down
3 changes: 3 additions & 0 deletions deploy/charts/rook-ceph/templates/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,9 @@ spec:
phase:
description: ConditionType represent a resource's status
type: string
poolID:
description: optional
type: integer
snapshotScheduleStatus:
description: SnapshotScheduleStatusSpec is the status of the snapshot schedule
properties:
Expand Down
9 changes: 9 additions & 0 deletions deploy/charts/rook-ceph/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ rules:
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get"]
- apiGroups: ["apps"]
resources: ["deployments/finalizers", "daemonsets/finalizers"]
verbs: ["update"]
{{- end }}
---
{{- if and .Values.csi.csiAddons .Values.csi.csiAddons.enabled }}
Expand All @@ -99,6 +102,9 @@ rules:
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get"]
- apiGroups: ["apps"]
resources: ["deployments/finalizers", "daemonsets/finalizers"]
verbs: ["update"]
---
{{- end }}
kind: Role
Expand All @@ -120,5 +126,8 @@ rules:
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get"]
- apiGroups: ["apps"]
resources: ["deployments/finalizers", "daemonsets/finalizers"]
verbs: ["update"]
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions deploy/examples/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,9 @@ rules:
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get"]
- apiGroups: ["apps"]
resources: ["deployments/finalizers", "daemonsets/finalizers"]
verbs: ["update"]
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -802,6 +805,9 @@ rules:
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get"]
- apiGroups: ["apps"]
resources: ["deployments/finalizers", "daemonsets/finalizers"]
verbs: ["update"]
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -821,6 +827,9 @@ rules:
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get"]
- apiGroups: ["apps"]
resources: ["deployments/finalizers", "daemonsets/finalizers"]
verbs: ["update"]
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
3 changes: 3 additions & 0 deletions deploy/examples/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,9 @@ spec:
phase:
description: ConditionType represent a resource's status
type: string
poolID:
description: optional
type: integer
snapshotScheduleStatus:
description: SnapshotScheduleStatusSpec is the status of the snapshot schedule
properties:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
go.uber.org/automaxprocs v1.6.0
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/sync v0.8.0
golang.org/x/sync v0.9.0
gopkg.in/ini.v1 v1.67.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.31.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/ceph.rook.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,8 @@ type CephBlockPoolStatus struct {
MirroringStatus *MirroringStatusSpec `json:"mirroringStatus,omitempty"`
// +optional
MirroringInfo *MirroringInfoSpec `json:"mirroringInfo,omitempty"`
// optional
PoolID int `json:"poolID,omitempty"`
// +optional
SnapshotScheduleStatus *SnapshotScheduleStatusSpec `json:"snapshotScheduleStatus,omitempty"`
// +optional
Expand Down
20 changes: 18 additions & 2 deletions pkg/daemon/ceph/client/mirror_health.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func updatePoolStatusMirroring(c *mirrorChecker, mirrorStatus *cephv1.MirroringS
blockPool := &cephv1.CephBlockPool{}
if err := c.client.Get(c.clusterInfo.Context, c.namespacedName, blockPool); err != nil {
if kerrors.IsNotFound(err) {
logger.Debug("CephBlockPool %q resource not found for updating the mirroring status, ignoring.", blockPool)
logger.Debug("CephBlockPool %q resource not found for updating the mirroring status, ignoring.", c.namespacedName)
return
}
logger.Warningf("failed to retrieve ceph block pool %q to update mirroring status. %v", c.namespacedName.Name, err)
Expand All @@ -158,7 +158,7 @@ func updateRadosNamespaceStatusMirroring(c *mirrorChecker, mirrorStatus *cephv1.
radosNamespace := &cephv1.CephBlockPoolRadosNamespace{}
if err := c.client.Get(c.clusterInfo.Context, c.namespacedName, radosNamespace); err != nil {
if kerrors.IsNotFound(err) {
logger.Debug("CephBlockPoolRadosNamespace %q resource not found for updating the mirroring status, ignoring.", radosNamespace)
logger.Debug("CephBlockPoolRadosNamespace %q resource not found for updating the mirroring status, ignoring.", c.namespacedName)
return
}
logger.Warningf("failed to retrieve ceph block pool rados namespace %q to update mirroring status. %v", c.namespacedName.Name, err)
Expand All @@ -168,6 +168,22 @@ func updateRadosNamespaceStatusMirroring(c *mirrorChecker, mirrorStatus *cephv1.
radosNamespace.Status = &cephv1.CephBlockPoolRadosNamespaceStatus{}
}

blockPool := &cephv1.CephBlockPool{}
namespaceName := types.NamespacedName{Name: radosNamespace.Spec.BlockPoolName, Namespace: radosNamespace.Namespace}
if err := c.client.Get(c.clusterInfo.Context, namespaceName, blockPool); err != nil {
if kerrors.IsNotFound(err) {
logger.Debug("CephBlockPool %q resource not found for updating the mirroring status, ignoring.", namespaceName)
return
}
logger.Warningf("failed to retrieve ceph block pool %q to update mirroring status. %v", namespaceName, err)
return
}

if blockPool.Spec.StatusCheck.Mirror.Disabled {
logger.Debugf("mirroring status check is disabled for %q", c.namespacedName.Name)
return
}

// Update the CephBlockPoolRadosNamespace CR status field
radosNamespace.Status.MirroringStatus, radosNamespace.Status.MirroringInfo, radosNamespace.Status.SnapshotScheduleStatus = toCustomResourceStatus(radosNamespace.Status.MirroringStatus, mirrorStatus, radosNamespace.Status.MirroringInfo, mirrorInfo, radosNamespace.Status.SnapshotScheduleStatus, snapSchedStatus, details)
if err := reporting.UpdateStatus(c.client, radosNamespace); err != nil {
Expand Down
19 changes: 0 additions & 19 deletions pkg/operator/ceph/cluster/mon/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,6 @@ func (c *Cluster) failMon(monCount, desiredMonCount int, name string) bool {
return true
}

if err := c.allowFailover(name); err != nil {
logger.Warningf("aborting mon %q failover. %v", name, err)
return false
}

// prevent any voluntary mon drain while failing over
if err := c.blockMonDrain(types.NamespacedName{Name: monPDBName, Namespace: c.Namespace}); err != nil {
logger.Errorf("failed to block mon drain. %v", err)
Expand All @@ -540,20 +535,6 @@ func (c *Cluster) failMon(monCount, desiredMonCount int, name string) bool {
return true
}

func (c *Cluster) allowFailover(name string) error {
if !c.spec.IsStretchCluster() {
// always failover if not a stretch cluster
return nil
}
if name != c.arbiterMon {
// failover if it's a non-arbiter
return nil
}

// Ceph does not support updating the arbiter mon in older versions
return errors.Errorf("refusing to failover arbiter mon %q on a stretched cluster", name)
}

func (c *Cluster) removeOrphanMonResources() {
if c.spec.Mon.VolumeClaimTemplate == nil {
logger.Debug("skipping check for orphaned mon pvcs since using the host path")
Expand Down
24 changes: 0 additions & 24 deletions pkg/operator/ceph/cluster/mon/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,30 +251,6 @@ func TestTrackMonsOutOfQuorum(t *testing.T) {
assert.Equal(t, "", cm.Data[opcontroller.OutOfQuorumKey])
}

func TestSkipMonFailover(t *testing.T) {
c := New(context.TODO(), &clusterd.Context{}, "ns", cephv1.ClusterSpec{}, nil)
c.ClusterInfo = clienttest.CreateTestClusterInfo(1)
monName := "arb"

t.Run("don't skip failover for non-stretch", func(t *testing.T) {
assert.NoError(t, c.allowFailover(monName))
})

t.Run("don't skip failover for non-arbiter", func(t *testing.T) {
c.spec.Mon.Count = 5
c.spec.Mon.StretchCluster = &cephv1.StretchClusterSpec{
Zones: []cephv1.MonZoneSpec{
{Name: "a"},
{Name: "b"},
{Name: "c", Arbiter: true},
},
}

assert.NoError(t, c.allowFailover(monName))
})

}

func TestEvictMonOnSameNode(t *testing.T) {
ctx := context.TODO()
clientset := test.New(t, 1)
Expand Down
Loading

0 comments on commit 400b307

Please sign in to comment.