Skip to content

Commit

Permalink
Merge pull request #778 from red-hat-storage/sync_us--master
Browse files Browse the repository at this point in the history
Syncing latest changes from upstream master for rook
  • Loading branch information
travisn authored Nov 19, 2024
2 parents 9ddd656 + 4524f3d commit 5b176fc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
with:
python-version: 3.9

- uses: DavidAnson/markdownlint-cli2-action@db43aef879112c3119a410d69f66701e0d530809 # v17.0.0
- uses: DavidAnson/markdownlint-cli2-action@eb5ca3ab411449c66620fe7f1b3c9e10547144b0 # v18.0.0
with:
globs: |
Documentation/**/*.md
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
go-version: "1.22"

- name: Setup jq
uses: dcarbone/install-jq-action@8867ddb4788346d7c22b72ea2e2ffe4d514c7bcb # v2.1.0
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
with:
version: "${{ inputs.version }}"

Expand Down
1 change: 1 addition & 0 deletions deploy/charts/rook-ceph-cluster/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ spec:
mountPath: /etc/rook
- name: ceph-admin-secret
mountPath: /var/lib/rook-ceph-mon
serviceAccountName: rook-ceph-default
volumes:
- name: ceph-admin-secret
secret:
Expand Down
18 changes: 15 additions & 3 deletions pkg/operator/ceph/cluster/osd/topology/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"fmt"
"strings"

"github.com/coreos/pkg/capnslog"
"github.com/rook/rook/pkg/daemon/ceph/client"
corev1 "k8s.io/api/core/v1"
)
Expand All @@ -39,6 +40,8 @@ var (

// The list of supported failure domains in the CRUSH map, ordered from lowest to highest
CRUSHMapLevelsOrdered = append([]string{"host"}, append(CRUSHTopologyLabels, KubernetesTopologyLabels...)...)

logger = capnslog.NewPackageLogger("github.com/rook/rook", "osd-topology")
)

const (
Expand Down Expand Up @@ -107,18 +110,27 @@ func extractTopologyFromLabels(labels map[string]string) (map[string]string, str
}
// iterate in lowest to highest order as the lowest level should be sustained and higher level duplicate
// should be removed
duplicateTopology := make(map[string]int)
duplicateTopology := make(map[string][]string)
for i := len(allKubernetesTopologyLabels) - 1; i >= 0; i-- {
topologyLabel := allKubernetesTopologyLabels[i]
if value, ok := labels[topologyLabel]; ok {
if _, ok := duplicateTopology[value]; ok {
delete(topology, kubernetesTopologyLabelToCRUSHLabel(topologyLabel))
} else {
duplicateTopology[value] = 1
}
duplicateTopology[value] = append(duplicateTopology[value], topologyLabel)
}
}

// remove non-duplicate entries, and report if any duplicate entries were found
for value, duplicateKeys := range duplicateTopology {
if len(duplicateKeys) <= 1 {
delete(duplicateTopology, value)
}
}
if len(duplicateTopology) != 0 {
logger.Warningf("Found duplicate location values with labels: %v", duplicateTopology)
}

return topology, topologyAffinity
}

Expand Down

0 comments on commit 5b176fc

Please sign in to comment.