-
Notifications
You must be signed in to change notification settings - Fork 399
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
Run Envoy Gateway like DaemonSet #3031
Conversation
Signed-off-by: zvlb <[email protected]>
Signed-off-by: zvlb <[email protected]>
// +optional | ||
Patch *KubernetesPatchSpec `json:"patch,omitempty"` | ||
|
||
// The daemonset strategy to use to replace existing pods with new ones. |
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.
for your use case, do you need all these fields - pod, container, initcontainers ?
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.
In my case I test many cases, but most important:
kind: EnvoyProxy
metadata:
name: envoy-proxy-config
namespace: envoy-gateway-system
spec:
provider:
type: Kubernetes
kubernetes:
mode: DaemonSet
envoyService:
disable: true
envoyDaemonSet:
pod:
hostNetwork: true
tolerations:
- key: node-role.kubernetes.io/control-plane
operator: Exists
nodeSelector:
node-role.kubernetes.io/control-plane: ""
Start Envoy Proxy like daemonset on special nodes with hostnetwork=true
May be for another cases someone need this?
// Default to false. | ||
// | ||
// +optional | ||
HostNetwork bool `json:"hostNetwork,omitempty"` |
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.
this is something we dont recommend, its rm this, suggest using patch
to achieve this
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.
Why? It's what I realy need for my case.
patch
- not very comfortable
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.
-1 on hostNetwork, we should never recommend using it, patch
can help edge case.
@@ -221,6 +271,11 @@ const ( | |||
// +kubebuilder:validation:XValidation:message="allocateLoadBalancerNodePorts can only be set for LoadBalancer type",rule="!has(self.allocateLoadBalancerNodePorts) || self.type == 'LoadBalancer'" | |||
// +kubebuilder:validation:XValidation:message="loadBalancerIP can only be set for LoadBalancer type",rule="!has(self.loadBalancerIP) || self.type == 'LoadBalancer'" | |||
type KubernetesServiceSpec struct { | |||
// Disable disables service if set to true. | |||
// By default, the service is enabled. |
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.
curious, why this is needed
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.
Bc if I run EnvoyProxy like daemonSet with hostNetwork - I don't need service
@@ -137,13 +137,25 @@ type ShutdownConfig struct { | |||
// EnvoyProxyKubernetesProvider defines configuration for the Kubernetes resource | |||
// provider. | |||
type EnvoyProxyKubernetesProvider struct { | |||
// Mode is the type of the Kubernetes resource provider. If unspecified, it defaults to "Deployment". |
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.
do we need an explicit mode field or can we use CEL validation to make sure
- if
Deployment
is set, thenDaemonSet
cannot be set
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.
If in future someone add tag +kubebuilder:default:="****"
to field in KubernetesDeploymentSpec
or KubernetesDaemonSetSpec
, then field envoyDaemonSet
or envoyDaemonSet
will not be empty. How to implement this case?
- the implicit behavior is a bit confusing
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.
will that be rejected by validating webhook?
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 not sure I understand what you're referring to. Does Envoy Gateway implement an Admission (Validation) webhook?
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.
EG use CEL
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.
@arkodg Can you help here? Which kubebuilder tag need you for this logic?
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.
- use a ptr type called
mode
to decide b/w Deployment and DaemonSet, defaulting to Deployment - use CEL to make sure when
mode
is set toDaemonSet
, user cannot populate the deployment field e.g.gateway/api/v1alpha1/ext_auth_types.go
Line 13 in 0f87fcb
// +kubebuilder:validation:XValidation:rule="(has(self.grpc) && !has(self.http)) || (!has(self.grpc) && has(self.http))",message="only one of grpc or http can be specified"
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.
do we need an explicit mode field or can we use CEL validation to make sure
May be we don't need mode
? Only EnvoyDeployment
and EnvoyDaemonSet
fields with validation. If not set - use Deployment (with default preset)
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.
do we need an explicit mode field or can we use CEL validation to make sure
May be we don't need
mode
? OnlyEnvoyDeployment
andEnvoyDaemonSet
fields with validation. If not set - use Deployment (with default preset)
I prefer this approach
Here's a more detailed description of your case: I have bare-metal installations of Kubernetes clusters. Since the ServiceType LoadBalancer is not supported in my setup, I need to deploy Envoy Proxy on specific nodes to route traffic to pods. |
Im not sure its going to work the way you've intended to
|
please kindly proposal API first, otherwise there will be a lot of waste. |
Let's decide how to ultimately implement the necessary functionality and resolve contentious issues:
Perhaps you want a different implementation for DaemonSet. I'm ready to listen to all proposals and implement what is approved. |
@zvlb I suggest breaking this up into 3 tasks
Suggest starting with 1. to make faster progress/ easier to agree on a small set of things and add the minimum fields needed along with the |
I will create 3 new PR for this. It's okay? |
sure, but reviewers will most likely review in above order since imo they range from must have to good to have |
@zvlb suggest running |
Actual PR - #3092 |
Issue - #2969
I decided not to wait for architecture discussions and implemented the functionality.
The issue suggested using the OpenTelemetry Operator structure for implementing the functionality. However, if we had followed the OpenTelemetry approach, we would have lost backward compatibility.
In the implemented functionality, the "old" logic remains intact, and the new logic is added for configuring Envoy Proxy as a DaemonSet.
A couple of points: