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 (31 loc) • 765 B
JavaScript
const { AbstractPodMountPatcher } = require('./abstractPodMountPatcher.cjs');
class PodMountSecretPatcher extends AbstractPodMountPatcher {
/**
*
* @param {string} secretName
* @param {string|undefined} volumeName
* @param {string|undefined} mountPath
*/
constructor(secretName, volumeName, mountPath) {
super(volumeName ?? secretName, mountPath);
this.secretName = secretName;
}
/**
*
* @param {import("@kubernetes/client-node").KubernetesObject} obj
*/
patch(obj) {
super.patch(obj);
const pod = obj;
pod.spec.volumes.push({
name: this.volumeName,
secret: {
secretName: this.secretName,
defaultMode: 0o444,
},
});
}
}
module.exports = {
PodMountSecretPatcher,
};