diff --git a/cmd/testdata/syncjob.yaml b/cmd/testdata/syncjob.yaml index f7184c2..c8bd117 100644 --- a/cmd/testdata/syncjob.yaml +++ b/cmd/testdata/syncjob.yaml @@ -30,31 +30,32 @@ mappings: ## Defines how the secrets will be synced. strategy: - ## 1. Key-to-key, usage: Sync key from source to target + ## 1. Usage: Sync key from source to target - secretRef: key: /credentials/source/username - # if not specified, will be synced under the same key + # If not specified, will be synced under the same key destKey: /credentials/target/username - ## 2. Query-to-path, usage: Sync multiple keys from source to target + ## 2. Usage: Sync queryable keys from source to target - secretQuery: path: /credentials/source regexp: key: .* - # if not specified, will be synced under the same path + # If not specified, will be synced under the same path destPath: /credentials/target - ## 3. Templated-keys, usage: Sync key from source to target via key and value templating + ## 3. Usage: Sync key(s) from source to target via custom boilerplate - secretRef: key: /credentials/source/username - ## Boilerplate defines how the secret key data will be synced to dest source + # Boilerplate defines how the secret key data will be synced to dest source. + # It is possible to specify multiple boilerplate items. boilerplate: - key: '/credentials/target/username' # Reserved word "self" defines a mapping of the fetched secretRef. # You can also use global mappings here, e.g. {{ valueOf "username" }}. value: 'prefix-{{ valueOf "self" }}' - ## 4. Templated-mappings, usage: Sync keys from global mappings to target via key and value templating + ## 4. Usage: Sync key(s) from global mappings to target via custom boilerplate - boilerplate: - key: '/credentials/target/{{ keyOf "username"" }}' value: '{{ valueOf "username" }}' @@ -69,8 +70,7 @@ strategy: username: '{{ valueOf "dynamic-query.username" }}' password: '{{ valueOf "dynamic-query.password" }}' - ## 5. Templated-queries, usage: Sync multiple keys based from source - ## to dest using mapping and templating capabilities + ## 5. Usage: Sync queryable keys from source to dest via custom boilerplate - secretQuery: path: /credentials/source regexp: diff --git a/pkg/storesync/extractor.go b/pkg/storesync/extractor.go index d060c1f..a90126f 100644 --- a/pkg/storesync/extractor.go +++ b/pkg/storesync/extractor.go @@ -5,9 +5,12 @@ import ( "context" "encoding/json" "fmt" - "github.com/bank-vaults/secret-sync/pkg/apis/v1alpha1" - "golang.org/x/sync/errgroup" + "sync" "text/template" + + "golang.org/x/sync/errgroup" + + "github.com/bank-vaults/secret-sync/pkg/apis/v1alpha1" ) type kvData struct { diff --git a/pkg/storesync/storesync.go b/pkg/storesync/storesync.go index 12accb6..12dab93 100644 --- a/pkg/storesync/storesync.go +++ b/pkg/storesync/storesync.go @@ -23,8 +23,9 @@ import ( "sync/atomic" "time" - "github.com/bank-vaults/secret-sync/pkg/apis/v1alpha1" "github.com/sirupsen/logrus" + + "github.com/bank-vaults/secret-sync/pkg/apis/v1alpha1" ) // Status defines response data returned by Sync.