Skip to content

Commit

Permalink
Adds ResourceProvider type to EnvoyProxy API
Browse files Browse the repository at this point in the history
Signed-off-by: danehans <daneyonhansen@gmail.com>
  • Loading branch information
danehans committed Dec 1, 2022
1 parent 7b73d14 commit 54d17ec
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 15 deletions.
15 changes: 3 additions & 12 deletions api/config/v1alpha1/envoygateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ type Gateway struct {
// Provider defines the desired configuration of a provider.
// +union
type Provider struct {
// Type is the type of provider to use.
// Type is the type of provider to use. Supported types are:
//
// * Kubernetes: A provider that provides runtime configuration via the Kubernetes API.
//
// +unionDiscriminator
Type ProviderType `json:"type"`
Expand All @@ -74,17 +76,6 @@ type Provider struct {
File *FileProvider `json:"file,omitempty"`
}

// ProviderType defines the types of providers supported by Envoy Gateway.
type ProviderType string

const (
// ProviderTypeKubernetes defines the "Kubernetes" provider.
ProviderTypeKubernetes ProviderType = "Kubernetes"

// ProviderTypeFile defines the "File" provider.
ProviderTypeFile ProviderType = "File"
)

// KubernetesProvider defines configuration for the Kubernetes provider.
type KubernetesProvider struct {
// TODO: Add config as use cases are better understood.
Expand Down
51 changes: 49 additions & 2 deletions api/config/v1alpha1/envoyproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,55 @@ type EnvoyProxy struct {

// EnvoyProxySpec defines the desired state of EnvoyProxy.
type EnvoyProxySpec struct {
// INSERT ADDITIONAL SPEC FIELDS - define desired state of cluster.
// Important: Run "make" to regenerate code after modifying this file.
// Provider defines the desired resource provider and provider-specific configuration.
// If unspecified, the "Kubernetes" resource provider is used with default configuration
// parameters.
//
// +optional
Provider *ResourceProvider `json:"provider,omitempty"`
}

// ResourceProvider defines the desired state of a resource provider.
// +union
type ResourceProvider struct {
// Type is the type of resource provider to use. A resource provider provides
// infrastructure resources for running the data plane, e.g. Envoy proxy, and
// optional auxiliary control planes. Supported types are:
//
// * Kubernetes: Provides infrastructure resources for running the data plane,
// e.g. Envoy proxy, and optional auxiliary control planes.
//
// +unionDiscriminator
Type ProviderType `json:"type"`
// Kubernetes defines the desired state of the Kubernetes resource provider.
// Kubernetes provides infrastructure resources for running the data plane,
// e.g. Envoy proxy, and optional auxiliary control planes. If unspecified
// and type is "Kubernetes", default settings for managed Kubernetes resources
// are applied.
//
// +optional
Kubernetes *KubernetesResourceProvider `json:"kubernetes,omitempty"`
}

// KubernetesResourceProvider defines configuration for the Kubernetes resource
// provider.
type KubernetesResourceProvider struct {
// EnvoyDeployment defines the desired state of the Envoy deployment resource.
// If unspecified, default settings for the manged Envoy deployment resource
// are applied.
//
// +optional
EnvoyDeployment *EnvoyDeployment `json:"envoyDeployment,omitempty"`
}

// EnvoyDeployment defines the desired state of the Envoy deployment resource.
type EnvoyDeployment struct {
// Replicas is the number of desired Envoy proxy pods. Defaults to 1.
//
// +optional
Replicas *int32 `json:"replicas,omitempty"`

// TODO: Expose config as use cases are better understood, e.g. labels.
}

// EnvoyProxyStatus defines the observed state of EnvoyProxy
Expand Down
19 changes: 19 additions & 0 deletions api/config/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright Envoy Gateway Authors
// SPDX-License-Identifier: Apache-2.0
// The full text of the Apache license is available in the LICENSE file at
// the root of the repo.

package v1alpha1

// ProviderType defines the types of providers supported by Envoy Gateway.
//
// +kubebuilder:validation:Enum=Kubernetes
type ProviderType string

const (
// ProviderTypeKubernetes defines the "Kubernetes" provider.
ProviderTypeKubernetes ProviderType = "Kubernetes"

// ProviderTypeFile defines the "File" provider.
ProviderTypeFile ProviderType = "File"
)
67 changes: 66 additions & 1 deletion api/config/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,44 @@ spec:
type: object
spec:
description: EnvoyProxySpec defines the desired state of EnvoyProxy.
properties:
provider:
description: Provider defines the desired resource provider and provider-specific
configuration. If unspecified, the "Kubernetes" resource provider
is used with default configuration parameters.
properties:
kubernetes:
description: Kubernetes defines the desired state of the Kubernetes
resource provider. Kubernetes provides infrastructure resources
for running the data plane, e.g. Envoy proxy, and optional auxiliary
control planes. If unspecified and type is "Kubernetes", default
settings for managed Kubernetes resources are applied.
properties:
envoyDeployment:
description: EnvoyDeployment defines the desired state of
the Envoy deployment resource. If unspecified, default settings
for the manged Envoy deployment resource are applied.
properties:
replicas:
description: Replicas is the number of desired Envoy proxy
pods. Defaults to 1.
format: int32
type: integer
type: object
type: object
type:
description: "Type is the type of resource provider to use. A
resource provider provides infrastructure resources for running
the data plane, e.g. Envoy proxy, and optional auxiliary control
planes. Supported types are: \n * Kubernetes: Provides infrastructure
resources for running the data plane, e.g. Envoy proxy, and
optional auxiliary control planes."
enum:
- Kubernetes
type: string
required:
- type
type: object
type: object
status:
description: EnvoyProxyStatus defines the observed state of EnvoyProxy
Expand Down

0 comments on commit 54d17ec

Please sign in to comment.