Skip to content

Commit 10dba6a

Browse files
committed
chore: GatewayProxy support provider
Signed-off-by: ashing <[email protected]>
1 parent 2d3e218 commit 10dba6a

File tree

4 files changed

+282
-1
lines changed

4 files changed

+282
-1
lines changed

api/v1alpha1/gatewayproxy_types.go

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,94 @@ type GatewayProxySpec struct {
2929
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
3030
// Important: Run "make" to regenerate code after modifying this file
3131

32+
PublishService string `json:"publishService,omitempty"`
33+
StatusAddress []string `json:"statusAddress,omitempty"`
34+
Provider *Provider `json:"provider,omitempty"`
3235
Plugins []GatewayProxyPlugin `json:"plugins,omitempty"`
3336
PluginMetadata map[string]apiextensionsv1.JSON `json:"pluginMetadata,omitempty"`
3437
}
3538

39+
// ProviderType defines the type of provider
40+
// +kubebuilder:validation:Enum=ControlPlane
41+
type ProviderType string
42+
43+
const (
44+
// ProviderTypeControlPlane represents the control plane provider type
45+
ProviderTypeControlPlane ProviderType = "ControlPlane"
46+
)
47+
48+
// Provider defines the provider configuration for GatewayProxy
49+
type Provider struct {
50+
// Type specifies the type of provider
51+
// +kubebuilder:validation:Required
52+
Type ProviderType `json:"type"`
53+
54+
// ControlPlane specifies the configuration for control plane provider
55+
// +optional
56+
ControlPlane *ControlPlaneProvider `json:"controlPlane,omitempty"`
57+
}
58+
59+
// AuthType defines the type of authentication
60+
// +kubebuilder:validation:Enum=AdminKey
61+
type AuthType string
62+
63+
const (
64+
// AuthTypeAdminKey represents the admin key authentication type
65+
AuthTypeAdminKey AuthType = "AdminKey"
66+
)
67+
68+
// SecretKeySelector defines a reference to a specific key within a Secret
69+
type SecretKeySelector struct {
70+
// Name is the name of the secret
71+
// +kubebuilder:validation:Required
72+
Name string `json:"name"`
73+
74+
// Key is the key in the secret
75+
// +kubebuilder:validation:Required
76+
Key string `json:"key"`
77+
}
78+
79+
// AdminKeyAuth defines the admin key authentication configuration
80+
type AdminKeyAuth struct {
81+
// Value specifies the admin key value directly (not recommended for production)
82+
// +optional
83+
Value string `json:"value,omitempty"`
84+
85+
// ValueFrom specifies the source of the admin key
86+
// +optional
87+
ValueFrom *AdminKeyValueFrom `json:"valueFrom,omitempty"`
88+
}
89+
90+
// AdminKeyValueFrom defines the source of the admin key
91+
type AdminKeyValueFrom struct {
92+
// SecretKeyRef references a key in a Secret
93+
// +optional
94+
SecretKeyRef *SecretKeySelector `json:"secretKeyRef,omitempty"`
95+
}
96+
97+
// ControlPlaneAuth defines the authentication configuration for control plane
98+
type ControlPlaneAuth struct {
99+
// Type specifies the type of authentication
100+
// +kubebuilder:validation:Required
101+
Type AuthType `json:"type"`
102+
103+
// AdminKey specifies the admin key authentication configuration
104+
// +optional
105+
AdminKey *AdminKeyAuth `json:"adminKey,omitempty"`
106+
}
107+
108+
// ControlPlaneProvider defines the configuration for control plane provider
109+
type ControlPlaneProvider struct {
110+
// Endpoints specifies the list of control plane endpoints
111+
// +kubebuilder:validation:Required
112+
// +kubebuilder:validation:MinItems=1
113+
Endpoints []string `json:"endpoints"`
114+
115+
// Auth specifies the authentication configuration
116+
// +kubebuilder:validation:Required
117+
Auth ControlPlaneAuth `json:"auth"`
118+
}
119+
36120
// +kubebuilder:object:root=true
37121
// GatewayProxy is the Schema for the gatewayproxies API
38122
type GatewayProxy struct {

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 126 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/gateway.apisix.io_gatewayproxies.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,77 @@ spec:
5454
type: string
5555
type: object
5656
type: array
57+
provider:
58+
description: Provider defines the provider configuration for GatewayProxy
59+
properties:
60+
controlPlane:
61+
description: ControlPlane specifies the configuration for control
62+
plane provider
63+
properties:
64+
auth:
65+
description: Auth specifies the authentication configuration
66+
properties:
67+
adminKey:
68+
description: AdminKey specifies the admin key authentication
69+
configuration
70+
properties:
71+
value:
72+
description: Value specifies the admin key value directly
73+
(not recommended for production)
74+
type: string
75+
valueFrom:
76+
description: ValueFrom specifies the source of the
77+
admin key
78+
properties:
79+
secretKeyRef:
80+
description: SecretKeyRef references a key in
81+
a Secret
82+
properties:
83+
key:
84+
description: Key is the key in the secret
85+
type: string
86+
name:
87+
description: Name is the name of the secret
88+
type: string
89+
required:
90+
- key
91+
- name
92+
type: object
93+
type: object
94+
type: object
95+
type:
96+
description: Type specifies the type of authentication
97+
enum:
98+
- AdminKey
99+
type: string
100+
required:
101+
- type
102+
type: object
103+
endpoints:
104+
description: Endpoints specifies the list of control plane
105+
endpoints
106+
items:
107+
type: string
108+
minItems: 1
109+
type: array
110+
required:
111+
- auth
112+
- endpoints
113+
type: object
114+
type:
115+
description: Type specifies the type of provider
116+
enum:
117+
- ControlPlane
118+
type: string
119+
required:
120+
- type
121+
type: object
122+
publishService:
123+
type: string
124+
statusAddress:
125+
items:
126+
type: string
127+
type: array
57128
type: object
58129
type: object
59130
served: true

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ require (
2929
go.uber.org/zap v1.27.0
3030
golang.org/x/net v0.28.0
3131
gopkg.in/yaml.v2 v2.4.0
32-
gopkg.in/yaml.v3 v3.0.1
3332
gorm.io/gorm v1.25.11
3433
helm.sh/helm/v3 v3.15.4
3534
k8s.io/api v0.31.1
@@ -213,6 +212,7 @@ require (
213212
gopkg.in/fsnotify.v1 v1.4.7 // indirect
214213
gopkg.in/inf.v0 v0.9.1 // indirect
215214
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
215+
gopkg.in/yaml.v3 v3.0.1 // indirect
216216
k8s.io/apiserver v0.31.1 // indirect
217217
k8s.io/cli-runtime v0.30.3 // indirect
218218
k8s.io/component-base v0.31.1 // indirect

0 commit comments

Comments
 (0)