-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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(executor): Wait for termination using pod watch for PNS and K8SAPI executors. #4253
Merged
Merged
Changes from all commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
a02ca40
pod-watch
alexec c2fdd9a
feat(executor): Wait for termination using pod watch for PNS and K8SA…
alexec 0714866
pod-watch
alexec ef1da0e
ok
alexec ae7f695
ok
alexec 2e19290
pod-watch
alexec 1dada9c
pod-watch
alexec 2293d20
pod-watch
alexec e9a8e1c
redundant check
alexec 1c1b591
pod-watch
alexec 3a4f2c6
pod-watch
alexec 143fdc3
pod-watch
alexec 9c20176
pod-watch
alexec 4463e3f
trigger
alexec e0bb766
pod-watch
alexec d271b49
pod-watch
alexec df4d87c
pod-watch
alexec 0d98c8c
pod-watch
alexec 84fdaee
pod-watch
alexec 0076855
pod-watch
alexec 7ad9e55
pod-watch
alexec 8c8aaf0
pod-watch
alexec 4e276c3
pod-watch
alexec 7da8a8e
pod-watch
alexec c7057db
pod-watch
alexec c9ab875
pod-watch
alexec d91280d
Merge branch 'master' into pod-watch
alexec 5e0b9ea
pod-watch
alexec f0f0cfa
ok
alexec 18662af
Merge branch 'master' into pod-watch
alexec 2d5dc03
pod-watch
alexec 211a6f0
ok
alexec 69795ec
Merge branch 'master' into pod-watch
alexec 84bf5bc
pod-watch
alexec cf079c7
pod-watch
alexec 6ba8e43
fix + tidy up
alexec 095820a
fix test
alexec af25935
revert
alexec 760f998
fix test
alexec fa2bb04
simplify test
alexec 7601f16
revert
alexec 2769145
v2
alexec 84ce095
pod-watch
alexec 69a8b26
pod-watch
alexec 5b97a6e
pod-watch
alexec 83b8ae5
pod-watch
alexec 4c079a8
pod-watch
alexec be22057
Merge branch 'master' into pod-watch
alexec f48a450
pod-watch
alexec 4cfabef
pod-watch
alexec b326d7e
Merge branch 'master' into pod-watch
alexec f15846f
Merge branch 'master' into pod-watch
alexec 50a8dc7
Merge branch 'master' into pod-watch
alexec 87eacb2
pod-watch
alexec d778686
Update smoke_test.go
alexec 340577c
Merge branch 'master' into pod-watch
alexec 0782c60
Merge branch 'master' into pod-watch
alexec d1eaffe
Merge branch 'pod-watch' of github.com:alexec/argo into pod-watch
alexec d7805c4
Merge branch 'master' into pod-watch
alexec 62d777f
pod-watch
alexec 2aac204
Revert "pod-watch"
alexec 3297684
pod-watch
alexec b5b6eac
pod-watch
alexec 1e2e3de
pod-watch
alexec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: runasnonroot- | ||
labels: | ||
argo-e2e: true | ||
spec: | ||
entrypoint: main | ||
securityContext: | ||
runAsNonRoot: true | ||
runAsUser: 8737 | ||
templates: | ||
- name: main | ||
container: | ||
image: argoproj/argosay:v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package wait | ||
|
||
import ( | ||
"fmt" | ||
|
||
log "github.com/sirupsen/logrus" | ||
corev1 "k8s.io/api/core/v1" | ||
apierrors "k8s.io/apimachinery/pkg/api/errors" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/client-go/kubernetes" | ||
v1 "k8s.io/client-go/kubernetes/typed/core/v1" | ||
|
||
"github.com/argoproj/argo/workflow/executor/common" | ||
) | ||
|
||
func UntilTerminated(kubernetesInterface kubernetes.Interface, namespace, podName, containerID string) error { | ||
log.Infof("Waiting for container %s to be terminated", containerID) | ||
podInterface := kubernetesInterface.CoreV1().Pods(namespace) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this idea. It is safer than earlier |
||
listOptions := metav1.ListOptions{FieldSelector: "metadata.name=" + podName} | ||
for { | ||
done, err := untilTerminatedAux(podInterface, containerID, listOptions) | ||
if done { | ||
return err | ||
} | ||
} | ||
} | ||
|
||
func untilTerminatedAux(podInterface v1.PodInterface, containerID string, listOptions metav1.ListOptions) (bool, error) { | ||
w, err := podInterface.Watch(listOptions) | ||
if err != nil { | ||
return true, fmt.Errorf("could not watch pod: %w", err) | ||
} | ||
defer w.Stop() | ||
for event := range w.ResultChan() { | ||
pod, ok := event.Object.(*corev1.Pod) | ||
if !ok { | ||
return false, apierrors.FromObject(event.Object) | ||
} | ||
for _, s := range pod.Status.ContainerStatuses { | ||
if common.GetContainerID(&s) == containerID && s.State.Terminated != nil { | ||
return true, nil | ||
} | ||
} | ||
listOptions.ResourceVersion = pod.ResourceVersion | ||
} | ||
return true, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
security fix for our actions