Skip to content

Commit

Permalink
Merge pull request #66 from /issues/65
Browse files Browse the repository at this point in the history
Fix Helm warnings seen in cofidectl up
  • Loading branch information
markgoddard authored Dec 6, 2024
2 parents 9a46cb8 + 15b7fee commit d669116
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions internal/pkg/attestationpolicy/attestationpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ func getAPLabelSelectorHelmConfig(selector *attestation_policy_proto.APLabelSele
return nil
}

var matchExpressions = []map[string]any{}
matchLabels := map[string]any{}
for k, v := range selector.MatchLabels {
matchLabels[k] = v
}

matchExpressions := []map[string]any{}
for _, me := range selector.MatchExpressions {
matchExpressions = append(matchExpressions, map[string]any{
"key": me.GetKey(),
Expand All @@ -81,7 +85,7 @@ func getAPLabelSelectorHelmConfig(selector *attestation_policy_proto.APLabelSele
}

return map[string]any{
"matchLabels": selector.MatchLabels,
"matchLabels": matchLabels,
"matchExpressions": matchExpressions,
}
}
2 changes: 1 addition & 1 deletion pkg/provider/helm/values_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func TestHelmValuesGenerator_GenerateValues_success(t *testing.T) {
},
"namespaceSelector": Values{
"matchExpressions": []map[string]any{},
"matchLabels": map[string]string{
"matchLabels": map[string]any{
"kubernetes.io/metadata.name": "ns1",
},
},
Expand Down

0 comments on commit d669116

Please sign in to comment.