-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPod-Power.ps1
More file actions
26 lines (26 loc) · 889 Bytes
/
Pod-Power.ps1
File metadata and controls
26 lines (26 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$json = Get-Content pods.json | ConvertFrom-Json
foreach ($pod in $json.pods) {
$manifest = @{
apiVersion = "v1"
kind = "Pod"
metadata = @{ name = $pod.name }
spec = @{
nodeSelector = @{ "kubernetes.io/os" = "windows" }
containers = @(
@{
name = $pod.name
image = $pod.image
ports = $pod.ports
env = $pod.env
volumeMounts = @(
@{ name = $pod.volumes[0].name; mountPath = $pod.volumes[0].hostPath.path }
)
}
)
volumes = @(
@{ name = $pod.volumes[0].name; hostPath = @{ path = $pod.volumes[0].hostPath.path } }
)
}
}
$manifest | ConvertTo-Json -Depth 10 | Out-File "$($pod.name).json"
}