You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a generic `plugins` field to ApisixConsumerSpec so that
consumer-scoped plugins (e.g. limit-count, limit-req) can be
attached to an ApisixConsumer resource directly, without being
limited to the auth plugins exposed through authParameter.
Key changes:
- ApisixConsumerSpec gains a Plugins []ApisixRoutePlugin field,
following the same pattern as ApisixRoute and ApisixGlobalRule.
Enabled plugins are merged after the auth plugin derived from
authParameter; an enabled entry with the same name takes precedence.
- authParameter is now optional (omitempty). A CEL x-validation rule
enforces that at least one auth method within authParameter OR at
least one enabled plugin in plugins must be specified.
- Translator updated to process the new Plugins slice via the
existing buildPluginConfig helper.
- Controller and indexer extended to load and index Secrets
referenced by spec.plugins[].secretRef, consistent with
ApisixRoute and ApisixGlobalRule behavior.
- deepcopy updated for the new Plugins slice.
- No webhook changes required; validation is handled entirely
by the CRD-level CEL rule (x-kubernetes-validations).
- E2e tests added for authParameter+plugins and plugins-only consumers.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: api/v2/apisixconsumer_types.go
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -23,13 +23,22 @@ import (
23
23
)
24
24
25
25
// ApisixConsumerSpec defines the desired state of ApisixConsumer.
26
+
// +kubebuilder:validation:XValidation:rule="has(self.authParameter) || (has(self.plugins) && self.plugins.exists(p, p.enable))",message="at least one of authParameter (with an auth method) or an enabled plugin in plugins must be specified"
26
27
typeApisixConsumerSpecstruct {
27
28
// IngressClassName is the name of an IngressClass cluster resource.
28
29
// The controller uses this field to decide whether the resource should be managed.
Copy file name to clipboardExpand all lines: docs/en/latest/reference/api-reference.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -874,7 +874,8 @@ ApisixConsumerSpec defines the desired state of ApisixConsumer.
874
874
| Field | Description |
875
875
| --- | --- |
876
876
|`ingressClassName`_string_| IngressClassName is the name of an IngressClass cluster resource. The controller uses this field to decide whether the resource should be managed. |
877
-
|`authParameter`_[ApisixConsumerAuthParameter](#apisixconsumerauthparameter)_| AuthParameter defines the authentication credentials and configuration for this consumer. |
877
+
|`authParameter`_[ApisixConsumerAuthParameter](#apisixconsumerauthparameter)_| AuthParameter defines the authentication credentials and configuration for this consumer. Either AuthParameter (with at least one auth method) or Plugins (or both) must be specified. |
878
+
|`plugins`_[ApisixRoutePlugin](#apisixrouteplugin) array_| Plugins lists additional consumer-scoped plugins to attach to this consumer. These plugins are applied alongside any authentication plugin derived from AuthParameter. Enabled plugins with the same name as the auth plugin derived from AuthParameter take precedence. Either AuthParameter (with at least one auth method) or Plugins (or both) must be specified. |
878
879
879
880
880
881
_Appears in:_
@@ -1163,6 +1164,7 @@ ApisixRoutePlugin represents an APISIX plugin.
0 commit comments