Vidya reddy/prettier code (#203)

This commit is contained in:
Vidya
2022-06-24 13:57:45 -07:00
committed by GitHub
parent 976c5c4981
commit dcd9bc6b1a
71 changed files with 16044 additions and 15876 deletions
+35 -31
View File
@@ -1,44 +1,48 @@
import { KubernetesWorkload } from "../types/kubernetesTypes";
import {KubernetesWorkload} from '../types/kubernetesTypes'
export function getImagePullSecrets(inputObject: any) {
if (!inputObject?.spec) return null;
if (!inputObject?.spec) return null
if (
inputObject.kind.toLowerCase() === KubernetesWorkload.CRON_JOB.toLowerCase()
)
return inputObject?.spec?.jobTemplate?.spec?.template?.spec
?.imagePullSecrets;
if (
inputObject.kind.toLowerCase() ===
KubernetesWorkload.CRON_JOB.toLowerCase()
)
return inputObject?.spec?.jobTemplate?.spec?.template?.spec
?.imagePullSecrets
if (inputObject.kind.toLowerCase() === KubernetesWorkload.POD.toLowerCase())
return inputObject.spec.imagePullSecrets;
if (inputObject.kind.toLowerCase() === KubernetesWorkload.POD.toLowerCase())
return inputObject.spec.imagePullSecrets
if (inputObject?.spec?.template?.spec) {
return inputObject.spec.template.spec.imagePullSecrets;
}
if (inputObject?.spec?.template?.spec) {
return inputObject.spec.template.spec.imagePullSecrets
}
}
export function setImagePullSecrets(
inputObject: any,
newImagePullSecrets: any
inputObject: any,
newImagePullSecrets: any
) {
if (!inputObject || !inputObject.spec || !newImagePullSecrets) return;
if (!inputObject || !inputObject.spec || !newImagePullSecrets) return
if (inputObject.kind.toLowerCase() === KubernetesWorkload.POD.toLowerCase()) {
inputObject.spec.imagePullSecrets = newImagePullSecrets;
return;
}
if (
inputObject.kind.toLowerCase() === KubernetesWorkload.POD.toLowerCase()
) {
inputObject.spec.imagePullSecrets = newImagePullSecrets
return
}
if (
inputObject.kind.toLowerCase() === KubernetesWorkload.CRON_JOB.toLowerCase()
) {
if (inputObject?.spec?.jobTemplate?.spec?.template?.spec)
inputObject.spec.jobTemplate.spec.template.spec.imagePullSecrets =
newImagePullSecrets;
return;
}
if (
inputObject.kind.toLowerCase() ===
KubernetesWorkload.CRON_JOB.toLowerCase()
) {
if (inputObject?.spec?.jobTemplate?.spec?.template?.spec)
inputObject.spec.jobTemplate.spec.template.spec.imagePullSecrets =
newImagePullSecrets
return
}
if (inputObject?.spec?.template?.spec) {
inputObject.spec.template.spec.imagePullSecrets = newImagePullSecrets;
return;
}
if (inputObject?.spec?.template?.spec) {
inputObject.spec.template.spec.imagePullSecrets = newImagePullSecrets
return
}
}