一键导入
aigw-contrib-add-api
Add or extend CRD types in envoyproxy/ai-gateway — type definition, validation, code generation, and filterapi update
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add or extend CRD types in envoyproxy/ai-gateway — type definition, validation, code generation, and filterapi update
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | aigw-contrib-add-api |
| description | Add or extend CRD types in envoyproxy/ai-gateway — type definition, validation, code generation, and filterapi update |
| arguments | [{"name":"CRDName","description":"CRD to modify (AIGatewayRoute, AIServiceBackend, BackendSecurityPolicy, GatewayConfig, MCPRoute, QuotaPolicy)","required":true},{"name":"FieldName","description":"Name of the new field to add","required":true},{"name":"FieldDescription","description":"Purpose and behavior of the new field","required":true}] |
Add or modify CRD types in the AI Gateway API. API changes must be in a separate PR from implementation — this is enforced by reviewers.
| CRD | Type File | FilterAPI Impact |
|---|---|---|
| AIGatewayRoute | api/v1alpha1/ai_gateway_route_types.go | Yes — routes affect filterapi.Config |
| AIServiceBackend | api/v1alpha1/ai_service_backend_types.go | Yes — schema/backend config |
| BackendSecurityPolicy | api/v1alpha1/backend_security_policy_types.go | Yes — auth config |
| GatewayConfig | api/v1alpha1/gateway_config_types.go | Indirect — ExtProc container config |
| MCPRoute | api/v1alpha1/mcp_route_types.go | Yes |
| QuotaPolicy | api/v1alpha1/quota_policy_types.go | Yes |
Add the field to the appropriate *_types.go file:
// ${FieldName} configures ${FieldDescription}.
// +optional
${FieldName} *${FieldType} `json:"${jsonFieldName},omitempty"`
omitempty for optional fields*string, *int32, *MyType)// +optional for optional fields// +kubebuilder:validation:Enum=Value1;Value2 for enums// +kubebuilder:validation:Minimum=0 for numeric bounds// +kubebuilder:validation:MaxLength=253 for string bounds// RetryBudget configures the retry budget for this backend.
// When set, limits the rate of retries to prevent cascading failures.
// +optional
RetryBudget *RetryBudgetConfig `json:"retryBudget,omitempty"`
For mutually exclusive fields, cross-field validation, or complex constraints, add CEL rules:
// +kubebuilder:validation:XValidation:rule="!(has(self.fieldA) && has(self.fieldB))",message="fieldA and fieldB are mutually exclusive"
type MySpec struct {
// ...
}
# Generate deepcopy methods and CRD manifests
make apigen
# Full code generation (includes filterapi if needed)
make codegen
# Regenerate API documentation
make apidoc
This generates:
zz_generated.deepcopy.go — DeepCopy methodsAdd tests in tests/crdcel/:
// tests/crdcel/${crd}_test.go
func TestMyFieldValidation(t *testing.T) {
tests := []struct {
name string
obj *aigv1a1.${CRDName}
wantError bool
errMsg string
}{
{
name: "valid: field set correctly",
obj: &aigv1a1.${CRDName}{
// ... valid spec with new field
},
},
{
name: "invalid: mutually exclusive fields",
obj: &aigv1a1.${CRDName}{
// ... both exclusive fields set
},
wantError: true,
errMsg: "mutually exclusive",
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
err := k8sClient.Create(t.Context(), tc.obj)
if tc.wantError {
require.Error(t, err)
require.Contains(t, err.Error(), tc.errMsg)
} else {
require.NoError(t, err)
}
})
}
}
Run: make test-crdcel
If the new field changes behavior at the data plane level, update api/v1alpha1/filterapi/filterapi.go:
Note: filterapi changes in the API PR are fine if they are type-only. The controller/ExtProc logic goes in the implementation PR.
+kubebuilder:validation:Enum for fixed value sets// +optional and pointer types*_types.go with doc comment and JSON tagmake apigen — deepcopy and CRDs regeneratedmake codegen — full code generationmake apidoc — API docs regeneratedtests/crdcel/api(api): add ${FieldName} to ${CRDName}Configure client-facing traffic policies -- timeouts, connection limits, TLS settings, HTTP behavior
Production-grade Envoy Gateway setup with comprehensive security, observability, high availability, and operational best practices
Integrate Envoy Gateway with Istio ambient mesh or Cilium for unified ingress and service mesh
Envoy Gateway version information, compatibility matrix, and upgrade readiness checks
Envoy AI Gateway contribution orchestrator — interviews you about your contribution and guides you through the correct workflow using contributor skills
Envoy Gateway contribution orchestrator — interviews you about your contribution and guides you through the correct workflow using contributor skills