Skip to content

Commit

Permalink
recipe/{billing,postgres},runtime/util: matcher multiple service support
Browse files Browse the repository at this point in the history
Add support for specifying multiple services to update in the modify
matcher section of the recipes, preventing duplication when those
updates are the same across multiple services.

Also fix a bug where satellite-core wasn't updated when postgres was
specified as the DB.

Change-Id: If62ee5f2b58cad7b9f21bcb84869fabef59c400e
  • Loading branch information
dlamarmorgan committed Jul 28, 2023
1 parent 9b4340e commit 62b017a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
10 changes: 1 addition & 9 deletions pkg/recipe/billing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,7 @@ add:
target: 8546
modify:
- match:
name: satellite-core
config:
STORJ_PAYMENTS_BILLING_CONFIG_DISABLE_LOOP: "false"
STORJ_PAYMENTS_STORJSCAN_AUTH_IDENTIFIER: us1
STORJ_PAYMENTS_STORJSCAN_AUTH_SECRET: us1secret
STORJ_PAYMENTS_STORJSCAN_DISABLE_LOOP: "false"
STORJ_PAYMENTS_STORJSCAN_ENDPOINT: http://storjscan:12000
- match:
name: satellite-api
name: satellite-core,satellite-api
config:
STORJ_PAYMENTS_BILLING_CONFIG_DISABLE_LOOP: "false"
STORJ_PAYMENTS_STORJSCAN_AUTH_IDENTIFIER: us1
Expand Down
4 changes: 2 additions & 2 deletions pkg/recipe/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ add:
POSTGRES_DB: master
modify:
- match:
name: satellite-api
name: satellite-api,satellite-core,satellite-admin
config:
STORJ_DATABASE: "postgres://postgres@postgres:5432/master?sslmode=disable"
STORJ_METAINFO_DATABASE_URL: "postgres://postgres@postgres:5432/master?sslmode=disable"
STORJ_METAINFO_DATABASE_URL: "postgres://postgres@postgres:5432/master?sslmode=disable"
9 changes: 8 additions & 1 deletion pkg/runtime/runtime/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package runtime

import (
"strings"

"github.com/zeebo/errs/v2"

"storj.io/storj-up/pkg/recipe"
Expand Down Expand Up @@ -89,7 +91,12 @@ func Match(service Service, matcher recipe.Matcher) bool {
}
}
}
return matcher.Name == service.ID().Name
for _, name := range strings.Split(matcher.Name, ",") {
if strings.TrimSpace(name) == service.ID().Name {
return true
}
}
return false
}

// ApplyRecipes can apply full recipes and other services (partial recipes) based on the selectors.
Expand Down

0 comments on commit 62b017a

Please sign in to comment.