Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add API for Custom provider #1402

Merged
merged 3 commits into from
May 11, 2023
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
79 changes: 73 additions & 6 deletions api/config/v1alpha1/envoygateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
}

Expand Down
93 changes: 85 additions & 8 deletions api/config/v1alpha1/zz_generated.deepcopy.go

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

87 changes: 84 additions & 3 deletions docs/latest/api/config_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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`
Expand Down
3 changes: 2 additions & 1 deletion docs/latest/design/local-envoy-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ provider:
resource:
type: File
file:
path: "config.yaml"
paths:
- "config.yaml"
infrastructure:
type: Host
host: {}
Expand Down