-
Notifications
You must be signed in to change notification settings - Fork 904
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
feat: support management of multiple Istio VirtualService objects #1381
feat: support management of multiple Istio VirtualService objects #1381
Conversation
…ollouts Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
d2c0b6a
to
3f3462f
Compare
…Argo Rollouts fixes argoproj#1100 Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
810a451
to
ec64953
Compare
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.
Thanks for the contributions. My review comments are added.
// GetRolloutVirtualServiceKeys gets the referenced VirtualService and its namespace from a Rollout | ||
func GetRolloutVirtualServiceKeys(ro *v1alpha1.Rollout) []string { | ||
var virtualServices []v1alpha1.IstioVirtualService | ||
var virtualServiceKeys []string |
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.
Are we getting keys or just namespace+name
? The variable name is kind of 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.
Basically, we get the list of keys. each key will be in the format of namespace / virtualService Name
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.
so how about vsvsNamespaceName? Key seems have different meanings in k8s.
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.
not resolved yet
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 only way to identify the rollout is with namespace and name. So, having the key as the variable name would make more sense.
I didn't change this in my latest update. Let me know your thoughts.
utils/istio/istio.go
Outdated
if namespace == "" { | ||
namespace = ro.Namespace | ||
if MultipleVirtualServiceConfigured(ro) { | ||
if canary.TrafficRouting.Istio.VirtualService.Name != "" { |
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 should not happen, right? Because the validation logic will not allow to reach this place. If so, this is a panic.
Or we can remove line 86 - 88
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.
Let's say both virtualService and virtualServices are configured then MultipleVirtualServiceConfigured method return true. Since both are configured which is an invalid configuration. so, i am having this check.
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.
Such scenario should be detected earlier in the validationVirtualServiceConfig, I believe this if and return empty string array may introduce a subtle bug in the future.
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.
please resolve this comment
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.
Yes, this check is already taken care. I have removed it.
Please check, let me know if you are okay with this change then I will resolve it.
…Argo Rollouts. Addressed all the review comments fixes argoproj#1100 Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
9f0125f
to
415edd8
Compare
Hi @jessesuen, could you please review this PR when you find the time. We want to get Argo Rollouts to production soon and this issue is a blocker right now. Thank you. |
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.
Thanks for the update. Looks much better.
…Argo Rollouts. Addressed the minor review comments fixes argoproj#1100 Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
bc187bb
to
b355ffb
Compare
utils/istio/istio.go
Outdated
if namespace == "" { | ||
namespace = ro.Namespace | ||
if MultipleVirtualServiceConfigured(ro) { | ||
if canary.TrafficRouting.Istio.VirtualService.Name != "" { |
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.
Such scenario should be detected earlier in the validationVirtualServiceConfig, I believe this if and return empty string array may introduce a subtle bug in the future.
Hi, @jessesuen , I almost finished reviewing this PR. Do you mind kicking off the CI flow? Thanks. |
Codecov Report
@@ Coverage Diff @@
## master #1381 +/- ##
==========================================
+ Coverage 81.35% 81.43% +0.07%
==========================================
Files 108 108
Lines 14505 14573 +68
==========================================
+ Hits 11801 11867 +66
Misses 2089 2089
- Partials 615 617 +2
Continue to review full report at Codecov.
|
…Argo Rollouts. Addressed few minor review comments fixes argoproj#1100 Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
a611c0b
to
58d3595
Compare
Hi @jessesuen , I have updated the PR. |
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.
Please do not mark the comment resolved as you have not made any change.
// GetRolloutVirtualServiceKeys gets the referenced VirtualService and its namespace from a Rollout | ||
func GetRolloutVirtualServiceKeys(ro *v1alpha1.Rollout) []string { | ||
var virtualServices []v1alpha1.IstioVirtualService | ||
var virtualServiceKeys []string |
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.
not resolved yet
utils/istio/istio.go
Outdated
if namespace == "" { | ||
namespace = ro.Namespace | ||
if MultipleVirtualServiceConfigured(ro) { | ||
if canary.TrafficRouting.Istio.VirtualService.Name != "" { |
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.
please resolve this comment
@darshanhs09 could you please address the open review comments. Thanks. |
…Argo Rollouts. Addressed few minor review comments fixes argoproj#1100 Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
6061e68
to
2222dc8
Compare
Hi @shakti-das, I was out of town so couldn't check. |
…Argo Rollouts. fixing the lint issue. fixes argoproj#1100 Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
415576c
to
f627404
Compare
Could you resolve the conflict? Else LGTM. |
TlsRoutes is a new field introduced in virtualService. Thanks |
@@ -354,9 +354,11 @@ type NginxTrafficRouting struct { | |||
// IstioTrafficRouting configuration for Istio service mesh to enable fine grain configuration | |||
type IstioTrafficRouting struct { | |||
// VirtualService references an Istio VirtualService to modify to shape traffic | |||
VirtualService IstioVirtualService `json:"virtualService" protobuf:"bytes,1,opt,name=virtualService"` | |||
VirtualService IstioVirtualService `json:"virtualService,omitempty" protobuf:"bytes,1,opt,name=virtualService"` |
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 think the VirtualService field will need to be changed to a *IstioVirtualService
pointer, now that it is optional, since otherwise the virtualService
field will be defaulted to an empty struct after json marshaling. e.g.:
spec:
strategy:
canary:
trafficRouting:
istio:
virtualService: {}
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.
Yeah! you are right!
I am thinking, I will take care of this separately. All the existing code of virtualService needs to changed for this. It would be better to take care of it in a separate issue.
…Argo Rollouts. fixing the unit test issue. fixes argoproj#1100 Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
34ddd1d
to
5870f2e
Compare
…Argo Rollouts. Adding the TLSRoute details in the multiple virtualService spec. fixes argoproj#1100 Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
61c0ace
to
0c0871c
Compare
@huikang I have resolved the conflicts and update the PR. |
Hi, @darshanhs09, thanks for the update. Could you resolve the lint issue and re-run codegen? |
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.
some minor suggestions in the test file
…Argo Rollouts. Addressing few minor comments and lint issues. fixes argoproj#1100 Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
8d9cffd
to
bb1afbe
Compare
I have addressed Hui comments and lint issues. |
LGTM |
…Argo Rollouts. Addressing UT issue. fixes argoproj#1100 Signed-off-by: Darshan Hassan Shashikumar <[email protected]>
6c2f60e
to
80bf601
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@huikang Thanks for reviewing. |
Great work! |
Fixes #1100
Currently, Argo Rollout spec only supports a single VirtualService (VS) in its Istio integrated canary.
Multiple VirtualService support is needed in Istio-based setups in which a service's routes are given in multiple VirtualService objects rather than just a single one.
Use cases:
This feature is required to enable canary/blue-green traffic shifting for services with multiple port delegate VirtualServices.
It's very common to have multiple VirtualService's pointing to a single backend service.
Signed-off-by: Darshan Hassan Shashikumar [email protected]
Note: Users are recommended to use "trafficRouting.istio.virtualServices" instead of "trafficRouting.istio.virtualService". Because it provides more flexibility in adding one or more virtualServices. I am still keeping virtualService is to provide the backward compatibility. Going forward, we can deprecate "trafficRouting.istio.virtualService".
Checklist:
Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
The title of the PR is (a) conventional, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
I've signed my commits with DCO
I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
My builds are green. Try syncing with master if they are not.
My organization is added to USERS.md.