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

Set exec timeout repo branch #1650

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

sarfarazgit
Copy link

What type of PR is this?

What does this PR do / why we need it:

Have you updated the necessary documentation?

  • Documentation update is required by this PR.
  • Documentation has been updated.

Which issue(s) this PR fixes:

Fixes #?

How to test changes / Special notes to the reviewer:

})

t.Run("ExecTimeout set", func(t *testing.T) {
logf.SetLogger(ZapLogger(true))
a := makeTestArgoCD()
timeout := 600
a.Spec.Repo.ExecTimeout = &timeout
timeout := "600m"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should it not be 600s ?

timeout := 600
a.Spec.Repo.ExecTimeout = &timeout
timeout := "600m"
a.Spec.Repo.ExecTimeout = timeout
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can do a direct assignment a.Spec.Repo.ExecTimeout = 600s

@@ -419,7 +419,7 @@ func TestReconcileArgoCD_reconcileRepoDeployment_env(t *testing.T) {

// Check that the env vars are set, Count is 2 because of the default REDIS_PASSWORD env var
assert.Len(t, deployment.Spec.Template.Spec.Containers[0].Env, 2)
assert.Contains(t, deployment.Spec.Template.Spec.Containers[0].Env, corev1.EnvVar{Name: "ARGOCD_EXEC_TIMEOUT", Value: "600s"})
assert.Contains(t, deployment.Spec.Template.Spec.Containers[0].Env, corev1.EnvVar{Name: "ARGOCD_EXEC_TIMEOUT", Value: "600m"})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's keep the same value as 600s instead of switching to minute.

@@ -1672,7 +1672,7 @@ spec:
type: object
type: array
execTimeout:
description: ExecTimeout specifies the timeout in seconds for
description: ExecTimeout specifies the timeout in minutes for
Copy link
Collaborator

Choose a reason for hiding this comment

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

It can be seconds, minutes or hours based on the suffix user provides. This description needs a change.

Copy link
Collaborator

@anandf anandf left a comment

Choose a reason for hiding this comment

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

Posted few minor comments.

@svghadi
Copy link
Collaborator

svghadi commented Jan 29, 2025

@anandf - What are you thoughts on this? To me, looks like a breaking change. Might result into upgrade failures for users who have this field set in their ArgoCD CR.

#1646 (comment)

There is a e2e test failure

    logger.go:42: 14:19:11 | 1-011_validate_repo_exec_timeout/2-change-exec-timeout | starting test step 2-change-exec-timeout
    case.go:254: failed in step 2-change-exec-timeout
    case.go:256: ArgoCD.argoproj.io "argocd" is invalid: [spec.repo.execTimeout: Invalid value: "integer": spec.repo.execTimeout in body must be of type string: "integer", <nil>: Invalid value: "null": some validation rules were not checked because the object was invalid; correct the existing errors to complete validation]

This appears to be a validation error. Changing the field type from int to string would result in a breaking change, so we’ll need to rethink our approach. Deprecating the field might be the best path forward, especially since the value can also be set via an environment variable.

Alternatively, we could continue supporting int and clarify through documentation that the field’s value is interpreted as seconds.

@sarfarazgit sarfarazgit force-pushed the Set_execTimeoutRepo_branch branch from 870a4bb to 3038f5b Compare January 29, 2025 12:25
@sarfarazgit sarfarazgit requested a review from anandf January 29, 2025 14:06
@@ -454,7 +454,7 @@ type ArgoCDRepoSpec struct {
Version string `json:"version,omitempty"`

// ExecTimeout specifies the timeout in seconds for tool execution
ExecTimeout *int `json:"execTimeout,omitempty"`
ExecTimeout string `json:"execTimeout,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

For including the validation, let's define an alias for string called Duration

// +kubebuilder:validation:Pattern:="^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$"
type Duration string

Detailed example can be found here. https://github.com/prometheus-operator/prometheus-operator/blob/dff3575c55ee9e6423907e4bfdcb5ac4b8fe9c89/pkg/apis/monitoring/v1/types.go#L45

@sarfarazgit sarfarazgit force-pushed the Set_execTimeoutRepo_branch branch from 923d0af to 5308b55 Compare February 4, 2025 08:55
@sarfarazgit sarfarazgit requested a review from anandf February 4, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants