Skip to content

Commit

Permalink
Merge pull request #28 from fabriziosestito/fix/do-not-fail-namespace…
Browse files Browse the repository at this point in the history
…Object

fix: continue policy execution if namespaceObject cannot be fetched
  • Loading branch information
viccuad authored Mar 21, 2024
2 parents 66037bc + cb735b0 commit 2da2bdb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ func Validate(payload []byte) ([]byte, error) {

responseBytes, err := kubernetes.GetResource(&host, resourceRequest)
if err != nil {
return nil, fmt.Errorf("cannot get namespace data: %w", err)
}
if err := json.Unmarshal(responseBytes, &namespaceObject); err != nil {
log.Printf("Warning: cannot get namespace data: %s. `namespaceObject` cannot be populated.", err)
} else if err := json.Unmarshal(responseBytes, &namespaceObject); err != nil {
return nil, fmt.Errorf("cannot parse namespace data: %w", err)
}
}
Expand Down

0 comments on commit 2da2bdb

Please sign in to comment.