Skip to content

Commit

Permalink
Merge pull request #355 from iPraveenParihar/bz/2297265
Browse files Browse the repository at this point in the history
BUG 2303181: util: exclude empty label values for crushlocation map
  • Loading branch information
openshift-merge-bot[bot] committed Sep 9, 2024
2 parents 284b9a7 + 0b857fd commit 3aa8452
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ ifeq ($(HAVE_CPUSET),1)
CPUSET ?= --cpuset-cpus=0-${CPUS}
endif

ifneq ($(GITHUB_ACTION),)
# see https://github.com/containers/podman/issues/21012
SECURITY_OPT ?= --security-opt seccomp=unconfined
endif

CSI_IMAGE_NAME=$(if $(ENV_CSI_IMAGE_NAME),$(ENV_CSI_IMAGE_NAME),quay.io/cephcsi/cephcsi)
CSI_IMAGE_VERSION=$(shell . $(CURDIR)/build.env ; echo $${CSI_IMAGE_VERSION})
CSI_IMAGE=$(CSI_IMAGE_NAME):$(CSI_IMAGE_VERSION)
Expand Down Expand Up @@ -224,7 +229,7 @@ ifeq ($(USE_PULLED_IMAGE),no)
.test-container-id: .container-cmd build.env scripts/Dockerfile.test
[ ! -f .test-container-id ] || $(CONTAINER_CMD) rmi $(CSI_IMAGE_NAME):test
$(RM) .test-container-id
$(CONTAINER_CMD) build $(CPUSET) --build-arg GOARCH=$(GOARCH) -t $(CSI_IMAGE_NAME):test -f ./scripts/Dockerfile.test .
$(CONTAINER_CMD) build $(CPUSET) $(SECURITY_OPT) --build-arg GOARCH=$(GOARCH) -t $(CSI_IMAGE_NAME):test -f ./scripts/Dockerfile.test .
$(CONTAINER_CMD) inspect -f '{{.Id}}' $(CSI_IMAGE_NAME):test > .test-container-id
else
# create the .test-container-id file based on the pulled image
Expand Down
4 changes: 2 additions & 2 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ curl -X GET http://10.109.65.142:8080/metrics 2>/dev/null | grep csi
csi_liveness 1
```

Promethues can be deployed through the promethues operator described [here](https://coreos.com/operators/prometheus/docs/latest/user-guides/getting-started.html).
The [service-monitor](../deploy/service-monitor.yaml) will tell promethues how
Prometheus can be deployed through the prometheus operator described [here](https://coreos.com/operators/prometheus/docs/latest/user-guides/getting-started.html).
The [service-monitor](../deploy/service-monitor.yaml) will tell prometheus how
to pull metrics out of CSI.

Each CSI pod has a service to expose the endpoint to prometheus. By default, rbd
Expand Down
2 changes: 1 addition & 1 deletion examples/rbd/storageclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ parameters:
# "file": Enable file encryption on the mounted filesystem
# "block": Encrypt RBD block device
# When unspecified assume type "block". "file" and "block" are
# mutally exclusive.
# mutually exclusive.
# encryptionType: "block"

# (optional) Use external key management system for encryption passphrases by
Expand Down
2 changes: 1 addition & 1 deletion internal/health-checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type checker struct {
// timeout contains the delay (interval + timeout)
timeout time.Duration

// mutex protects against concurrent access to healty, err and
// mutex protects against concurrent access to healthy, err and
// lastUpdate
mutex *sync.RWMutex

Expand Down
4 changes: 4 additions & 0 deletions internal/util/crushlocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func getCrushLocationMap(crushLocationLabels string, nodeLabels map[string]strin
// Determine values for requested labels from node labels
crushLocationMap := make(map[string]string, len(labelsIn))
for key, value := range nodeLabels {
// label with empty value is not considered.
if value == "" {
continue
}
if _, ok := labelsIn[key]; !ok {
continue
}
Expand Down
13 changes: 12 additions & 1 deletion internal/util/crushlocation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func Test_getCrushLocationMap(t *testing.T) {
want: map[string]string{"zone": "zone1"},
},
{
name: "multuple matching crushlocation and node labels",
name: "multiple matching crushlocation and node labels",
args: input{
crushLocationLabels: "topology.io/zone,topology.io/rack",
nodeLabels: map[string]string{
Expand Down Expand Up @@ -100,6 +100,17 @@ func Test_getCrushLocationMap(t *testing.T) {
},
want: map[string]string{"host": "worker-1"},
},
{
name: "matching crushlocation and node labels with empty value",
args: input{
crushLocationLabels: "topology.io/region,topology.io/zone",
nodeLabels: map[string]string{
"topology.io/region": "region1",
"topology.io/zone": "",
},
},
want: map[string]string{"region": "region1"},
},
}
for _, tt := range tests {
currentTT := tt
Expand Down

0 comments on commit 3aa8452

Please sign in to comment.