UNPKG

k8s-features

Version:

A Cucumber-js base library for Kubernetes Gherkin tests, with base world class, basic steps, reusable utility functions and k8s client

36 lines (30 loc) 728 B
const { AbstractPodMountPatcher } = require('./abstractPodMountPatcher.cjs'); class PodMountPvcPatcher extends AbstractPodMountPatcher { /** * * @param {string} pvcName * @param {string|undefined} volumeName * @param {string|undefined} mountPath */ constructor(pvcName, volumeName, mountPath) { super(volumeName ?? pvcName, mountPath); this.pvcName = pvcName; } /** * * @param {import("@kubernetes/client-node").KubernetesObject} obj */ patch(obj) { super.patch(obj); const pod = obj; pod.spec.volumes.push({ name: this.volumeName, persistentVolumeClaim: { claimName: this.pvcName, }, }); } } module.exports = { PodMountPvcPatcher, };