Skip to content

Commit

Permalink
fix consumers cases
Browse files Browse the repository at this point in the history
  • Loading branch information
czeslavo committed Nov 2, 2023
1 parent 10a3c6c commit 36dcaca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/admission/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ func (validator KongHTTPValidator) ValidateConsumer(
// testing them against themselves.
credentialsIndex, err := globalValidationIndexForCredentials(ctx, validator.ManagerClient, managedConsumers, ignoredSecrets)
if err != nil {
return false, ErrTextConsumerCredentialValidationFailed, err
return false, fmt.Sprintf("%s: %s", ErrTextConsumerCredentialValidationFailed, err), nil
}

// validate the consumer's credentials against the index of all managed
// credentials to ensure they're not in violation of any unique constraints.
for _, secret := range credentials {
// do the unique constraints validation of the credentials using the credentials index
if err := credentialsIndex.ValidateCredentialsForUniqueKeyConstraints(secret); err != nil {
return false, ErrTextConsumerCredentialValidationFailed, err
return false, fmt.Sprintf("%s: %s", ErrTextConsumerCredentialValidationFailed, err), nil
}
}

Expand Down

0 comments on commit 36dcaca

Please sign in to comment.