How to use the @kubernetes/client-node.V1PersistentVolumeClaimSpec function in @kubernetes/client-node

To help you get started, we’ve selected a few @kubernetes/client-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brigadecore / brigade / brigade-worker / src / k8s.ts View on Github external
protected buildPVC(size: string): kubernetes.V1PersistentVolumeClaim {
    let s = new kubernetes.V1PersistentVolumeClaim();
    s.metadata = new kubernetes.V1ObjectMeta();
    s.metadata.name = this.name;
    s.metadata.labels = {
      heritage: "brigade",
      component: "buildStorage",
      project: this.proj.id,
      worker: this.name,
      build: this.build
    };

    s.spec = new kubernetes.V1PersistentVolumeClaimSpec();
    s.spec.accessModes = ["ReadWriteMany"];

    let res = new kubernetes.V1ResourceRequirements();
    res.requests = { storage: size };
    s.spec.resources = res;
    if (this.proj.kubernetes.buildStorageClass.length > 0) {
      s.spec.storageClassName = this.proj.kubernetes.buildStorageClass;
    } else if (
      this.options.defaultBuildStorageClass &&
      this.options.defaultBuildStorageClass.length > 0
    ) {
      s.spec.storageClassName = this.options.defaultBuildStorageClass;
    }
    return s;
  }
}
github brigadecore / brigade / brigade-worker / src / k8s.ts View on Github external
protected cachePVC(): kubernetes.V1PersistentVolumeClaim {
    let s = new kubernetes.V1PersistentVolumeClaim();
    s.metadata = new kubernetes.V1ObjectMeta();
    s.metadata.name = this.cacheName();
    s.metadata.labels = {
      heritage: "brigade",
      component: "jobCache",
      job: this.job.name,
      project: this.project.id
    };

    s.spec = new kubernetes.V1PersistentVolumeClaimSpec();
    s.spec.accessModes = ["ReadWriteMany"];
    if (
      this.project.kubernetes.cacheStorageClass &&
      this.project.kubernetes.cacheStorageClass.length > 0
    ) {
      s.spec.storageClassName = this.project.kubernetes.cacheStorageClass;
    } else if (
      this.options.defaultCacheStorageClass &&
      this.options.defaultCacheStorageClass.length > 0
    ) {
      s.spec.storageClassName = this.options.defaultCacheStorageClass;
    }
    let res = new kubernetes.V1ResourceRequirements();
    res.requests = { storage: this.job.cache.size };
    s.spec.resources = res;
github che-incubator / chectl / src / commands / devfile / generate.ts View on Github external
k8sPVCsList.items.forEach(async item => {
      let pvc = new V1PersistentVolumeClaim()
      pvc.kind = 'PersistentVolumeClaim'
      pvc.apiVersion = 'v1'
      pvc.metadata = new V1ObjectMeta()
      pvc.metadata.labels = { ...item.metadata!.labels }
      pvc.metadata.name = item.metadata!.name
      pvc.spec = new V1PersistentVolumeClaimSpec()
      pvc.spec.accessModes = item.spec!.accessModes
      pvc.spec.resources = item.spec!.resources
      await items.push(pvc)
    })