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

feat(controller): add canary steps plugin #3521

Merged
merged 50 commits into from
Aug 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
031a885
making code for step plugin
agaudreault Apr 5, 2024
78b42de
Merge remote-tracking branch 'upstream/master' into step-plugin
agaudreault Apr 5, 2024
0d4da53
Merge remote-tracking branch 'upstream/master' into step-plugin
agaudreault Apr 9, 2024
fc18d4b
codegen
agaudreault Apr 10, 2024
2d0513d
unit tests
agaudreault Apr 10, 2024
da408a0
rpc tests
agaudreault Apr 10, 2024
2169e35
add rpc plugin tests
agaudreault Apr 10, 2024
c76da2d
better message
agaudreault Apr 10, 2024
e61ca78
add order test
agaudreault Apr 10, 2024
129ff0c
implement terminate
agaudreault Apr 10, 2024
b610112
Terminate tests
agaudreault Apr 12, 2024
0db60ea
aborted logic + some unit test
agaudreault Apr 12, 2024
67e1f32
unit test
agaudreault Apr 15, 2024
37171bd
abort test
agaudreault Apr 15, 2024
c6e2a98
load plugin
agaudreault Apr 15, 2024
790bc1b
more tests
agaudreault Apr 15, 2024
c25ce26
dont use newStatus
agaudreault Apr 15, 2024
5ed7955
codegen preserve fields
agaudreault Apr 15, 2024
a0c30c9
some test before full promote problem
agaudreault Apr 18, 2024
db17cb5
fix full promotion
agaudreault Apr 18, 2024
5dedcc2
fix plugins
agaudreault Apr 18, 2024
ce17794
codegen
agaudreault Apr 18, 2024
0cc4d71
add disabled rollout
agaudreault Apr 19, 2024
c007efa
codegen
agaudreault Apr 19, 2024
dfeab0b
fix duration cast
agaudreault Apr 19, 2024
bcb39ad
refactor to use context object
agaudreault Apr 20, 2024
dcc9d93
adding debug logs.
agaudreault Apr 20, 2024
628237c
need to adjust the backoff on each reconcile
agaudreault Apr 20, 2024
13e8829
fix e2e
agaudreault Apr 20, 2024
e3a1a3d
unit test
agaudreault Apr 22, 2024
3b58d77
fix abort and promote logic
agaudreault Apr 29, 2024
97b8a8e
fix aborted rollout do not retry
agaudreault Apr 30, 2024
5761697
add event
agaudreault Apr 30, 2024
ae4e504
change enabled to status
agaudreault May 1, 2024
9d81110
unit tests
agaudreault May 1, 2024
c776330
more test
agaudreault May 1, 2024
aa37238
cleanup
agaudreault May 1, 2024
4866c0c
add docs
agaudreault May 1, 2024
d8b5171
docs
agaudreault May 1, 2024
2a05ea0
Merge remote-tracking branch 'upstream/master' into step-plugin
agaudreault May 1, 2024
a4331ab
makefile for e2e
agaudreault May 1, 2024
ee5195b
disable e2e when not configured
agaudreault May 1, 2024
b1d0963
Add some UI for the extension
agaudreault May 2, 2024
1fda169
Merge branch 'master' into step-plugin
agaudreault May 7, 2024
1a20837
Merge branch 'master' of github.com:argoproj/argo-rollouts into step-…
zachaller Jul 25, 2024
8bb0feb
Merge branch 'master' of github.com:argoproj/argo-rollouts into step-…
zachaller Jul 25, 2024
ef48f19
Merge branch 'master' of github.com:argoproj/argo-rollouts into step-…
zachaller Jul 29, 2024
941e8e0
Merge branch 'master' of github.com:argoproj/argo-rollouts into step-…
zachaller Aug 5, 2024
be995fb
Merge branch 'master' of github.com:argoproj/argo-rollouts into step-…
zachaller Aug 7, 2024
7459514
codegen
zachaller Aug 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rpc tests
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
  • Loading branch information
