File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ Param (
2+ [parameter (Mandatory = $true )]
3+ [string ] $containerName ,
4+
5+ [parameter (Mandatory = $true )]
6+ [string ] $namespace ,
7+
8+ [parameter (Mandatory = $true )]
9+ [string ] $image ,
10+
11+ [parameter (Mandatory = $true )]
12+ [string ] $command
13+ )
14+
15+ $contid = ' '
16+
17+ if ( $command -eq ' ADD' ) {
18+ $contid = (docker run - d -- name $containerName -- net= none $image powershell Start-Sleep - m 1000000 )
19+ $env: CNI_CONTAINERID = $contid
20+ $env: CNI_COMMAND = ' ADD'
21+ }
22+ else {
23+ $contid = (docker inspect -f ' {{ .Id }}' $containerName )
24+ $env: CNI_CONTAINERID = $contid
25+ $env: CNI_COMMAND = ' DEL'
26+ }
27+
28+ $env: CNI_NETNS = ' none'
29+ $env: CNI_PATH = ' C:\k\azurecni\bin'
30+ $env: PATH = " $env: CNI_PATH ;" + $env: PATH
31+ $k8sargs = ' IgnoreUnknown=1;K8S_POD_NAMESPACE={0};K8S_POD_NAME={1};K8S_POD_INFRA_CONTAINER_ID={2}' -f $namespace , $containerName , $contid
32+ $env: CNI_ARGS = $k8sargs
33+ $env: CNI_IFNAME = ' eth0'
34+
35+ $config = (jq- win64 ' .plugins[0]' C:\k\azurecni\netconf\10 - azure.conflist)
36+ $name = (jq- win64 - r ' .name' C:\k\azurecni\netconf\10 - azure.conflist)
37+ $config = (echo $config | jq- win64 -- arg name $name ' . + {name: $name}' )
38+ $cniVersion = (jq- win64 - r ' .cniVersion' C:\k\azurecni\netconf\10 - azure.conflist)
39+ $config = (echo $config | jq- win64 -- arg cniVersion $cniVersion ' . + {cniVersion: $cniVersion}' )
40+
41+ $res = (echo $config | azure- vnet)
42+
43+ echo $res
You can’t perform that action at this time.
0 commit comments