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

Timeout in sync from rest api #19815

Open
HiddenTesla opened this issue Sep 6, 2024 · 4 comments
Open

Timeout in sync from rest api #19815

HiddenTesla opened this issue Sep 6, 2024 · 4 comments
Labels
component:api API bugs and enhancements component:cli Affects the Argo CD CLI component:sync enhancement New feature or request

Comments

@HiddenTesla
Copy link

Summary

How to set timeout in app sync?
This seems doable from CLI, as the argocd app sync --help says:

      --timeout uint                          Time out after this many seconds

However, swagger-ui /swagger-ui#operation/ApplicationService_Sync does not mention it.
I have gone through all expandable items but do not find timeout.
image

Motivation

To void sync takes too long.

Proposal

This may be a question rather than an enhancement. But I do not find where to ask questions.

@HiddenTesla HiddenTesla added the enhancement New feature or request label Sep 6, 2024
@pasha-codefresh pasha-codefresh added component:api API bugs and enhancements component:cli Affects the Argo CD CLI component:sync labels Sep 7, 2024
@HiddenTesla
Copy link
Author

Hi do we have a quick anwser if this is available now or needs implementing?

@nitishfy
Copy link
Contributor

you need to pass an argument to the -timeout flag, something like

> argocd app sync app1 --timeout 2

TIMESTAMP                  GROUP        KIND   NAMESPACE                  NAME    STATUS   HEALTH        HOOK  MESSAGE
2024-09-10T17:25:11+05:30   apps  Deployment        app1                  app1    Synced  Healthy              

This is the state of the app after `wait` timed out:

@HiddenTesla
Copy link
Author

HiddenTesla commented Sep 14, 2024

you need to pass an argument to the -timeout flag, something like

> argocd app sync app1 --timeout 2

TIMESTAMP                  GROUP        KIND   NAMESPACE                  NAME    STATUS   HEALTH        HOOK  MESSAGE
2024-09-10T17:25:11+05:30   apps  Deployment        app1                  app1    Synced  Healthy              

This is the state of the app after `wait` timed out:

Yes --timeout works for cli, but I wonder if there is an equivalent option for its rest api.

@eugene70
Copy link
Contributor

@HiddenTesla,

cmd/argocd/commands/app.go-func NewApplicationSyncCommand

_, err = appIf.Sync(ctx, &syncReq)
errors.CheckError(err)

if !async {
	app, opState, err := waitOnApplicationStatus(ctx, acdClient, appQualifiedName, timeout, watchOpts{operation: true}, selectedResources, output)

Calling the API from the CLI appears to be asynchronous behaviour.
It's just that after calling the API from the CLI, the CLI waits for a TIMEOUT for the state to change; there is no TIMEOUT because the API itself is asynchronous.
If you plan to call the API directly, it would make sense to implement TIMEOUT in the CLIENT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:api API bugs and enhancements component:cli Affects the Argo CD CLI component:sync enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants