diff --git a/api/config/v1alpha1/envoygateway_types.go b/api/config/v1alpha1/envoygateway_types.go index ec0bcb989e7..f5fa8993651 100644 --- a/api/config/v1alpha1/envoygateway_types.go +++ b/api/config/v1alpha1/envoygateway_types.go @@ -82,12 +82,12 @@ type EnvoyGatewayProvider struct { // +optional Kubernetes *EnvoyGatewayKubernetesProvider `json:"kubernetes,omitempty"` - // File defines the configuration of the File provider. File provides runtime - // configuration defined by one or more files. This type is not implemented - // until https://github.com/envoyproxy/gateway/issues/1001 is fixed. + // Custom defines the configuration for the Custom provider. This provider + // allows you to define a specific resource provider and a infrastructure + // provider. // // +optional - File *EnvoyGatewayFileProvider `json:"file,omitempty"` + Custom *EnvoyGatewayCustomProvider `json:"custom,omitempty"` } // EnvoyGatewayKubernetesProvider defines configuration for the Kubernetes provider. @@ -100,8 +100,75 @@ type EnvoyGatewayKubernetesProvider struct { RateLimitDeployment *KubernetesDeploymentSpec `json:"rateLimitDeployment,omitempty"` } -// EnvoyGatewayFileProvider defines configuration for the File provider. -type EnvoyGatewayFileProvider struct { +// EnvoyGatewayCustomProvider defines configuration for the Custom provider. +type EnvoyGatewayCustomProvider struct { + // Resource defines the desired resource provider. + // This provider is used to specify the provider to be used + // to retrieve the resource configurations such as Gateway API + // resources + Resource EnvoyGatewayResourceProvider `json:"resource"` + // Infrastructure defines the desired infrastructure provider. + // This provider is used to specify the provider to be used + // to provide an environment to deploy the out resources like + // the Envoy Proxy data plane. + Infrastructure EnvoyGatewayInfrastructureProvider `json:"infrastructure"` +} + +// ResourceProviderType defines the types of custom resource providers supported by Envoy Gateway. +// +// +kubebuilder:validation:Enum=File +type ResourceProviderType string + +const ( + // ResourceProviderTypeFile defines the "File" provider. + ResourceProviderTypeFile ResourceProviderType = "File" +) + +// EnvoyGatewayResourceProvider defines configuration for the Custom Resource provider. +type EnvoyGatewayResourceProvider struct { + // Type is the type of resource provider to use. Supported types are "File". + // + // +unionDiscriminator + Type ResourceProviderType `json:"type"` + // File defines the configuration of the File provider. File provides runtime + // configuration defined by one or more files. + // + // +optional + File *EnvoyGatewayFileResourceProvider `json:"file,omitempty"` +} + +// EnvoyGatewayFileResourceProvider defines configuration for the File Resource provider. +type EnvoyGatewayFileResourceProvider struct { + // Paths are the paths to a directory or file containing the resource configuration. + // Recursive sub directories are not currently supported. + Paths []string `json:"paths"` +} + +// InfrastructureProviderType defines the types of custom infrastructure providers supported by Envoy Gateway. +// +// +kubebuilder:validation:Enum=Host +type InfrastructureProviderType string + +const ( + // InfrastructureProviderTypeHost defines the "Host" provider. + InfrastructureProviderTypeHost InfrastructureProviderType = "Host" +) + +// EnvoyGatewayInfrastructureProvider defines configuration for the Custom Infrastructure provider. +type EnvoyGatewayInfrastructureProvider struct { + // Type is the type of infrastructure providers to use. Supported types are "Host". + // + // +unionDiscriminator + Type InfrastructureProviderType `json:"type"` + // Host defines the configuration of the Host provider. Host provides runtime + // deployment of the data plane as a child process on the host environment. + // + // +optional + Host *EnvoyGatewayHostInfrastructureProvider `json:"host,omitempty"` +} + +// EnvoyGatewayHostInfrastructureProvider defines configuration for the Host Infrastructure provider. +type EnvoyGatewayHostInfrastructureProvider struct { // TODO: Add config as use cases are better understood. } diff --git a/api/config/v1alpha1/zz_generated.deepcopy.go b/api/config/v1alpha1/zz_generated.deepcopy.go index 940857266c3..a215ac67c6d 100644 --- a/api/config/v1alpha1/zz_generated.deepcopy.go +++ b/api/config/v1alpha1/zz_generated.deepcopy.go @@ -41,16 +41,73 @@ func (in *EnvoyGateway) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EnvoyGatewayFileProvider) DeepCopyInto(out *EnvoyGatewayFileProvider) { +func (in *EnvoyGatewayCustomProvider) DeepCopyInto(out *EnvoyGatewayCustomProvider) { *out = *in + in.Resource.DeepCopyInto(&out.Resource) + in.Infrastructure.DeepCopyInto(&out.Infrastructure) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyGatewayFileProvider. -func (in *EnvoyGatewayFileProvider) DeepCopy() *EnvoyGatewayFileProvider { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyGatewayCustomProvider. +func (in *EnvoyGatewayCustomProvider) DeepCopy() *EnvoyGatewayCustomProvider { if in == nil { return nil } - out := new(EnvoyGatewayFileProvider) + out := new(EnvoyGatewayCustomProvider) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvoyGatewayFileResourceProvider) DeepCopyInto(out *EnvoyGatewayFileResourceProvider) { + *out = *in + if in.Paths != nil { + in, out := &in.Paths, &out.Paths + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyGatewayFileResourceProvider. +func (in *EnvoyGatewayFileResourceProvider) DeepCopy() *EnvoyGatewayFileResourceProvider { + if in == nil { + return nil + } + out := new(EnvoyGatewayFileResourceProvider) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvoyGatewayHostInfrastructureProvider) DeepCopyInto(out *EnvoyGatewayHostInfrastructureProvider) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyGatewayHostInfrastructureProvider. +func (in *EnvoyGatewayHostInfrastructureProvider) DeepCopy() *EnvoyGatewayHostInfrastructureProvider { + if in == nil { + return nil + } + out := new(EnvoyGatewayHostInfrastructureProvider) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvoyGatewayInfrastructureProvider) DeepCopyInto(out *EnvoyGatewayInfrastructureProvider) { + *out = *in + if in.Host != nil { + in, out := &in.Host, &out.Host + *out = new(EnvoyGatewayHostInfrastructureProvider) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyGatewayInfrastructureProvider. +func (in *EnvoyGatewayInfrastructureProvider) DeepCopy() *EnvoyGatewayInfrastructureProvider { + if in == nil { + return nil + } + out := new(EnvoyGatewayInfrastructureProvider) in.DeepCopyInto(out) return out } @@ -83,10 +140,10 @@ func (in *EnvoyGatewayProvider) DeepCopyInto(out *EnvoyGatewayProvider) { *out = new(EnvoyGatewayKubernetesProvider) (*in).DeepCopyInto(*out) } - if in.File != nil { - in, out := &in.File, &out.File - *out = new(EnvoyGatewayFileProvider) - **out = **in + if in.Custom != nil { + in, out := &in.Custom, &out.Custom + *out = new(EnvoyGatewayCustomProvider) + (*in).DeepCopyInto(*out) } } @@ -100,6 +157,26 @@ func (in *EnvoyGatewayProvider) DeepCopy() *EnvoyGatewayProvider { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvoyGatewayResourceProvider) DeepCopyInto(out *EnvoyGatewayResourceProvider) { + *out = *in + if in.File != nil { + in, out := &in.File, &out.File + *out = new(EnvoyGatewayFileResourceProvider) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvoyGatewayResourceProvider. +func (in *EnvoyGatewayResourceProvider) DeepCopy() *EnvoyGatewayResourceProvider { + if in == nil { + return nil + } + out := new(EnvoyGatewayResourceProvider) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EnvoyGatewaySpec) DeepCopyInto(out *EnvoyGatewaySpec) { *out = *in diff --git a/docs/latest/api/config_types.md b/docs/latest/api/config_types.md index b3648050bc2..490675fde2c 100644 --- a/docs/latest/api/config_types.md +++ b/docs/latest/api/config_types.md @@ -34,15 +34,59 @@ EnvoyGateway is the schema for the envoygateways API. | `extension` _[Extension](#extension)_ | Extension defines an extension to register for the Envoy Gateway Control Plane. | -## EnvoyGatewayFileProvider +## EnvoyGatewayCustomProvider -EnvoyGatewayFileProvider defines configuration for the File provider. +EnvoyGatewayCustomProvider defines configuration for the Custom provider. _Appears in:_ - [EnvoyGatewayProvider](#envoygatewayprovider) +| Field | Description | +| --- | --- | +| `resource` _[EnvoyGatewayResourceProvider](#envoygatewayresourceprovider)_ | Resource defines the desired resource provider. This provider is used to specify the provider to be used to retrieve the resource configurations such as Gateway API resources | +| `infrastructure` _[EnvoyGatewayInfrastructureProvider](#envoygatewayinfrastructureprovider)_ | Infrastructure defines the desired infrastructure provider. This provider is used to specify the provider to be used to provide an environment to deploy the out resources like the Envoy Proxy data plane. | + + +## EnvoyGatewayFileResourceProvider + + + +EnvoyGatewayFileResourceProvider defines configuration for the File Resource provider. + +_Appears in:_ +- [EnvoyGatewayResourceProvider](#envoygatewayresourceprovider) + +| Field | Description | +| --- | --- | +| `paths` _string array_ | Paths are the paths to a directory or file containing the resource configuration. Recursive sub directories are not currently supported. | + + +## EnvoyGatewayHostInfrastructureProvider + + + +EnvoyGatewayHostInfrastructureProvider defines configuration for the Host Infrastructure provider. + +_Appears in:_ +- [EnvoyGatewayInfrastructureProvider](#envoygatewayinfrastructureprovider) + + + +## EnvoyGatewayInfrastructureProvider + + + +EnvoyGatewayInfrastructureProvider defines configuration for the Custom Infrastructure provider. + +_Appears in:_ +- [EnvoyGatewayCustomProvider](#envoygatewaycustomprovider) + +| Field | Description | +| --- | --- | +| `type` _[InfrastructureProviderType](#infrastructureprovidertype)_ | Type is the type of infrastructure providers to use. Supported types are "Host". | +| `host` _[EnvoyGatewayHostInfrastructureProvider](#envoygatewayhostinfrastructureprovider)_ | Host defines the configuration of the Host provider. Host provides runtime deployment of the data plane as a child process on the host environment. | ## EnvoyGatewayKubernetesProvider @@ -73,7 +117,22 @@ _Appears in:_ | --- | --- | | `type` _[ProviderType](#providertype)_ | Type is the type of provider to use. Supported types are "Kubernetes". | | `kubernetes` _[EnvoyGatewayKubernetesProvider](#envoygatewaykubernetesprovider)_ | Kubernetes defines the configuration of the Kubernetes provider. Kubernetes provides runtime configuration via the Kubernetes API. | -| `file` _[EnvoyGatewayFileProvider](#envoygatewayfileprovider)_ | File defines the configuration of the File provider. File provides runtime configuration defined by one or more files. This type is not implemented until https://github.com/envoyproxy/gateway/issues/1001 is fixed. | +| `custom` _[EnvoyGatewayCustomProvider](#envoygatewaycustomprovider)_ | Custom defines the configuration for the Custom provider. This provider allows you to define a specific resource provider and a infrastructure provider. | + + +## EnvoyGatewayResourceProvider + + + +EnvoyGatewayResourceProvider defines configuration for the Custom Resource provider. + +_Appears in:_ +- [EnvoyGatewayCustomProvider](#envoygatewaycustomprovider) + +| Field | Description | +| --- | --- | +| `type` _[ResourceProviderType](#resourceprovidertype)_ | Type is the type of resource provider to use. Supported types are "File". | +| `file` _[EnvoyGatewayFileResourceProvider](#envoygatewayfileresourceprovider)_ | File defines the configuration of the File provider. File provides runtime configuration defined by one or more files. | ## EnvoyGatewaySpec @@ -250,6 +309,17 @@ _Appears in:_ | `kind` _string_ | | +## InfrastructureProviderType + +_Underlying type:_ `string` + +InfrastructureProviderType defines the types of custom infrastructure providers supported by Envoy Gateway. + +_Appears in:_ +- [EnvoyGatewayInfrastructureProvider](#envoygatewayinfrastructureprovider) + + + ## KubernetesContainerSpec @@ -417,6 +487,17 @@ _Appears in:_ | `url` _string_ | URL of the Redis Database. | +## ResourceProviderType + +_Underlying type:_ `string` + +ResourceProviderType defines the types of custom resource providers supported by Envoy Gateway. + +_Appears in:_ +- [EnvoyGatewayResourceProvider](#envoygatewayresourceprovider) + + + ## ServiceType _Underlying type:_ `string` diff --git a/docs/latest/design/local-envoy-gateway.md b/docs/latest/design/local-envoy-gateway.md index 46f0a6d0b53..d382b8cfff8 100644 --- a/docs/latest/design/local-envoy-gateway.md +++ b/docs/latest/design/local-envoy-gateway.md @@ -42,7 +42,8 @@ provider: resource: type: File file: - path: "config.yaml" + paths: + - "config.yaml" infrastructure: type: Host host: {}