-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
mesh: add computed destinations with a controller that computes them #19067
Conversation
a800d12
to
9d77602
Compare
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
package workloadselectionmapper |
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 generalized this mapper as I needed the same functionality for both explicit destinations and proxy config controllers.
4025072
to
e2184f8
Compare
d3e50af
to
688a2eb
Compare
e2184f8
to
b11c7cb
Compare
internal/mesh/internal/mappers/workloadselectionmapper/workload_selection_mapper.go
Outdated
Show resolved
Hide resolved
internal/mesh/internal/mappers/workloadselectionmapper/workload_selection_mapper.go
Outdated
Show resolved
Hide resolved
internal/mesh/internal/mappers/common/workload_selector_util.go
Outdated
Show resolved
Hide resolved
internal/mesh/internal/controllers/explicitdestinations/controller.go
Outdated
Show resolved
Hide resolved
b11c7cb
to
68770d3
Compare
internal/mesh/internal/controllers/explicitdestinations/controller.go
Outdated
Show resolved
Hide resolved
internal/mesh/internal/controllers/explicitdestinations/status.go
Outdated
Show resolved
Hide resolved
internal/mesh/internal/controllers/explicitdestinations/controller.go
Outdated
Show resolved
Hide resolved
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.
Left a few remaining comments.
internal/mesh/internal/controllers/explicitdestinations/controller.go
Outdated
Show resolved
Hide resolved
1cb0ef5
to
355c141
Compare
serviceRefMapper: bimapper.New(pbmesh.ComputedExplicitDestinationsType, pbcatalog.ServiceType), | ||
} | ||
} | ||
|
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.
The methods below are tested in controller tests
6e56770
to
d09478f
Compare
internal/mesh/internal/controllers/explicitdestinations/controller.go
Outdated
Show resolved
Hide resolved
a44fdd2
to
24e59d6
Compare
This change builds on #19043 and #19067 and updates the sidecar controller to use those computed resources. This achieves several benefits: * The cache is now simplified which helps us solve for previous bugs (such as multiple Upstreams/Destinations targeting the same service would overwrite each other) * We no longer need proxy config cache * We no longer need to do merging of proxy configs as part of the controller logic * Controller watches are simplified because we no longer need to have complex mapping using cache and can instead use the simple ReplaceType mapper. It also makes several other improvements/refactors: * Unifies all caches into one. This is because originally the caches were more independent, however, now that they need to interact with each other it made sense to unify them where sidecar proxy controller uses one cache with 3 bimappers * Unifies cache and mappers. Mapper already needed all caches anyway and so it made sense to make the cache do the mapping also now that the cache is unified. * Gets rid of service endpoints watches. This was needed to get updates in a case when service's identities have changed and we need to update proxy state template's spiffe IDs for those destinations. This will however generate a lot of reconcile requests for this controller as service endpoints objects can change a lot because they contain workload's health status. This is solved by adding a status to the service object tracking "bound identities" and have service endpoints controller update it. Having service's status updated allows us to get updates in the sidecar proxy controller because it's already watching service objects * Add a watch for workloads. We need it so that we get updates if workload's ports change. This also ensures that we update cached identities in case workload's identity changes.
…19067) This commit adds a new type ComputedDestinations that will contain all destinations from any Destinations resources and will be name-aligned with a workload. This also adds an explicit-destinations controller that computes these resources. This is needed to simplify the tracking we need to do currently in the sidecar-proxy controller and makes it easier to query all explicit destinations that apply to a workload.
…mputes them into release/1.17.x (#19194) mesh: add computed destinations with a controller that computes them (#19067) This commit adds a new type ComputedDestinations that will contain all destinations from any Destinations resources and will be name-aligned with a workload. This also adds an explicit-destinations controller that computes these resources. This is needed to simplify the tracking we need to do currently in the sidecar-proxy controller and makes it easier to query all explicit destinations that apply to a workload. Co-authored-by: Iryna Shustava <[email protected]>
Description
This PR adds a new type
ComputedDestinations
that will contain all destinations from anyDestinations
resources and will be name-aligned with a workload. This also adds anexplicit-destinations
controller that computes these resources.This is needed to simplify the tracking we need to do currently in the sidecar-proxy controller and makes it easier to query all explicit destinations that apply to a workload.
PR Checklist