Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Renames and Expands Contour Networking API
Browse files Browse the repository at this point in the history
Signed-off-by: Daneyon Hansen <daneyonhansen@gmail.com>
  • Loading branch information
danehans committed Dec 10, 2020
1 parent 5317b8e commit 0652869
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 64 deletions.
77 changes: 54 additions & 23 deletions api/v1alpha1/contour_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ type ContourSpec struct {
// +kubebuilder:default={name: "projectcontour", removeOnDeletion: false}
Namespace NamespaceSpec `json:"namespace,omitempty"`

// EndpointPublishing is used to publish the network endpoints of Envoy.
// NetworkPublishing defines the schema for publishing Contour to a network.
//
// If unset, defaults to LoadBalancerService.
// See each field for additional details.
//
// +kubebuilder:default={type: "LoadBalancerService"}
EndpointPublishing EndpointPublishing `json:"endpointPublishing,omitempty"`
NetworkPublishing NetworkPublishing `json:"networkPublishing,omitempty"`
}

// NamespaceSpec defines the schema of a Contour namespace.
Expand All @@ -98,47 +97,79 @@ type NamespaceSpec struct {
RemoveOnDeletion bool `json:"removeOnDeletion,omitempty"`
}

// EndpointPublishing defines the schema to publish network endpoints and represents
// the publishing type.
type EndpointPublishing struct {
// NetworkPublishing defines the schema for publishing Contour to a network.
type NetworkPublishing struct {
// Envoy provides the schema for publishing the network endpoints of Envoy.
//
// If unset, defaults to:
// type: LoadBalancerService
// httpContainerPort: 80
// httpsContainerPort: 443
//
Envoy EnvoyNetworkPublishing `json:"envoy,omitempty"`
}

// EnvoyNetworkPublishing defines the schema to publish Envoy to a network.
// +union
type EnvoyNetworkPublishing struct {
// Type is the type of publishing strategy to use. Valid values are:
//
// * LoadBalancerService
//
// Publishes endpoints using a Kubernetes LoadBalancer Service.
//
// In this configuration, the endpoints use container networking and a Kubernetes
// LoadBalancer Service is created.
// In this configuration, network endpoints for Envoy use container networking.
// A Kubernetes LoadBalancer Service is created to publish Envoy network
// endpoints. The Service uses port 80 to publish Envoy's HTTP network endpoint
// and port 443 to publish Envoy's HTTPS network endpoint.
//
// See: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer
//
// * NodePortService
//
// Publishes the endpoints using a Kubernetes NodePort Service.
// Publishes Envoy network endpoints using a Kubernetes NodePort Service.
//
// In this configuration, the endpoints use container networking. A Kubernetes
// NodePort Service is created to publish the endpoints. The specific node ports
// are dynamically allocated by Kubernetes. To support static port allocations,
// user changes to the node port field of the managed NodePort Service will be
// preserved.
// In this configuration, Envoy network endpoints use container networking. A Kubernetes
// NodePort Service is created to publish the network endpoints.
//
// See: https://kubernetes.io/docs/concepts/services-networking/service/#nodeport
//
// +unionDiscriminator
// +kubebuilder:default=LoadBalancerService
Type EndpointPublishingType `json:"type,omitempty"`
Type NetworkPublishingType `json:"type,omitempty"`

// HTTPContainerPort is the HTTP port number to expose on the Envoy container.
// This must be a valid port number, 1 < x < 65536 and differ from
// HttpsContainerPort.
//
// If unset, defaults to 80.
//
// +kubebuilder:default=80
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
HTTPContainerPort int `json:"httpContainerPort,omitempty"`

// HTTPSContainerPort is the HTTPS port number to expose on the Envoy container.
// This must be a valid port number, 1 < x < 65536 and differ from
// HttpContainerPort.
//
// If unset, defaults to 443.
//
// +kubebuilder:default=443
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
HTTPSContainerPort int `json:"httpsContainerPort,omitempty"`
}

// EndpointPublishingType is a way to publish network endpoints.
// +kubebuilder:validation:Enum=LoadBalancerService;NodePortService
type EndpointPublishingType string
type NetworkPublishingType string

const (
// LoadBalancerService publishes an endpoint using a Kubernetes LoadBalancer
// LoadBalancerService publishes a network endpoint using a Kubernetes LoadBalancer
// Service.
LoadBalancerServiceStrategyType EndpointPublishingType = "LoadBalancerService"
LoadBalancerServicePublishingType NetworkPublishingType = "LoadBalancerService"

// NodePortService publishes an endpoint using a Kubernetes NodePort Service.
NodePortServiceStrategyType EndpointPublishingType = "NodePortService"
// NodePortService publishes a network endpoint using a Kubernetes NodePort Service.
NodePortServicePublishingType NetworkPublishingType = "NodePortService"
)

const (
Expand Down
26 changes: 21 additions & 5 deletions api/v1alpha1/zz_generated.deepcopy.go

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

40 changes: 27 additions & 13 deletions config/crd/bases/operator.projectcontour.io_contours.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ spec:
spec:
description: Spec defines the desired state of Contour.
properties:
endpointPublishing:
default:
type: LoadBalancerService
description: "EndpointPublishing is used to publish the network endpoints of Envoy. \n If unset, defaults to LoadBalancerService."
properties:
type:
default: LoadBalancerService
description: "Type is the type of publishing strategy to use. Valid values are: \n * LoadBalancerService \n Publishes endpoints using a Kubernetes LoadBalancer Service. \n In this configuration, the endpoints use container networking and a Kubernetes LoadBalancer Service is created. \n See: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer \n * NodePortService \n Publishes the endpoints using a Kubernetes NodePort Service. \n In this configuration, the endpoints use container networking. A Kubernetes NodePort Service is created to publish the endpoints. The specific node ports are dynamically allocated by Kubernetes. To support static port allocations, user changes to the node port field of the managed NodePort Service will be preserved. \n See: https://kubernetes.io/docs/concepts/services-networking/service/#nodeport"
enum:
- LoadBalancerService
- NodePortService
type: string
type: object
namespace:
default:
name: projectcontour
Expand All @@ -67,6 +54,33 @@ spec:
description: "RemoveOnDeletion will remove the namespace when the Contour is deleted. If set to True, deletion will not occur if any of the following conditions exist: \n 1. The Contour namespace is \"default\", \"kube-system\" or the contour-operator's namespace. \n 2. Another Contour exists in the namespace."
type: boolean
type: object
networkPublishing:
description: "NetworkPublishing defines the schema for publishing Contour to a network. \n See each field for additional details."
properties:
envoy:
description: "Envoy provides the schema for publishing the network endpoints of Envoy. \n If unset, defaults to: type: LoadBalancerService httpContainerPort: 80 httpsContainerPort: 443"
properties:
httpContainerPort:
default: 80
description: "HTTPContainerPort is the HTTP port number to expose on the Envoy container. This must be a valid port number, 1 < x < 65536 and differ from HttpsContainerPort. \n If unset, defaults to 80."
maximum: 65535
minimum: 1
type: integer
httpsContainerPort:
default: 443
description: "HTTPSContainerPort is the HTTPS port number to expose on the Envoy container. This must be a valid port number, 1 < x < 65536 and differ from HttpContainerPort. \n If unset, defaults to 443."
maximum: 65535
minimum: 1
type: integer
type:
default: LoadBalancerService
description: "Type is the type of publishing strategy to use. Valid values are: \n * LoadBalancerService \n In this configuration, network endpoints for Envoy use container networking. A Kubernetes LoadBalancer Service is created to publish Envoy network endpoints. The Service uses port 80 to publish Envoy's HTTP network endpoint and port 443 to publish Envoy's HTTPS network endpoint. \n See: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer \n * NodePortService \n Publishes Envoy network endpoints using a Kubernetes NodePort Service. \n In this configuration, Envoy network endpoints use container networking. A Kubernetes NodePort Service is created to publish the network endpoints. \n See: https://kubernetes.io/docs/concepts/services-networking/service/#nodeport"
enum:
- LoadBalancerService
- NodePortService
type: string
type: object
type: object
replicas:
default: 2
description: Replicas is the desired number of Contour replicas. If unset, defaults to 2.
Expand Down
70 changes: 47 additions & 23 deletions examples/operator/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,6 @@ spec:
spec:
description: Spec defines the desired state of Contour.
properties:
endpointPublishing:
description: "EndpointPublishing is used to publish the network endpoints
of Envoy. \n If unset, defaults to LoadBalancerService."
properties:
type:
default: LoadBalancerService
description: "Type is the type of publishing strategy to use.
Valid values are: \n * LoadBalancerService \n Publishes endpoints
using a Kubernetes LoadBalancer Service. \n In this configuration,
the endpoints use container networking and a Kubernetes LoadBalancer
Service is created. \n See: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer
\n * NodePortService \n Publishes the endpoints using a Kubernetes
NodePort Service. \n In this configuration, the endpoints use
container networking. A Kubernetes NodePort Service is created
to publish the endpoints. The specific node ports are dynamically
allocated by Kubernetes. To support static port allocations,
user changes to the node port field of the managed NodePort
Service will be preserved. \n See: https://kubernetes.io/docs/concepts/services-networking/service/#nodeport"
enum:
- LoadBalancerService
- NodePortService
type: string
type: object
namespace:
default:
name: projectcontour
Expand All @@ -92,6 +69,53 @@ spec:
namespace. \n 2. Another Contour exists in the namespace."
type: boolean
type: object
networkPublishing:
description: "NetworkPublishing defines the schema for publishing
Contour to a network. \n See each field for additional details."
properties:
envoy:
description: "Envoy provides the schema for publishing the network
endpoints of Envoy. \n If unset, defaults to: type: LoadBalancerService
\ httpContainerPort: 80 httpsContainerPort: 443"
properties:
httpContainerPort:
default: 80
description: "httpContainerPort is the HTTP port number to
expose on the Envoy container. This must be a valid port
number, 1 < x < 65536 and differ from HttpsContainerPort.
\n If unset, defaults to 80."
maximum: 65535
minimum: 1
type: integer
httpsContainerPort:
default: 443
description: "HttpsContainerPort is the HTTPS port number
to expose on the Envoy container. This must be a valid port
number, 1 < x < 65536 and differ from HttpContainerPort.
\n If unset, defaults to 443."
maximum: 65535
minimum: 1
type: integer
type:
default: LoadBalancerService
description: "Type is the type of publishing strategy to use.
Valid values are: \n * LoadBalancerService \n In this configuration,
network endpoints for Envoy use container networking. A
Kubernetes LoadBalancer Service is created to publish Envoy
network endpoints. The Service uses port 80 to publish Envoy's
HTTP network endpoint and port 443 to publish Envoy's HTTPS
network endpoint. \n See: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer
\n * NodePortService \n Publishes Envoy network endpoints
using a Kubernetes NodePort Service. \n In this configuration,
Envoy network endpoints use container networking. A Kubernetes
NodePort Service is created to publish the network endpoints.
\n See: https://kubernetes.io/docs/concepts/services-networking/service/#nodeport"
enum:
- LoadBalancerService
- NodePortService
type: string
type: object
type: object
replicas:
default: 2
description: Replicas is the desired number of Contour replicas. If
Expand Down

0 comments on commit 0652869

Please sign in to comment.