Skip to content

Commit

Permalink
Fix the BRO v4 chart to work with Rancher 2.8
Browse files Browse the repository at this point in the history
- Also: stop checking for a regexp == "." -- let the engine do it.
  Benchmarking shows the pattern-matching is a touch faster even with the function call
  • Loading branch information
ericpromislow committed Feb 26, 2024
1 parent 18086f5 commit 3ae25a7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
4 changes: 2 additions & 2 deletions charts/rancher-backup/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ annotations:
catalog.cattle.io/os: linux
catalog.cattle.io/permits-os: linux,windows
catalog.cattle.io/provides-gvr: resources.cattle.io.resourceset/v1
catalog.cattle.io/rancher-version: '>= 2.7.0-0 < 2.8.0-0'
catalog.cattle.io/rancher-version: '>= 2.8.0-0 < 2.9.0-0'
catalog.cattle.io/release-name: rancher-backup
catalog.cattle.io/scope: management
catalog.cattle.io/type: cluster-tool
catalog.cattle.io/ui-component: rancher-backup
catalog.cattle.io/upstream-version: 3.1.3
catalog.cattle.io/upstream-version: 3.0.0
apiVersion: v2
appVersion: 999
description: Provides ability to back up and restore the Rancher application running
Expand Down
9 changes: 5 additions & 4 deletions pkg/resourcesets/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,10 @@ func (h *ResourceHandler) filterByKind(filter v1.ResourceSelector, apiResources
if kindRegexp == nil {
continue
}
if (filter.KindsRegexp == "." || kindRegexp.MatchString(resObj.Kind) || kindRegexp.MatchString(resObj.Name)) &&
!disallowedKinds[resObj.Kind] && !disallowedKinds[resObj.Name] {
resourceList = append(resourceList, resObj)
if kindRegexp.MatchString(resObj.Kind) || kindRegexp.MatchString(resObj.Name) {
if !disallowedKinds[resObj.Kind] && !disallowedKinds[resObj.Name] {
resourceList = append(resourceList, resObj)
}
}
}
return resourceList, nil
Expand Down Expand Up @@ -279,7 +280,7 @@ func (h *ResourceHandler) filterByNamespace(filter v1.ResourceSelector, filtered
for _, resObj := range filteredByName {
namespace := resObj.GetNamespace()
if allowedNamespaces[namespace] ||
(filter.NamespaceRegexp != "" && (filter.NamespaceRegexp == "." || namespaceRegexp.MatchString(namespace))) {
(filter.NamespaceRegexp != "" && namespaceRegexp.MatchString(namespace)) {
filteredObjects = append(filteredObjects, resObj)
}
}
Expand Down
13 changes: 0 additions & 13 deletions pkg/resourcesets/testdata/README.md

This file was deleted.

0 comments on commit 3ae25a7

Please sign in to comment.