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.
Plugins entries are merged after the auth plugin derived from
authParameter; a name collision means the Plugins entry wins.
- authParameter is now optional (omitempty). A CEL rule enforces
that at least one auth method within authParameter OR at least
one plugin in plugins must be specified:
has(self.authParameter.basicAuth) || has(self.authParameter.keyAuth)
|| ... || (has(self.plugins) && size(self.plugins) > 0)
- Translator updated to process the new Plugins slice via the
existing buildPluginConfig helper.
- deepcopy updated for the new Plugins slice.
- No webhook changes required; validation is handled entirely
by the CRD-level CEL rule (x-kubernetes-validations).
Closes#397
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
@@ -871,7 +871,8 @@ ApisixConsumerSpec defines the desired state of ApisixConsumer.
871
871
| Field | Description |
872
872
| --- | --- |
873
873
|`ingressClassName`_string_| IngressClassName is the name of an IngressClass cluster resource. The controller uses this field to decide whether the resource should be managed. |
874
-
|`authParameter`_[ApisixConsumerAuthParameter](#apisixconsumerauthparameter)_| AuthParameter defines the authentication credentials and configuration for this consumer. |
874
+
|`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. |
875
+
|`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. |
875
876
876
877
877
878
_Appears in:_
@@ -1160,6 +1161,7 @@ ApisixRoutePlugin represents an APISIX plugin.
0 commit comments