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

allow setting envoy proxy resource when using "expose" stanza #9854

Closed
fredwangwang opened this issue Jan 19, 2021 · 7 comments · Fixed by #9995
Closed

allow setting envoy proxy resource when using "expose" stanza #9854

fredwangwang opened this issue Jan 19, 2021 · 7 comments · Fixed by #9995
Assignees
Labels
hcc/cst Admin - internal stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/consul/connect Consul Connect integration type/enhancement

Comments

@fredwangwang
Copy link
Contributor

Nomad version

v1.0.1

Operating system and Environment details

Linux

Issue

The default resource usage for envoy_sidecar is a bit too high for us, so we relying on sidecar_task to lower the resource:

sidecar_task {
    resources {
      cpu    = ...
      memory = ...
    }
  }

However, we found out once this is set, we are not able to set expose =true anymore:
image

So for now we have to remove the resource override for the envoy sidecar. But it really should be able to have expose and resource setting for sidecar at the same time.

Related line here:

// serviceUsesConnectEnvoy returns true if the service is going to end up using
// the built-in envoy proxy.
//
// This implementation is kind of reading tea leaves - firstly Connect
// must be enabled, and second the sidecar_task must not be overridden. If these
// conditions are met, the preceding connect hook will have injected a Connect
// sidecar task, the configuration of which is interpolated at runtime.
func serviceUsesConnectEnvoy(s *structs.Service) bool {
// A non-nil connect stanza implies this service isn't connect enabled in
// the first place.
if s.Connect == nil {
return false
}
// A non-nil connect.sidecar_task stanza implies the sidecar task is being
// overridden (i.e. the default Envoy is not being used).
if s.Connect.SidecarTask != nil {
return false
}
return true
}

@fredwangwang fredwangwang changed the title allow setting envoy proxy resource when using "exposed" allow setting envoy proxy resource when using "expose" stanza Jan 19, 2021
@shoenig shoenig added stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/consul/connect Consul Connect integration type/enhancement labels Jan 19, 2021
@shoenig shoenig added this to Needs Triage in Nomad - Community Issues Triage via automation Jan 20, 2021
@idrennanvmware
Copy link
Contributor

idrennanvmware commented Jan 28, 2021

Just touching base here. We are getting crushed in deployment resource requirements with mesh enabled and this feature on (expose). Just deployment of a single service with 4 instances is taking 1000mhz of cpu

This is one of those things that get exponentially worse with every service that goes to the mesh

@evandam
Copy link

evandam commented Jan 28, 2021

Agreed this seems really important to be able to set. Alternatively, is there any way that the default resources can be set in the Nomad/Consul config so each job wouldn't have to set this?

@idrennanvmware
Copy link
Contributor

@evandam

In our case we have different services with different levels of requests per second, we would want each service having it's own settings (and we encourage our teams to justify their resource usage) - but I can see the usefulness of a way to override the defaults at the global level.

@idrennanvmware
Copy link
Contributor

I need to take a look deeper in to the code, but a thought struck me. Can it not be checked if the sidecar task is using the container specified in meta.connect.sidecar_image as part of the validation? If that value matches the image then overrides are "safe" at the resource level

@shoenig
Copy link
Member

shoenig commented Feb 9, 2021

I think we can just remove the precondition altogether; this was originally added when we still had hope of Connect potentially being backed by more than just Envoy, but that seems unlikely now. expose is a leaky abstraction of an Envoy feature, which is why we were trying to be careful here.

I'll work on this today so we can slip the fix into 1.0.4

@shoenig shoenig self-assigned this Feb 9, 2021
@idrennanvmware
Copy link
Contributor

Thank you! This is a huge improvement for us!

shoenig added a commit that referenced this issue Feb 9, 2021
This PR enables jobs configured with a custom sidecar_task to make
use of the `service.expose` feature for creating checks on services
in the service mesh. Before we would check that sidecar_task had not
been set (indicating that something other than envoy may be in use,
which would not support envoy's expose feature). However Consul has
not added support for anything other than envoy and probably never
will, so having the restriction in place seems like an unnecessary
hindrance. If Consul ever does support something other than Envoy,
they will likely find a way to provide the expose feature anyway.

Fixes #9854
shoenig added a commit that referenced this issue Feb 9, 2021
This PR enables jobs configured with a custom sidecar_task to make
use of the `service.expose` feature for creating checks on services
in the service mesh. Before we would check that sidecar_task had not
been set (indicating that something other than envoy may be in use,
which would not support envoy's expose feature). However Consul has
not added support for anything other than envoy and probably never
will, so having the restriction in place seems like an unnecessary
hindrance. If Consul ever does support something other than Envoy,
they will likely find a way to provide the expose feature anyway.

Fixes #9854
@davemay99 davemay99 added the hcc/cst Admin - internal label Feb 9, 2021
Nomad - Community Issues Triage automation moved this from Needs Triage to Done Feb 9, 2021
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hcc/cst Admin - internal stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/consul/connect Consul Connect integration type/enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants