new pv for each pod

This commit is contained in:
Thomas Boop
2022-06-06 14:15:14 -04:00
parent bd7e053180
commit 55c9198ada

View File

@@ -25,8 +25,15 @@ export class TestHelper {
process.env['ACTIONS_RUNNER_KUBERNETES_NAMESPACE'] = 'default' process.env['ACTIONS_RUNNER_KUBERNETES_NAMESPACE'] = 'default'
await this.cleanupK8sResources() await this.cleanupK8sResources()
try
{
await this.createTestVolume() await this.createTestVolume()
await this.createTestJobPod() await this.createTestJobPod()
}
catch
{
}
fs.mkdirSync(`${this.tempDirPath}/work/repo/repo`, { recursive: true }) fs.mkdirSync(`${this.tempDirPath}/work/repo/repo`, { recursive: true })
fs.mkdirSync(`${this.tempDirPath}/externals`, { recursive: true }) fs.mkdirSync(`${this.tempDirPath}/externals`, { recursive: true })
} }
@@ -47,7 +54,7 @@ export class TestHelper {
0 0
) )
.catch(e => {}) .catch(e => {})
await k8sApi.deletePersistentVolume('work').catch(e => {}) await k8sApi.deletePersistentVolume(`${this.podName}-pv`).catch(e => {})
await k8sStorageApi.deleteStorageClass('local-storage').catch(e => {}) await k8sStorageApi.deleteStorageClass('local-storage').catch(e => {})
await k8sApi await k8sApi
.deleteNamespacedPod(this.podName, 'default', undefined, undefined, 0) .deleteNamespacedPod(this.podName, 'default', undefined, undefined, 0)
@@ -104,7 +111,7 @@ export class TestHelper {
var volume: k8s.V1PersistentVolume = { var volume: k8s.V1PersistentVolume = {
metadata: { metadata: {
name: 'work' name: `${this.podName}-pv`
}, },
spec: { spec: {
storageClassName: 'local-storage', storageClassName: 'local-storage',
@@ -127,7 +134,7 @@ export class TestHelper {
accessModes: ['ReadWriteOnce'], accessModes: ['ReadWriteOnce'],
volumeMode: 'Filesystem', volumeMode: 'Filesystem',
storageClassName: 'local-storage', storageClassName: 'local-storage',
volumeName: 'work', volumeName: `${this.podName}-pv`,
resources: { resources: {
requests: { requests: {
storage: '1Gi' storage: '1Gi'