@@ -20,125 +20,139 @@ import (
2020// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
2121// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2222
23- // GatewayProxySpec defines the desired state of GatewayProxy
23+ // GatewayProxySpec defines the desired state of GatewayProxy.
2424type GatewayProxySpec struct {
2525 // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
2626 // Important: Run "make" to regenerate code after modifying this file
2727
28- PublishService string `json:"publishService,omitempty"`
29- StatusAddress []string `json:"statusAddress,omitempty"`
30- Provider * GatewayProxyProvider `json:"provider,omitempty"`
31- Plugins []GatewayProxyPlugin `json:"plugins,omitempty"`
28+ // PublishService specifies the LoadBalancer-type Service whose external address the controller uses to
29+ // update the status of Ingress resources.
30+ PublishService string `json:"publishService,omitempty"`
31+ // StatusAddress specifies the external IP addresses that the controller uses to populate the status field
32+ // of GatewayProxy or Ingress resources for developers to access.
33+ StatusAddress []string `json:"statusAddress,omitempty"`
34+ // Provider configures the provider details.
35+ Provider * GatewayProxyProvider `json:"provider,omitempty"`
36+ // Plugins configure global plugins.
37+ Plugins []GatewayProxyPlugin `json:"plugins,omitempty"`
38+ // PluginMetadata configures common configurations shared by all plugin instances of the same name.
3239 PluginMetadata map [string ]apiextensionsv1.JSON `json:"pluginMetadata,omitempty"`
3340}
3441
35- // ProviderType defines the type of provider
42+ // ProviderType defines the type of provider.
3643// +kubebuilder:validation:Enum=ControlPlane
3744type ProviderType string
3845
3946const (
40- // ProviderTypeControlPlane represents the control plane provider type
47+ // ProviderTypeControlPlane represents the control plane provider type.
4148 ProviderTypeControlPlane ProviderType = "ControlPlane"
4249)
4350
44- // GatewayProxyProvider defines the provider configuration for GatewayProxy
51+ // GatewayProxyProvider defines the provider configuration for GatewayProxy.
4552// +kubebuilder:validation:XValidation:rule="self.type == 'ControlPlane' ? has(self.controlPlane) : true",message="controlPlane must be specified when type is ControlPlane"
4653type GatewayProxyProvider struct {
47- // Type specifies the type of provider
54+ // Type specifies the type of provider. Can only be `ControlPlane`.
4855 // +kubebuilder:validation:Required
4956 Type ProviderType `json:"type"`
5057
51- // ControlPlane specifies the configuration for control plane provider
58+ // ControlPlane specifies the configuration for control plane provider.
5259 // +optional
5360 ControlPlane * ControlPlaneProvider `json:"controlPlane,omitempty"`
5461}
5562
56- // AuthType defines the type of authentication
63+ // AuthType defines the type of authentication.
5764// +kubebuilder:validation:Enum=AdminKey
5865type AuthType string
5966
6067const (
61- // AuthTypeAdminKey represents the admin key authentication type
68+ // AuthTypeAdminKey represents the admin key authentication type.
6269 AuthTypeAdminKey AuthType = "AdminKey"
6370)
6471
65- // SecretKeySelector defines a reference to a specific key within a Secret
72+ // SecretKeySelector defines a reference to a specific key within a Secret.
6673type SecretKeySelector struct {
67- // Name is the name of the secret
74+ // Name is the name of the secret.
6875 // +kubebuilder:validation:Required
6976 Name string `json:"name"`
7077
71- // Key is the key in the secret
78+ // Key is the key in the secret to retrieve the secret from.
7279 // +kubebuilder:validation:Required
7380 Key string `json:"key"`
7481}
7582
76- // AdminKeyAuth defines the admin key authentication configuration
83+ // AdminKeyAuth defines the admin key authentication configuration.
7784type AdminKeyAuth struct {
78- // Value specifies the admin key value directly (not recommended for production)
85+ // Value sets the admin key value explicitly (not recommended for production).
7986 // +optional
8087 Value string `json:"value,omitempty"`
8188
82- // ValueFrom specifies the source of the admin key
89+ // ValueFrom specifies the source of the admin key.
8390 // +optional
8491 ValueFrom * AdminKeyValueFrom `json:"valueFrom,omitempty"`
8592}
8693
87- // AdminKeyValueFrom defines the source of the admin key
94+ // AdminKeyValueFrom defines the source of the admin key.
8895type AdminKeyValueFrom struct {
89- // SecretKeyRef references a key in a Secret
96+ // SecretKeyRef references a key in a Secret.
9097 // +optional
9198 SecretKeyRef * SecretKeySelector `json:"secretKeyRef,omitempty"`
9299}
93100
94- // ControlPlaneAuth defines the authentication configuration for control plane
101+ // ControlPlaneAuth defines the authentication configuration for control plane.
95102type ControlPlaneAuth struct {
96- // Type specifies the type of authentication
103+ // Type specifies the type of authentication.
104+ // Can only be `AdminKey`.
97105 // +kubebuilder:validation:Required
98106 Type AuthType `json:"type"`
99107
100- // AdminKey specifies the admin key authentication configuration
108+ // AdminKey specifies the admin key authentication configuration.
101109 // +optional
102110 AdminKey * AdminKeyAuth `json:"adminKey,omitempty"`
103111}
104112
105- // ControlPlaneProvider defines the configuration for control plane provider
113+ // ControlPlaneProvider defines the configuration for control plane provider.
106114type ControlPlaneProvider struct {
107- // Endpoints specifies the list of control plane endpoints
115+ // Endpoints specifies the list of control plane endpoints.
108116 // +kubebuilder:validation:Required
109117 // +kubebuilder:validation:MinItems=1
110118 Endpoints []string `json:"endpoints"`
111119
112- // TlsVerify specifies whether to verify the TLS certificate of the control plane
120+ // TlsVerify specifies whether to verify the TLS certificate of the control plane.
113121 // +optional
114122 TlsVerify * bool `json:"tlsVerify,omitempty"`
115123
116- // Auth specifies the authentication configuration
124+ // Auth specifies the authentication configurations.
117125 // +kubebuilder:validation:Required
118126 Auth ControlPlaneAuth `json:"auth"`
119127}
120128
121129// +kubebuilder:object:root=true
122- // GatewayProxy is the Schema for the gatewayproxies API
130+ // GatewayProxy is the Schema for the gatewayproxies API.
123131type GatewayProxy struct {
124132 metav1.TypeMeta `json:",inline"`
125133 metav1.ObjectMeta `json:"metadata,omitempty"`
126134
135+ // GatewayProxySpec defines the desired state and configuration of a GatewayProxy,
136+ // including networking settings, global plugins, and plugin metadata.
127137 Spec GatewayProxySpec `json:"spec,omitempty"`
128138}
129139
130140// +kubebuilder:object:root=true
131- // GatewayProxyList contains a list of GatewayProxy
141+ // GatewayProxyList contains a list of GatewayProxy.
132142type GatewayProxyList struct {
133143 metav1.TypeMeta `json:",inline"`
134144 metav1.ListMeta `json:"metadata,omitempty"`
135145 Items []GatewayProxy `json:"items"`
136146}
137147
148+ // GatewayProxyPlugin contains plugin configurations.
138149type GatewayProxyPlugin struct {
139- Name string `json:"name,omitempty"`
140- Enabled bool `json:"enabled,omitempty"`
141- Config apiextensionsv1.JSON `json:"config,omitempty"`
150+ // Name is the name of the plugin.
151+ Name string `json:"name,omitempty"`
152+ // Enabled defines whether the plugin is enabled.
153+ Enabled bool `json:"enabled,omitempty"`
154+ // Config defines the plugin's configuration details.
155+ Config apiextensionsv1.JSON `json:"config,omitempty"`
142156}
143157
144158func init () {
0 commit comments