Skip to content

Commit 48f02ae

Browse files
committed
fix: r
Signed-off-by: ashing <[email protected]>
1 parent 9a8489f commit 48f02ae

File tree

3 files changed

+31
-25
lines changed

3 files changed

+31
-25
lines changed

api/v1alpha1/gatewayproxy_types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type GatewayProxySpec struct {
3131

3232
PublishService string `json:"publishService,omitempty"`
3333
StatusAddress []string `json:"statusAddress,omitempty"`
34-
Provider *Provider `json:"provider,omitempty"`
34+
Provider *GatewayProxyProvider `json:"provider,omitempty"`
3535
Plugins []GatewayProxyPlugin `json:"plugins,omitempty"`
3636
PluginMetadata map[string]apiextensionsv1.JSON `json:"pluginMetadata,omitempty"`
3737
}
@@ -45,8 +45,9 @@ const (
4545
ProviderTypeControlPlane ProviderType = "ControlPlane"
4646
)
4747

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

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 21 additions & 21 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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ spec:
5555
type: object
5656
type: array
5757
provider:
58-
description: Provider defines the provider configuration for GatewayProxy
58+
description: GatewayProxyProvider defines the provider configuration
59+
for GatewayProxy
5960
properties:
6061
controlPlane:
6162
description: ControlPlane specifies the configuration for control
@@ -119,6 +120,10 @@ spec:
119120
required:
120121
- type
121122
type: object
123+
x-kubernetes-validations:
124+
- message: controlPlane must be specified when type is ControlPlane
125+
rule: 'self.type == ''ControlPlane'' ? has(self.controlPlane) :
126+
true'
122127
publishService:
123128
type: string
124129
statusAddress:

0 commit comments

Comments
 (0)