agaudreault committed Apr 10, 2024
commit da408a0e118ff1ef99d25207dc5b893124ad8587
18 changes: 9 additions & 9 deletions rollout/steps/plugin/rpc/rpc.go
Original file line number Diff line number Diff line change
@@ -13,17 +13,17 @@ import (

type RunArgs struct {
Rollout *v1alpha1.Rollout
Context types.RpcStepContext
Context *types.RpcStepContext
}

type TerminateArgs struct {
Rollout *v1alpha1.Rollout
Context types.RpcStepContext
Context *types.RpcStepContext
}

type AbortArgs struct {
Rollout *v1alpha1.Rollout
Context types.RpcStepContext
Context *types.RpcStepContext
}

type Response struct {
@@ -59,7 +59,7 @@ func (g *StepPluginRPC) InitPlugin() types.RpcError {
}

// Run executes the step
func (g *StepPluginRPC) Run(rollout *v1alpha1.Rollout, context types.RpcStepContext) (types.RpcStepResult, types.RpcError) {
func (g *StepPluginRPC) Run(rollout *v1alpha1.Rollout, context *types.RpcStepContext) (types.RpcStepResult, types.RpcError) {
var resp Response
var args any = RunArgs{
Rollout: rollout,
@@ -73,7 +73,7 @@ func (g *StepPluginRPC) Run(rollout *v1alpha1.Rollout, context types.RpcStepCont
}

// Terminate stops the execution of a running step and exits early
func (g *StepPluginRPC) Terminate(rollout *v1alpha1.Rollout, context types.RpcStepContext) (types.RpcStepResult, types.RpcError) {
func (g *StepPluginRPC) Terminate(rollout *v1alpha1.Rollout, context *types.RpcStepContext) (types.RpcStepResult, types.RpcError) {
var resp Response
var args any = TerminateArgs{
Rollout: rollout,
@@ -87,7 +87,7 @@ func (g *StepPluginRPC) Terminate(rollout *v1alpha1.Rollout, context types.RpcSt
}

// Abort reverts previous operation executed by the step if necessary
func (g *StepPluginRPC) Abort(rollout *v1alpha1.Rollout, context types.RpcStepContext) (types.RpcStepResult, types.RpcError) {
func (g *StepPluginRPC) Abort(rollout *v1alpha1.Rollout, context *types.RpcStepContext) (types.RpcStepResult, types.RpcError) {
var resp Response
var args any = AbortArgs{
Rollout: rollout,
@@ -131,7 +131,7 @@ func (s *StepRPCServer) Run(args any, resp *Response) error {
if !ok {
return fmt.Errorf("invalid args %s", args)
}
result, err := s.Impl.Run(runArgs.Rollout, &runArgs.Context)
result, err := s.Impl.Run(runArgs.Rollout, runArgs.Context)
*resp = Response{
Result: result,
Error: err,
@@ -145,7 +145,7 @@ func (s *StepRPCServer) Terminate(args any, resp *Response) error {
if !ok {
return fmt.Errorf("invalid args %s", args)
}
result, err := s.Impl.Terminate(runArgs.Rollout, &runArgs.Context)
result, err := s.Impl.Terminate(runArgs.Rollout, runArgs.Context)
*resp = Response{
Result: result,
Error: err,
@@ -159,7 +159,7 @@ func (s *StepRPCServer) Abort(args any, resp *Response) error {
if !ok {
return fmt.Errorf("invalid args %s", args)
}
result, err := s.Impl.Abort(runArgs.Rollout, &runArgs.Context)
result, err := s.Impl.Abort(runArgs.Rollout, runArgs.Context)
*resp = Response{
Result: result,
Error: err,
40 changes: 9 additions & 31 deletions rollout/steps/plugin/rpc/rpc_test.go
Original file line number Diff line number Diff line change
@@ -88,27 +88,17 @@ func TestPlugin(t *testing.T) {

ro := v1alpha1.Rollout{}

err = plugin.RemoveManagedRoutes(&ro)
_, err = plugin.Run(&ro, &types.RpcStepContext{})
assert.Equal(t, "", err.Error())

err = plugin.SetMirrorRoute(&ro, &v1alpha1.SetMirrorRoute{})
_, err = plugin.Terminate(&ro, &types.RpcStepContext{})
assert.Equal(t, "", err.Error())

err = plugin.SetHeaderRoute(&ro, &v1alpha1.SetHeaderRoute{})
assert.Equal(t, "", err.Error())

err = plugin.SetWeight(&ro, 0, []v1alpha1.WeightDestination{})
assert.Equal(t, "", err.Error())

b, err := plugin.VerifyWeight(&ro, 0, []v1alpha1.WeightDestination{})
assert.Equal(t, "", err.Error())
assert.Equal(t, true, *b.IsVerified())

err = plugin.UpdateHash(&ro, "canary-hash", "stable-hash", []v1alpha1.WeightDestination{})
_, err = plugin.Abort(&ro, &types.RpcStepContext{})
assert.Equal(t, "", err.Error())

typeString := plugin.Type()
assert.Equal(t, "TestRPCPlugin", typeString)
assert.Equal(t, "StepPlugin Test", typeString)

// Canceling should cause an exit
cancel()
@@ -141,31 +131,19 @@ func TestPluginClosedConnection(t *testing.T) {
}

func TestInvalidArgs(t *testing.T) {
server := TrafficRouterRPCServer{}
server := StepRPCServer{}
badtype := struct {
Args string
}{}

var errRpc types.RpcError
err := server.SetMirrorRoute(badtype, &errRpc)
var resp Response
err := server.Run(badtype, &resp)
assert.Error(t, err)

err = server.RemoveManagedRoutes(badtype, &errRpc)
err = server.Terminate(badtype, &resp)
assert.Error(t, err)

var vw VerifyWeightResponse
err = server.VerifyWeight(badtype, &vw)
err = server.Abort(badtype, &resp)
assert.Error(t, err)

err = server.SetMirrorRoute(badtype, &errRpc)
assert.Error(t, err)

err = server.SetHeaderRoute(badtype, &errRpc)
assert.Error(t, err)

err = server.SetWeight(badtype, &errRpc)
assert.Error(t, err)

err = server.UpdateHash(badtype, &errRpc)
assert.Error(t, err)
}