Skip to content
Merged
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
85 changes: 85 additions & 0 deletions api/v1alpha1/gatewayproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,95 @@ type GatewayProxySpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

PublishService string `json:"publishService,omitempty"`
StatusAddress []string `json:"statusAddress,omitempty"`
Provider *GatewayProxyProvider `json:"provider,omitempty"`
Plugins []GatewayProxyPlugin `json:"plugins,omitempty"`
PluginMetadata map[string]apiextensionsv1.JSON `json:"pluginMetadata,omitempty"`
}

// ProviderType defines the type of provider
// +kubebuilder:validation:Enum=ControlPlane
type ProviderType string

const (
// ProviderTypeControlPlane represents the control plane provider type
ProviderTypeControlPlane ProviderType = "ControlPlane"
)

// GatewayProxyProvider defines the provider configuration for GatewayProxy
// +kubebuilder:validation:XValidation:rule="self.type == 'ControlPlane' ? has(self.controlPlane) : true",message="controlPlane must be specified when type is ControlPlane"
type GatewayProxyProvider struct {
// Type specifies the type of provider
// +kubebuilder:validation:Required
Type ProviderType `json:"type"`

// ControlPlane specifies the configuration for control plane provider
// +optional
ControlPlane *ControlPlaneProvider `json:"controlPlane,omitempty"`
}

// AuthType defines the type of authentication
// +kubebuilder:validation:Enum=AdminKey
type AuthType string

const (
// AuthTypeAdminKey represents the admin key authentication type
AuthTypeAdminKey AuthType = "AdminKey"
)

// SecretKeySelector defines a reference to a specific key within a Secret
type SecretKeySelector struct {
// Name is the name of the secret
// +kubebuilder:validation:Required
Name string `json:"name"`

// Key is the key in the secret
// +kubebuilder:validation:Required
Key string `json:"key"`
}

// AdminKeyAuth defines the admin key authentication configuration
type AdminKeyAuth struct {
// Value specifies the admin key value directly (not recommended for production)
// +optional
Value string `json:"value,omitempty"`

// ValueFrom specifies the source of the admin key
// +optional
ValueFrom *AdminKeyValueFrom `json:"valueFrom,omitempty"`
}

// AdminKeyValueFrom defines the source of the admin key
type AdminKeyValueFrom struct {
// SecretKeyRef references a key in a Secret
// +optional
SecretKeyRef *SecretKeySelector `json:"secretKeyRef,omitempty"`
}

// ControlPlaneAuth defines the authentication configuration for control plane
type ControlPlaneAuth struct {
// Type specifies the type of authentication
// +kubebuilder:validation:Required
Type AuthType `json:"type"`

// AdminKey specifies the admin key authentication configuration
// +optional
AdminKey *AdminKeyAuth `json:"adminKey,omitempty"`
}

// ControlPlaneProvider defines the configuration for control plane provider
type ControlPlaneProvider struct {
// Endpoints specifies the list of control plane endpoints
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
Endpoints []string `json:"endpoints"`

// Auth specifies the authentication configuration
// +kubebuilder:validation:Required
Auth ControlPlaneAuth `json:"auth"`
}

// +kubebuilder:object:root=true
// GatewayProxy is the Schema for the gatewayproxies API
type GatewayProxy struct {
Expand Down
126 changes: 126 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions config/crd/bases/gateway.apisix.io_gatewayproxies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,82 @@ spec:
type: string
type: object
type: array
provider:
description: GatewayProxyProvider defines the provider configuration
for GatewayProxy
properties:
controlPlane:
description: ControlPlane specifies the configuration for control
plane provider
properties:
auth:
description: Auth specifies the authentication configuration
properties:
adminKey:
description: AdminKey specifies the admin key authentication
configuration
properties:
value:
description: Value specifies the admin key value directly
(not recommended for production)
type: string
valueFrom:
description: ValueFrom specifies the source of the
admin key
properties:
secretKeyRef:
description: SecretKeyRef references a key in
a Secret
properties:
key:
description: Key is the key in the secret
type: string
name:
description: Name is the name of the secret
type: string
required:
- key
- name
type: object
type: object
type: object
type:
description: Type specifies the type of authentication
enum:
- AdminKey
type: string
required:
- type
type: object
endpoints:
description: Endpoints specifies the list of control plane
endpoints
items:
type: string
minItems: 1
type: array
required:
- auth
- endpoints
type: object
type:
description: Type specifies the type of provider
enum:
- ControlPlane
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: controlPlane must be specified when type is ControlPlane
rule: 'self.type == ''ControlPlane'' ? has(self.controlPlane) :
true'
publishService:
type: string
statusAddress:
items:
type: string
type: array
type: object
type: object
served: true
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ require (
go.uber.org/zap v1.27.0
golang.org/x/net v0.28.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/gorm v1.25.11
helm.sh/helm/v3 v3.15.4
k8s.io/api v0.31.1
Expand Down Expand Up @@ -213,6 +212,7 @@ require (
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiserver v0.31.1 // indirect
k8s.io/cli-runtime v0.30.3 // indirect
k8s.io/component-base v0.31.1 // indirect
Expand Down
Loading