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

[2.2] Support for receiving commands to manipulate Rollouts #4040

Merged
merged 22 commits into from
Feb 3, 2022
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3c19e3b
Add argo rollouts server dependency [ci-skip]
douglascamata Jan 20, 2022
6f5c7c8
go mod tidy && go mod vendor && make generate
LukeShu Jan 31, 2022
4e53409
Sketch a basic implementation for updating in-cluster rollouts
douglascamata Jan 20, 2022
a31d36a
Add missing actions to RolloutCommand pb
douglascamata Jan 20, 2022
94ad4e9
Handle rollout commands coming over grpc
douglascamata Jan 20, 2022
8b598c2
Improve error handling on rollout commands
douglascamata Jan 20, 2022
969c75d
Add table tests for RolloutCommand
douglascamata Jan 24, 2022
b1c4d8b
Inject the Rollouts Getter creation through the Agent
douglascamata Jan 24, 2022
e2fec9a
Add some comments types in rollouts.go
douglascamata Jan 24, 2022
bf3854b
Add changelog entry about rollout commands
douglascamata Jan 25, 2022
eb1af93
Properly pass the context to run rollout commands
douglascamata Jan 28, 2022
dea4c48
Fix rollout action parsing
douglascamata Jan 31, 2022
1019b2d
Add permission for the agent to patch rollouts
douglascamata Jan 31, 2022
a64e90d
Report results of running rollout commands to the cloud
douglascamata Jan 31, 2022
3ddb8e4
Authenticate command result report call
Feb 1, 2022
03b43da
Fix error log when cannot report command result
Feb 1, 2022
1602547
Update release notes with info about the command reports
Feb 1, 2022
0e97d5e
Merge branch 'master' of github.com:emissary-ingress/emissary into dc…
Feb 2, 2022
fa28a62
Update generated files
Feb 2, 2022
a5a26f0
Fix typo in the changelog
Feb 3, 2022
9c07c67
Merge branch 'master' of github.com:emissary-ingress/emissary into dc…
Feb 3, 2022
c71a957
Update generated manifests
Feb 3, 2022
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
16 changes: 12 additions & 4 deletions pkg/agent/rollouts.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@ import (
"k8s.io/client-go/tools/clientcmd"
)

// rolloutAction indicates the action to be performed on a Rollout object
type rolloutAction string

const (
rolloutActionPause = rolloutAction("pause")
// rolloutActionPause represents the "pause" action on a Rollout
rolloutActionPause = rolloutAction("pause")
// rolloutActionResume represents the "resume" action on a Rollout
rolloutActionResume = rolloutAction("resume")
rolloutActionAbort = rolloutAction("abort")
// rolloutActionAbort represents the "abort" action on a Rollout
rolloutActionAbort = rolloutAction("abort")
)

// rolloutsGetterFactory is a factory for creating RolloutsGetter.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what's the purpose of a RolloutsGetter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of RolloutsGetter is to fetch Rollouts in a namespace inside the cluster.

type rolloutsGetterFactory func() (argov1alpha1.RolloutsGetter, error)

// rolloutCommand holds a reference to a Rollout command to be ran.
type rolloutCommand struct {
namespace string
rolloutName string
Expand All @@ -32,6 +38,7 @@ func (r *rolloutCommand) String() string {
return fmt.Sprintf("<rollout=%s namespace=%s action=%s>", r.rolloutName, r.namespace, r.action)
}

// RunWithClientFactory runs the given Rollout command using rolloutsClientFactory to get a RolloutsGetter.
func (r *rolloutCommand) RunWithClientFactory(rolloutsClientFactory rolloutsGetterFactory) error {
client, err := rolloutsClientFactory()
if err != nil {
Expand Down Expand Up @@ -81,8 +88,9 @@ func (r *rolloutCommand) patchRollout(client argov1alpha1.RolloutsGetter) error
return nil
}

// NewArgoRolloutsGetter creates a RolloutsGetter from Argo's v1alpha1 API.
func NewArgoRolloutsGetter() (argov1alpha1.RolloutsGetter, error) {
kubeConfig, err := newConfig()
kubeConfig, err := newK8sRestClient()
if err != nil {
return nil, err
}
Expand All @@ -95,7 +103,7 @@ func NewArgoRolloutsGetter() (argov1alpha1.RolloutsGetter, error) {
return argoClient, nil
}

func newConfig() (*rest.Config, error) {
func newK8sRestClient() (*rest.Config, error) {
config, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
clientcmd.NewDefaultClientConfigLoadingRules(),
&clientcmd.ConfigOverrides{},
Expand Down