Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

[backport] traffic-split: update root service selector & targetPort usage (#4902) #4905

Merged
merged 2 commits into from
Jul 18, 2022

Conversation

shashankram
Copy link
Member

Backports 5f54056 to release-v1.2

This change does the following:

  1. Fixes the incorrect legacy behavior where traffic
    directed to a root service specified in a TrafficSplit
    resource can direct traffic to pods that do not match
    the root service's selector. Not only was this behavior
    confusing, it also significantly complicated code paths
    that required special handling of this scenario that is
    unintuitive. Going forward, the root service selector
    must match pods for traffic splitting to those pods to
    function. Existing e2e tests relying on this unsupported
    behavior have been updated to correctly configure selectors
    and labels on services and pods backing them. A redundant
    test explicitly testing the only supported scenario after
    this change has been removed. The automated demo has
    also been updated to correctly configure the selector and
    labels.

  2. Fixes Specifying root service port to a port other than containerPort/TargetPort of the leaf service doesn't not work #4894, where the TargetPort on the root service was
    expected to match the ContainerPort on the pod backing
    the service. Per SMI's TrafficSplit API, the TargetPort
    on the root does not need to match the ContainerPort
    on the pod, thus allowing newer application versions
    to change the ports they listen on without needing
    to update the root service definition.

Please answer the following questions with yes/no.

  1. Does this change contain code from or inspired by another project? no

    • Did you notify the maintainers and provide attribution?
  2. Is this a breaking change? yes

  3. Has documentation corresponding to this change been updated in the osm-docs repo (if applicable)? not yet

shashankram and others added 2 commits July 15, 2022 15:25
…ervicemesh#4902)

This change does the following:

1. Fixes the incorrect legacy behavior where traffic
   directed to a root service specified in a TrafficSplit
   resource can direct traffic to pods that do not match
   the root service's selector. Not only was this behavior
   confusing, it also significantly complicated code paths
   that required special handling of this scenario that is
   unintuitive. Going forward, the root service selector
   must match pods for traffic splitting to those pods to
   function. Existing e2e tests relying on this unsupported
   behavior have been updated to correctly configure selectors
   and labels on services and pods backing them. A redundant
   test explicitly testing the only supported scenario after
   this change has been removed. The automated demo has
   also been updated to correctly configure the selector and
   labels.

2. Fixes openservicemesh#4894, where the TargetPort on the root service was
   expected to match the ContainerPort on the pod backing
   the service. Per SMI's TrafficSplit API, the TargetPort
   on the root does not need to match the ContainerPort
   on the pod, thus allowing newer application versions
   to change the ports they listen on without needing
   to update the root service definition.

Signed-off-by: Shashank Ram <shashr2204@gmail.com>
Adds a note regarding the change to drop support
to split traffic from a root service to pods that
do not match the selector on the root service.

Signed-off-by: Shashank Ram <shashr2204@gmail.com>
@codecov-commenter
Copy link

Codecov Report

Merging #4905 (a18b4a5) into release-v1.2 (951d403) will decrease coverage by 0.05%.
The diff coverage is 71.69%.

@@               Coverage Diff                @@
##           release-v1.2    #4905      +/-   ##
================================================
- Coverage         68.68%   68.63%   -0.06%     
================================================
  Files               220      220              
  Lines             15914    15918       +4     
================================================
- Hits              10931    10925       -6     
- Misses             4931     4941      +10     
  Partials             52       52              
Flag Coverage Δ
unittests 68.63% <71.69%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/k8s/mock_controller_generated.go 12.96% <0.00%> (-1.18%) ⬇️
pkg/k8s/types.go 100.00% <ø> (ø)
pkg/catalog/outbound_traffic_policies.go 92.74% <83.33%> (-2.92%) ⬇️
pkg/k8s/client.go 94.98% <87.50%> (-0.84%) ⬇️
pkg/certificate/manager.go 77.51% <0.00%> (+0.80%) ⬆️
pkg/ticker/ticker.go 87.17% <0.00%> (+3.84%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 951d403...a18b4a5. Read the comment docs.

@trstringer trstringer merged commit f5f3603 into openservicemesh:release-v1.2 Jul 18, 2022
@shashankram shashankram deleted the rel-v1.2 branch July 18, 2022 16:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants