forked from k3s-io/k3s
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sean Yen <[email protected]>
- Loading branch information
1 parent
1f3880c
commit d49c099
Showing
22 changed files
with
465 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//go:build linux | ||
// +build linux | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
const programPostfix = "" | ||
|
||
func runExec(cmd string, args []string, calledAsInternal bool) (err error) { | ||
if err := syscall.Exec(cmd, args, os.Environ()); err != nil { | ||
return errors.Wrapf(err, "exec %s failed", cmd) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
) | ||
|
||
const programPostfix = ".exe" | ||
|
||
func runExec(cmd string, args []string, calledAsInternal bool) (err error) { | ||
// syscall.Exec: not supported by windows | ||
if calledAsInternal { | ||
args = args[1:] | ||
} | ||
cmdObj := exec.Command(cmd, args...) | ||
cmdObj.Stdout = os.Stdout | ||
cmdObj.Stderr = os.Stderr | ||
cmdObj.Stdin = os.Stdin | ||
cmdObj.Env = os.Environ() | ||
return cmdObj.Run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//go:build linux | ||
// +build linux | ||
|
||
package flannel | ||
|
||
const ( | ||
cniConf = `{ | ||
"name":"cbr0", | ||
"cniVersion":"1.0.0", | ||
"plugins":[ | ||
{ | ||
"type":"flannel", | ||
"delegate":{ | ||
"hairpinMode":true, | ||
"forceAddress":true, | ||
"isDefaultGateway":true | ||
} | ||
}, | ||
{ | ||
"type":"portmap", | ||
"capabilities":{ | ||
"portMappings":true | ||
} | ||
}, | ||
{ | ||
"type":"bandwidth", | ||
"capabilities":{ | ||
"bandwidth":true | ||
} | ||
} | ||
] | ||
} | ||
` | ||
|
||
vxlanBackend = `{ | ||
"Type": "vxlan" | ||
}` | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package flannel | ||
|
||
const ( | ||
cniConf = `{ | ||
"name":"flannel.4096", | ||
"cniVersion":"1.0.0", | ||
"plugins":[ | ||
{ | ||
"type":"flannel", | ||
"capabilities": { | ||
"portMappings": true, | ||
"dns": true | ||
}, | ||
"delegate": { | ||
"type": "win-overlay", | ||
"apiVersion": 2, | ||
"Policies": [{ | ||
"Name": "EndpointPolicy", | ||
"Value": { | ||
"Type": "OutBoundNAT", | ||
"Settings": { | ||
"Exceptions": [ | ||
"%CLUSTER_CIDR%", "%SERVICE_CIDR%" | ||
] | ||
} | ||
} | ||
}, { | ||
"Name": "EndpointPolicy", | ||
"Value": { | ||
"Type": "SDNRoute", | ||
"Settings": { | ||
"DestinationPrefix": "%SERVICE_CIDR%", | ||
"NeedEncap": true | ||
} | ||
} | ||
}, { | ||
"name": "EndpointPolicy", | ||
"value": { | ||
"Type": "ProviderAddress", | ||
"Settings": { | ||
"ProviderAddress": "%IPV4_ADDRESS%" | ||
} | ||
} | ||
}] | ||
} | ||
} | ||
] | ||
} | ||
` | ||
|
||
vxlanBackend = `{ | ||
"Type": "vxlan", | ||
"VNI": 4096, | ||
"Port": 4789 | ||
}` | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
package crictl | ||
|
||
import ( | ||
"os" | ||
"runtime" | ||
|
||
"github.com/kubernetes-sigs/cri-tools/cmd/crictl" | ||
"github.com/urfave/cli" | ||
) | ||
|
||
func Run(ctx *cli.Context) error { | ||
if runtime.GOOS == "windows" { | ||
os.Args = os.Args[1:] | ||
} | ||
crictl.Main() | ||
return nil | ||
} |
File renamed without changes.
Oops, something went wrong.