-
Notifications
You must be signed in to change notification settings - Fork 139
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
Add Gateway API and Envoy Gateway install to Calico Enterprise #3638
Merged
Merged
Changes from 24 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
829789c
Add Gateway API and Envoy Gateway install to Calico Enterprise
nelljerram 316d6ab
WIP
nelljerram dc6e756
Revert removal of non-CRD resources from pkg/render/gateway_api_crds.…
nelljerram 7d81fe9
Use calico-system namespace for Gateway API
nelljerram fc3412b
Rework to use YAML instead of equivalent Golang coding
nelljerram d69c0e3
Merge remote-tracking branch 'origin/master' into gateway-api-cr
nelljerram 363e958
Add GatewayControllerDeployment to override fields test
nelljerram 81b3699
Merge remote-tracking branch 'origin/master' into gateway-api-cr
nelljerram 1e7064f
Don't start GatewayAPI controller if not on an Enterprise system
nelljerram 3d34cc8
Fix gen-versions
nelljerram 21dcadf
Make GatewayAPI a non-namespaced resource
nelljerram ae05d26
Add overrides for the certgen job
nelljerram a39973c
Rendering UT (and fix!)
nelljerram c05bf21
Use separate namespace for Gateway API deployments
nelljerram ee44615
WIP - configure EnvoyProxy
nelljerram 40d5419
Import Envoy API, so we can provision EnvoyProxy and EnvoyGateway res…
nelljerram 54df43b
Provision EnvoyProxy
nelljerram 9a261c0
Add pull secrets to EnvoyGateway provisioning
nelljerram 4d2fdbd
Allow full EnvoyProxy customization according to standard pattern
nelljerram ddccdd6
Complete UT
nelljerram 9138936
Regenerate GatewayAPI CRD
nelljerram 4208242
Merge remote-tracking branch 'origin/master' into gateway-api-cr
nelljerram f88bd94
Regenerate GatewayAPI CRD
nelljerram bfa79c9
Fix static-checks
nelljerram 0700e47
Rename namespace "tigera-gateway-system" to "tigera-gateway"
nelljerram 05d7db3
Remove unused ResourceName constant
nelljerram 051adb7
Controller: get the GatewayAPI CR first of all
nelljerram 6d8a813
Call r.status.SetMetaData as soon as the GatewayAPI CR is found
nelljerram ecb2315
Create CRDs if they don't already exist, but never update existing ones
nelljerram 7d1a48e
Merge remote-tracking branch 'origin/master' into gateway-api-cr
nelljerram 1b81681
Regen
nelljerram 16b4532
Placate `make vet`
nelljerram f4b6cf4
componentHandler methods need a pointer receiver now
nelljerram aebcae8
Use normal templating for gateway API images
nelljerram a78f246
Object rendering improvements, from review comments
nelljerram 749efcc
Align API commenting with godoc convention
nelljerram 662b629
Regen
nelljerram fe82261
Only deep copy the objects that need it, i.e. those read from YAML
nelljerram 06dac6c
Provision GatewayClass
nelljerram 5ed00a1
Add Envoy and Gateway APIs to scheme
nelljerram 0d03e32
Clear degraded status when everything is good
nelljerram fe6a1b6
Specify docker.io as default registry for envoy image
nelljerram File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,296 @@ | ||
// Copyright (c) 2024 Tigera, Inc. All rights reserved. | ||
/* | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1 | ||
|
||
import ( | ||
appsv1 "k8s.io/api/apps/v1" | ||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// GatewayAPISpec has fields that can be used to customize our GatewayAPI support. | ||
type GatewayAPISpec struct { | ||
// Allow optional customization of the gateway controller deployment. | ||
GatewayControllerDeployment *GatewayControllerDeployment `json:"gatewayControllerDeployment,omitempty"` | ||
|
||
// Allow optional customization of the gateway certgen job. | ||
GatewayCertgenJob *GatewayCertgenJob `json:"gatewayCertgenJob,omitempty"` | ||
|
||
// Allow optional customization of gateway deployments. | ||
GatewayDeployment *GatewayDeployment `json:"gatewayDeployment,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:resource:scope=Cluster | ||
|
||
type GatewayAPI struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec GatewayAPISpec `json:"spec,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
type GatewayAPIList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []GatewayAPI `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&GatewayAPI{}, &GatewayAPIList{}) | ||
} | ||
|
||
// Optional customization of the gateway controller deployment. | ||
rene-dekker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// | ||
// If GatewayControllerDeployment.Metadata is non-nil, non-clashing labels and annotations from that | ||
// metadata are added into the deployment's top-level metadata. | ||
// | ||
// For customization of the deployment spec see GatewayControllerDeploymentSpec. | ||
type GatewayControllerDeployment struct { | ||
// +optional | ||
Metadata *Metadata `json:"metadata,omitempty"` | ||
|
||
// +optional | ||
Spec *GatewayControllerDeploymentSpec `json:"spec,omitempty"` | ||
} | ||
|
||
// Optional customization of the gateway controller deployment. | ||
// | ||
// If GatewayControllerDeployment.Spec.MinReadySeconds is non-nil, it sets the minReadySeconds field | ||
// for the deployment. | ||
// | ||
// For customization of the pod template see GatewayControllerDeploymentPodTemplate. | ||
type GatewayControllerDeploymentSpec struct { | ||
// +optional | ||
// +kubebuilder:validation:Minimum=0 | ||
// +kubebuilder:validation:Maximum=2147483647 | ||
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` | ||
|
||
// +optional | ||
Template *GatewayControllerDeploymentPodTemplate `json:"template,omitempty"` | ||
} | ||
|
||
// Optional customization of the gateway controller deployment. | ||
// | ||
// If GatewayControllerDeployment.Spec.Template.Metadata is non-nil, non-clashing labels and | ||
// annotations from that metadata are added into the deployment's pod template. | ||
// | ||
// For customization of the pod template spec see GatewayControllerDeploymentPodSpec. | ||
type GatewayControllerDeploymentPodTemplate struct { | ||
// +optional | ||
Metadata *Metadata `json:"metadata,omitempty"` | ||
|
||
// +optional | ||
Spec *GatewayControllerDeploymentPodSpec `json:"spec,omitempty"` | ||
} | ||
|
||
// Optional customization of the gateway controller deployment. | ||
// | ||
// If GatewayControllerDeployment.Spec.Template.Spec.Affinity is non-nil, it sets the affinity field | ||
// of the deployment's pod template. | ||
// | ||
// If GatewayControllerDeployment.Spec.Template.Spec.Containers["envoy-gateway"].Resources is | ||
// non-nil, it overrides the ResourceRequirements of the controller's "envoy-gateway" container. | ||
// | ||
// If GatewayControllerDeployment.Spec.Template.Spec.NodeSelector is non-nil, it sets a node | ||
// selector for where controller pods may be scheduled. | ||
// | ||
// If GatewayControllerDeployment.Spec.Template.Spec.Tolerations is non-nil, it sets the tolerations | ||
// field of the deployment's pod template. | ||
type GatewayControllerDeploymentPodSpec struct { | ||
// +optional | ||
Affinity *v1.Affinity `json:"affinity"` | ||
|
||
// +optional | ||
Containers []GatewayControllerDeploymentContainer `json:"containers,omitempty"` | ||
|
||
// +optional | ||
NodeSelector map[string]string `json:"nodeSelector,omitempty"` | ||
|
||
// +optional | ||
Tolerations []v1.Toleration `json:"tolerations"` | ||
} | ||
|
||
// See GatewayControllerDeploymentPodSpec for how this struct can be used. | ||
type GatewayControllerDeploymentContainer struct { | ||
// +kubebuilder:validation:Enum=envoy-gateway | ||
Name string `json:"name"` | ||
|
||
// +optional | ||
Resources *v1.ResourceRequirements `json:"resources,omitempty"` | ||
} | ||
|
||
// Optional customization of the gateway certgen job. | ||
// | ||
// If GatewayCertgenJob.Metadata is non-nil, non-clashing labels and annotations from that metadata | ||
// are added into the job's top-level metadata. | ||
// | ||
// For customization of the job spec see GatewayCertgenJobSpec. | ||
type GatewayCertgenJob struct { | ||
// +optional | ||
Metadata *Metadata `json:"metadata,omitempty"` | ||
|
||
// +optional | ||
Spec *GatewayCertgenJobSpec `json:"spec,omitempty"` | ||
} | ||
|
||
// Optional customization of the gateway certgen job. | ||
// | ||
// For customization of the job template see GatewayCertgenJobPodTemplate. | ||
type GatewayCertgenJobSpec struct { | ||
// +optional | ||
Template *GatewayCertgenJobPodTemplate `json:"template,omitempty"` | ||
} | ||
|
||
// Optional customization of the gateway certgen job. | ||
// | ||
// If GatewayCertgenJob.Spec.Template.Metadata is non-nil, non-clashing labels and | ||
// annotations from that metadata are added into the job's pod template. | ||
// | ||
// For customization of the pod template spec see GatewayCertgenJobPodSpec. | ||
type GatewayCertgenJobPodTemplate struct { | ||
// +optional | ||
Metadata *Metadata `json:"metadata,omitempty"` | ||
|
||
// +optional | ||
Spec *GatewayCertgenJobPodSpec `json:"spec,omitempty"` | ||
} | ||
|
||
// Optional customization of the gateway certgen job. | ||
// | ||
// If GatewayCertgenJob.Spec.Template.Spec.Affinity is non-nil, it sets the affinity field of the | ||
// job's pod template. | ||
// | ||
// If GatewayCertgenJob.Spec.Template.Spec.Containers["envoy-gateway-certgen"].Resources is non-nil, | ||
// it overrides the ResourceRequirements of the job's "envoy-gateway-certgen" container. | ||
// | ||
// If GatewayCertgenJob.Spec.Template.Spec.NodeSelector is non-nil, it sets a node selector for | ||
// where job pods may be scheduled. | ||
// | ||
// If GatewayCertgenJob.Spec.Template.Spec.Tolerations is non-nil, it sets the tolerations field of | ||
// the job's pod template. | ||
type GatewayCertgenJobPodSpec struct { | ||
// +optional | ||
Affinity *v1.Affinity `json:"affinity"` | ||
|
||
// +optional | ||
Containers []GatewayCertgenJobContainer `json:"containers,omitempty"` | ||
|
||
// +optional | ||
NodeSelector map[string]string `json:"nodeSelector,omitempty"` | ||
|
||
// +optional | ||
Tolerations []v1.Toleration `json:"tolerations"` | ||
} | ||
|
||
// See GatewayCertgenJobPodSpec for how this struct can be used. | ||
type GatewayCertgenJobContainer struct { | ||
// +kubebuilder:validation:Enum=envoy-gateway-certgen | ||
Name string `json:"name"` | ||
|
||
// +optional | ||
Resources *v1.ResourceRequirements `json:"resources,omitempty"` | ||
} | ||
|
||
// Optional customization of gateway deployments. | ||
// | ||
// For customization of the deployment spec see GatewayDeploymentSpec. | ||
type GatewayDeployment struct { | ||
// +optional | ||
Spec *GatewayDeploymentSpec `json:"spec,omitempty"` | ||
} | ||
|
||
// Optional customization of gateway deployments. | ||
// | ||
// For customization of the pod template see GatewayDeploymentPodTemplate. | ||
type GatewayDeploymentSpec struct { | ||
// +optional | ||
Template *GatewayDeploymentPodTemplate `json:"template,omitempty"` | ||
|
||
// The deployment strategy to use to replace existing pods with new ones. | ||
// +optional | ||
// +patchStrategy=retainKeys | ||
Strategy *GatewayDeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"` | ||
} | ||
|
||
// Optional customization of gateway deployments. | ||
// | ||
// If GatewayDeployment.Spec.Template.Metadata is non-nil, non-clashing labels and annotations from | ||
// that metadata are added into the deployment's pod template. | ||
// | ||
// For customization of the pod template spec see GatewayDeploymentPodSpec. | ||
type GatewayDeploymentPodTemplate struct { | ||
// +optional | ||
Metadata *Metadata `json:"metadata,omitempty"` | ||
|
||
// +optional | ||
Spec *GatewayDeploymentPodSpec `json:"spec,omitempty"` | ||
} | ||
|
||
// Optional customization of gateway deployments. | ||
// | ||
// If GatewayDeployment.Spec.Template.Spec.Affinity is non-nil, it sets the affinity field of the | ||
// deployment's pod template. | ||
// | ||
// If GatewayDeployment.Spec.Template.Spec.Containers["envoy"].Resources is non-nil, it | ||
// overrides the ResourceRequirements of the "envoy" container. | ||
// | ||
// If GatewayDeployment.Spec.Template.Spec.NodeSelector is non-nil, it sets a node selector for | ||
// where gateway pods may be scheduled. | ||
// | ||
// If GatewayDeployment.Spec.Template.Spec.Tolerations is non-nil, it sets the tolerations field of | ||
// the deployment's pod template. | ||
type GatewayDeploymentPodSpec struct { | ||
// +optional | ||
Affinity *v1.Affinity `json:"affinity"` | ||
|
||
// +optional | ||
Containers []GatewayDeploymentContainer `json:"containers,omitempty"` | ||
|
||
// +optional | ||
NodeSelector map[string]string `json:"nodeSelector,omitempty"` | ||
|
||
// TopologySpreadConstraints describes how a group of pods ought to spread across topology | ||
// domains. Scheduler will schedule pods in a way which abides by the constraints. | ||
// All topologySpreadConstraints are ANDed. | ||
// +optional | ||
TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"` | ||
|
||
// +optional | ||
Tolerations []v1.Toleration `json:"tolerations"` | ||
} | ||
|
||
// See GatewayDeploymentPodSpec for how this struct can be used. | ||
type GatewayDeploymentContainer struct { | ||
// +kubebuilder:validation:Enum=envoy | ||
Name string `json:"name"` | ||
|
||
// +optional | ||
Resources *v1.ResourceRequirements `json:"resources,omitempty"` | ||
} | ||
|
||
// GatewayDeploymentStrategy describes how to replace existing pods with new ones. Only RollingUpdate is supported | ||
// at this time so the Type field is not exposed. | ||
type GatewayDeploymentStrategy struct { | ||
// Rolling update config params. Present only if DeploymentStrategyType = | ||
// RollingUpdate. | ||
// to be. | ||
// +optional | ||
RollingUpdate *appsv1.RollingUpdateDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"` | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we generally write out api field names. I am assuming Certgen stands for Certificate Generation, meaning it is two words and both words should be capitalized in the field name as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm following the Envoy resources here, which have "certgen" as a single word.