Skip to content

Commit

Permalink
Fix secret merge issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunussandikci committed Apr 25, 2024
1 parent 579251b commit 0d7f22f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ linters:
- gochecknoglobals # We like global variables
- tagalign # Buggy
linters-settings:
gosec:
excludes:
- 'G601'
cyclop:
max-complexity: 12
run:
Expand Down
4 changes: 2 additions & 2 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func RefreshWatchers(ctx context.Context, kubeClient client.Reader) error {

watchers = []v1alpha1.Watcher{}

for idx, watcher := range watcherList.Items {
for _, watcher := range watcherList.Items {
for _, secretKeySelector := range watcher.Spec.ValuesFrom.Secrets {
var (
secret v1.Secret
Expand All @@ -101,7 +101,7 @@ func RefreshWatchers(ctx context.Context, kubeClient client.Reader) error {
return unmarshallErr
}

if mergeErr := mergo.Merge(&watcherList.Items[idx], v1alpha1.Watcher{Spec: specFromSecret},
if mergeErr := mergo.Merge(&watcher, v1alpha1.Watcher{Spec: specFromSecret},
mergo.WithOverride, mergo.WithAppendSlice); mergeErr != nil {
return mergeErr
}
Expand Down

0 comments on commit 0d7f22f

Please sign in to comment.