-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[JENKINS-74992] Print relevant pod status changes in build logs #1627
Conversation
Spotless issues |
src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesLauncher.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesLauncher.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/watch/PodStatusEventHandler.java
Outdated
Show resolved
Hide resolved
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.
This is moving nicely!
* namespace -> informer | ||
* Use to watch pod events per namespace. | ||
*/ | ||
private transient Map<String, SharedIndexInformer<Pod>> informers = new ConcurrentHashMap<>(); |
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.
Need to be careful on what would happen to these informers if/when a KubernetesCloud
gets removed.
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.
AFAICT the informers
map would be unreachable and it would be garbage collected, so the DefaultSharedIndexInformer
would be collected too and with it the informerExecutor
(each instance has an executor), so the resync would stop happening (I've checked it actually stops reporting events).
src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesLauncher.java
Outdated
Show resolved
Hide resolved
// register a namespace informer (if not registered yet) to show relevant pod events in build logs | ||
cloud.registerPodInformer(node, client, namespace); |
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.
What would happen on controller restart ? Do we care about re-attaching existing nodes or do we only care about new nodes? I guess events are mostly relevant on agent initialization but just to be sure...
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.
Good point. I think once the pod is running and containers ready, these pod events are less interesting (actually there are usually no events until the pod is deleted).
IMO we can live without this, until it proves to be needed.
src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesCloud.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesCloud.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesCloud.java
Outdated
Show resolved
Hide resolved
* Informer register logic moved to Kubernetes cloud * Create a new client connection instead of reusing one * Log the cloud name
…nto JENKINS-74992
Interactive testing:
I see same events multiple times, can we avoid them? |
Those are pod |
The
This is what the client library is giving us. I can try to make it up on our side by ignoring the |
Workaround applied. Output now:
|
The PR title is potentially misleading. This PR is only listing changes to values to some kubectl events --for pod/$name --watch which would potentially print interesting things in various unusual configurations, for example if there are special controllers running that interact with the agent pod to do something, such as provision ephemeral volumes. |
OK. Title updated (here, in released notes and Jira). |
JENKINS-74992
Testing done
Submitter checklist