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

crd/ContourDeployment: Add fields for (update)Strategy #4713

Merged
merged 22 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from 19 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
46 changes: 45 additions & 1 deletion apis/projectcontour/v1alpha1/contourdeployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package v1alpha1

import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -74,10 +75,15 @@ type ContourDeploymentSpec struct {
// ContourSettings contains settings for the Contour part of the installation,
// i.e. the xDS server/control plane and associated resources.
type ContourSettings struct {
// Replicas is the desired number of Contour replicas. If unset,
// Deprecated: Use `DeploymentSettings.Replicas` instead.
//
// Replicas is the desired number of Contour replicas. If if unset,
// defaults to 2.
//
// if both `DeploymentSettings.Replicas` and this one is set, use `DeploymentSettings.Replicas`.
//
// +kubebuilder:validation:Minimum=0
// +optional
Replicas int32 `json:"replicas,omitempty"`

// NodePlacement describes node scheduling configuration of Contour pods.
Expand All @@ -104,6 +110,29 @@ type ContourSettings struct {
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`

// Deployment describes the settings for running contour as a `Deployment`.
// +optional
Deployment *DeploymentSettings `json:"deployment,omitempty"`
}

// DeploymentSettings contains settings for Deployment resources.
type DeploymentSettings struct {
// Replicas is the desired number of replicas.
//
// +kubebuilder:validation:Minimum=0
Replicas int32 `json:"replicas,omitempty"`

// Strategy describes the deployment strategy to use to replace existing pods with new pods.
// +optional
Strategy *appsv1.DeploymentStrategy `json:"strategy,omitempty"`
}

// DaemonSetSettings contains settings for DaemonSet resources.
type DaemonSetSettings struct {
// Strategy describes the deployment strategy to use to replace existing DaemonSet pods with new pods.
// +optional
UpdateStrategy *appsv1.DaemonSetUpdateStrategy `json:"updateStrategy,omitempty"`
}

// EnvoySettings contains settings for the Envoy part of the installation,
Expand All @@ -116,11 +145,16 @@ type EnvoySettings struct {
// +optional
WorkloadType WorkloadType `json:"workloadType,omitempty"`

// Deprecated: Use `DeploymentSettings.Replicas` instead.
//
// Replicas is the desired number of Envoy replicas. If WorkloadType
// is not "Deployment", this field is ignored. Otherwise, if unset,
// defaults to 2.
//
// if both `DeploymentSettings.Replicas` and this one is set, use `DeploymentSettings.Replicas`.
//
// +kubebuilder:validation:Minimum=0
// +optional
Replicas int32 `json:"replicas,omitempty"`

// NetworkPublishing defines how to expose Envoy to a network.
Expand Down Expand Up @@ -156,6 +190,16 @@ type EnvoySettings struct {
//
// +optional
LogLevel LogLevel `json:"logLevel,omitempty"`

// DaemonSet describes the settings for running envoy as a `DaemonSet`.
// if `WorkloadType` is `Deployment`,it's must be nil
// +optional
DaemonSet *DaemonSetSettings `json:"daemonSet,omitempty"`

// Deployment describes the settings for running envoy as a `Deployment`.
// if `WorkloadType` is `DaemonSet`,it's must be nil
// +optional
Deployment *DeploymentSettings `json:"deployment,omitempty"`
}

// WorkloadType is the type of Kubernetes workload to use for a component.
Expand Down
56 changes: 56 additions & 0 deletions apis/projectcontour/v1alpha1/zz_generated.deepcopy.go

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

5 changes: 5 additions & 0 deletions changelogs/unreleased/4713-izturn-deprecation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ContourDeployment.Spec.Contour.Replicas and ContourDeployment.Spec.Envoy.Replicas are deprecated

- `ContourDeployment.Spec.Contour.Replicas` is deprecated and has been replaced by `ContourDeployment.Spec.Contour.Deployment.Replicas`. Users should switch to using the new field. The deprecated field will be removed in a future release. See #4713 for additional details.

- `ContourDeployment.Spec.Envoy.Replicas` is deprecated and has been replaced by `ContourDeployment.Spec.Envoy.Deployment.Replicas`. Users should switch to using the new field. The deprecated field will be removed in a future release. See #4713 for additional details.
1 change: 1 addition & 0 deletions changelogs/unreleased/4713-izturn-small.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add (update)Strategy configurability to ContourDeployment resource for components.
Loading