-
Notifications
You must be signed in to change notification settings - Fork 9
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(k8s): Make RunContainer detect/report more error conditions like image pull errors #331
Draft
cognifloyd
wants to merge
32
commits into
go-vela:main
Choose a base branch
from
cognifloyd:k8s-events
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
2929949
feat(k8s): add eventInformer to podTracker
cognifloyd be144f4
feat(k8s): ignore event deletion
cognifloyd 7602600
feat(k8s): begin handling event stream
cognifloyd 457a664
refactor: create eventInformer from eventInformerFactory
cognifloyd 7d674e8
refactor: rename selector=>labelSelector
cognifloyd 71c9b34
enhance: register eventInformerFactory on podTracker
cognifloyd c3e4b50
enhance: add podTracker.inspectContainerEvent
cognifloyd 3e89df6
enhance: add signal for running container
cognifloyd 8ba7ad5
enhance: only mark containers as running/terminated if it is the corr…
cognifloyd 038bf97
enhance(k8s): exit WaitContainer if build is canceled
cognifloyd b5ab8eb
enhance(k8s): add containerTracker.Events() function
cognifloyd 57011c1
tests: fix inspectContainerStatuses test
cognifloyd 639b219
bugfix(k8s): Make sure image pull errors are detected
cognifloyd 092840b
refactor(k8s): use channels to signal imagePull success/errors
cognifloyd e3d6d93
fix: comment typos
cognifloyd aa1078e
enhance: capture ImagePull errors from ContainerStatuses as well
cognifloyd 9c64abd
enhance(k8s): handle more image pull event types
cognifloyd 9686c23
tests(k8s): fix tests for RunContainer
cognifloyd dd189e0
tests(k8s): test RunContainer and WaitContainer with canceled build
cognifloyd ca14e32
tests(k8s): test AssembleBuild with canceled build
cognifloyd 2a6d109
tests(k8s): test RunContainer with PodTracker failure (increase cover…
cognifloyd 08c219c
tests(k8s): test inspectContainerStatuses with Running or ImagePullError
cognifloyd 40da3f8
chore: prune some comments
cognifloyd 4726072
tests: fix inspectContainerStatuses test with an errgroup
cognifloyd 0d2f315
tests: test RunContainer with an ImagePullError
cognifloyd ccf9fb2
tests: test getTrackedPodEvent
cognifloyd f76339d
tests: test podTracker.HandleEventAdd, podTracker.HandleEventUpdate
cognifloyd e6876d1
refactor: drop unused Events function
cognifloyd ecceeac
tests: test inspectContainerEvent image pull events
cognifloyd b945f33
tests: test inspectContainerEvent edge cases
cognifloyd 9ec81fa
tests: test more pull policies in SetupContainer
cognifloyd 65cbe59
chore: delete dead code.
cognifloyd 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
Oops, something went wrong.
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.
Would it make sense to just use their constants or wrap them at least so we know when they change?
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.
They have not packaged the code so that it can be used externally.
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/events/event.go
If I do
go get github.com/kubernetes/kubernetes
I get an errormodule declares its path as: k8s.io/kubernetes
If I do
go get k8s.io/kubernetes
I get an error thatk8s.io/[email protected] requires k8s.io/[email protected]: reading k8s.io/api/go.mod at revision v0.0.0: unknown revision v0.0.0
They seem to carefully curate what can be imported by external projects, so we can't import this.
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.
Cool, just checking. I just noticed when I went to the code they were public on the package. So, thought they might be importable.
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.
Thought I'd provide a bit of clarity on this subject...
The tl;dr is you can vendor from
k8s.io/kubernetes
but its not pretty or straightforward 😅Here's the reason why
go get k8s.io/kubernetes
fails:kubernetes/kubernetes#79384 (comment)
And to actually vendor from
k8s.io/kubernetes
, you have to add areplace
directive for all nested packages:kubernetes/kubernetes#79384 (comment)
If we want, there are people who've scripted the approach to this so updating the version is easier:
kubernetes/kubernetes#79384 (comment)
To see a real world example of what this looks like in the
go.mod
file:https://github.com/kubernetes-sigs/cloud-provider-huaweicloud/blob/9589bc854c29e399476479f9c5aa9599b2064da5/go.mod#L18-L40
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.
Eww... All that work just to reuse some constants... Not worth it imo.
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.
Agreed 😄