Skip to content

Commit f5363b0

Browse files
AlinsRanCopilot
andcommitted
fix: restore len(warnings) > 0 guard in ApisixConsumer webhook
When auth secret references are missing, the ApisixConsumer translator cannot produce valid auth credentials — ADC validation would always fail in that state, causing admission denial instead of a warning. Restore the guard so that missing secrets produce a warning but still admit the resource. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3bf9e3f commit f5363b0

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

internal/webhook/v1/apisixconsumer_webhook.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ func (v *ApisixConsumerCustomValidator) ValidateCreate(ctx context.Context, obj
7575
}
7676

7777
warnings := v.collectWarnings(ctx, consumer)
78-
if v.initErr != nil {
79-
apisixConsumerLog.Error(v.initErr, "ADC validator init failed, skipping ADC validation")
78+
if v.initErr != nil || len(warnings) > 0 {
8079
return warnings, nil
8180
}
8281
return warnings, v.adcValidator.Validate(ctx, consumer)
@@ -93,8 +92,7 @@ func (v *ApisixConsumerCustomValidator) ValidateUpdate(ctx context.Context, oldO
9392
}
9493

9594
warnings := v.collectWarnings(ctx, consumer)
96-
if v.initErr != nil {
97-
apisixConsumerLog.Error(v.initErr, "ADC validator init failed, skipping ADC validation")
95+
if v.initErr != nil || len(warnings) > 0 {
9896
return warnings, nil
9997
}
10098
return warnings, v.adcValidator.Validate(ctx, consumer)

0 commit comments

Comments
 (0)