Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion api/v1alpha1/gatewayproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ type GatewayProxySpec struct {
// of GatewayProxy or Ingress resources for developers to access.
StatusAddress []string `json:"statusAddress,omitempty"`
// Provider configures the provider details.
Provider *GatewayProxyProvider `json:"provider,omitempty"`
//
// +kubebuilder:validation:required
Provider *GatewayProxyProvider `json:"provider"`
// Plugins configure global plugins.
Plugins []GatewayProxyPlugin `json:"plugins,omitempty"`
// PluginMetadata configures common configuration shared by all plugin instances of the same name.
Expand Down Expand Up @@ -83,6 +85,7 @@ type SecretKeySelector struct {
}

// AdminKeyAuth defines the admin key authentication configuration.
// +kubebuilder:validation:XValidation:rule="has(self.value) != has(self.valueFrom)",message="exactly one of value or valueFrom must be specified"
type AdminKeyAuth struct {
// Value sets the admin key value explicitly (not recommended for production).
// +optional
Expand All @@ -101,6 +104,8 @@ type AdminKeyValueFrom struct {
}

// ControlPlaneAuth defines the authentication configuration for control plane.
//
// +kubebuilder:validation:XValidation:rule="self.type == 'AdminKey' ? has(self.adminKey) : true",message="adminKey must be specified when type is AdminKey"
type ControlPlaneAuth struct {
// Type specifies the type of authentication.
// Can only be `AdminKey`.
Expand Down
9 changes: 9 additions & 0 deletions config/crd/bases/apisix.apache.org_gatewayproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ spec:
type: object
type: object
type: object
x-kubernetes-validations:
- message: exactly one of value or valueFrom must be specified
rule: has(self.value) != has(self.valueFrom)
type:
description: |-
Type specifies the type of authentication.
Expand All @@ -113,6 +116,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: adminKey must be specified when type is AdminKey
rule: 'self.type == ''AdminKey'' ? has(self.adminKey) :
true'
endpoints:
description: Endpoints specifies the list of control plane
endpoints.
Expand Down Expand Up @@ -168,6 +175,8 @@ spec:
items:
type: string
type: array
required:
- provider
type: object
type: object
served: true
Expand Down
Loading