-
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-47591] dynamic pvc workspace volume #600
Conversation
The interesting places where this gets used is
I guess you can ignore the volume name and set some random name. Or could add the podName to the arguments, so you can name the volume You would need to clean up the PVCs after the builds too, I think it would be possible to just set the owner reference in the PVC and let k8s delete the pvc when the pod is deleted There is a Jira at https://issues.jenkins-ci.org/browse/JENKINS-47591 |
Very useful guide, thanks! ! I will try it recently. |
...enkins/plugins/kubernetes/volumes/workspace/DynamicPersistentVolumeClaimWorkspaceVolume.java
Outdated
Show resolved
Hide resolved
1e48db9
to
3cd6e12
Compare
@runzexia the test can be guarded similarly to Lines 375 to 380 in 6e34b99
|
src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesLauncher.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/volumes/workspace/WorkspaceVolume.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/volumes/workspace/WorkspaceVolume.java
Outdated
Show resolved
Hide resolved
a3fac5b
to
a95068f
Compare
@Vlatombe |
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.
I added a guard block to skip the new test if the sa doesn't have the right to handle pvcs.
...nchez/jenkins/plugins/kubernetes/volumes/workspace/PersistentVolumeClaimWorkspaceVolume.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/volumes/workspace/NfsWorkspaceVolume.java
Outdated
Show resolved
Hide resolved
.../java/org/csanchez/jenkins/plugins/kubernetes/volumes/workspace/HostPathWorkspaceVolume.java
Outdated
Show resolved
Hide resolved
.../java/org/csanchez/jenkins/plugins/kubernetes/volumes/workspace/EmptyDirWorkspaceVolume.java
Outdated
Show resolved
Hide resolved
...ava/org/csanchez/jenkins/plugins/kubernetes/volumes/workspace/DynamicPVCWorkspaceVolume.java
Outdated
Show resolved
Hide resolved
src/test/resources/org/csanchez/jenkins/plugins/kubernetes/pipeline/dynamicPVC.groovy
Outdated
Show resolved
Hide resolved
Signed-off-by: runzexia <runzexia@yunify.com>
bbb71f8
to
7f12088
Compare
Please avoid force-pushes, it breaks incremental review. |
src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesLauncher.java
Outdated
Show resolved
Hide resolved
Ok, I will avoid this in the future. |
Signed-off-by: runzexia <runzexia@yunify.com>
Yes, I'll cut a release |
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.
LGTM.
@jglick any more comments?
Is there a way to configure RequestsSize and StorageClassName through the UI? I don't seem to be able to choose/enter those values when selecting the "Dynamic Persistent Volume Claim Workspace Volume". What would be needed to expose those two settings through the UI? Then for doing a PR for the jenkins helm chart to include those permissions in the RBAC setup, would it just be the resource "persistentvolumeclaims"? |
@runzexia Can you please double checked, if you did not forgot eg. to change the plugin version or something? Thank you :) |
@pavenova Please update your Jenkins instance, you probably have a core that is too old. We generally bump the required Jenkins core version when bumping the second digit (1.16 -> 1.17) |
Hello Vicent, thanks for the point, |
@pavenova Please refer to release notes for the required core version. Latest version of the plugin requires core |
Ahaah, got it, thank you :) |
I'm testing this new addition for Dynamic PVCs on 2.190.1, Kubernetes Plugin version 1.20.0, the PV and PVCs are properly being created and disappearing, but I'm seeing this when the container attempts to start:
I'm using Ceph RBD with a ReadWriteOnce and the mainline Jenkins Helm chart with JCasC 1.32. Wondering if this is mounting as "root" or something. Let me know if you need more info. Any thoughts? |
@austinReichert
in yaml |
Or just
|
Created a PR for the jenkins helm chart helm/charts#17973 |
@DonAndrey It says the size you provided is invalid. |
@DonAndrey nvm. Revert to an older version of the plugin until this is fixed. |
Thanks @Vlatombe ! |
I apologize for replying to this merged PR, but I could not find any method of contact for this repository and it seems like Issues are disabled. Is it possible to set workspaceVolume when using the yaml based podTemplate? I can't see how to set it using the declarative pipeline, and setting "workspaceVolume" doesn't seem to work. It throws an error when I set it in the kubernetes agent section and it is ignored when set in the yaml. Any advice as to what I am doing wrong? Neither of the two examples below work.
|
At the moment, it is only available in the The yaml syntax takes raw yaml that is passed directly to kubernetes, so it will never be supported with this method. |
As information for peoples interested in this feature without spend hours to looking what's going wrong.
this feature requires additionals permissions but does not specify which ones. After a long search I get the answer on OpenShift knowledge base (that you can see only with a suscription). I would suggest to add it in a help_...html file as tips or report into the README.MD dynamicPvc requires a new cluster role permission:
to bind to the service account of the namespace you are using for agent provisioning and
in addition to the "jenkins" (name used in every guide I found) Role binded to the same service account. I hope this will facilitate the use of this feature. In real I'm looking to use this feature keeping the PVC until the multi pipeline project branch job is removed instead to remove the pvc after the pod agent is cancelled (usually at the end of the build) |
Signed-off-by: runzexia runzexia@yunify.com
Add this kind of workspace volume because during use, we found that some IO-intensive tasks have some problems with the performance of emptyDir.
I want to use dynamic pvc to avoid this performance problem.
When I implemented this part, I found that the original WorkspaceVolume abstract class seems to be only suitable for static PVC.
So I want to find some comments about this part of the code, any comments are very grateful
@Vlatombe @jglick