summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-05 10:10:16 -0400
committerGitHub <noreply@github.com>2021-05-05 10:10:16 -0400
commit120e1b78ef28e9220337423ea3e11486c813aa55 (patch)
tree991d631d237a4a6c38e6452150ee73e633fb09a0 /cmd/podman
parenta278195af3423f882c1f5bb218792f7c2ce10a3c (diff)
parentfb7d16c7a841bbe2c02cb97b2820334b617e7f44 (diff)
downloadpodman-120e1b78ef28e9220337423ea3e11486c813aa55.tar.gz
podman-120e1b78ef28e9220337423ea3e11486c813aa55.tar.bz2
podman-120e1b78ef28e9220337423ea3e11486c813aa55.zip
Merge pull request #10208 from Luap99/play-kube-mac
add --mac-address to podman play kube
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/play/kube.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index 30d6d86f0..fe382bdfb 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -2,6 +2,7 @@ package pods
import (
"fmt"
+ "net"
"os"
"github.com/containers/common/pkg/auth"
@@ -27,6 +28,7 @@ type playKubeOptionsWrapper struct {
}
var (
+ macs []string
// https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/
defaultSeccompRoot = "/var/lib/kubelet/seccomp"
kubeOptions = playKubeOptionsWrapper{}
@@ -61,6 +63,10 @@ func init() {
flags.StringVar(&kubeOptions.CredentialsCLI, credsFlagName, "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
_ = kubeCmd.RegisterFlagCompletionFunc(credsFlagName, completion.AutocompleteNone)
+ staticMACFlagName := "mac-address"
+ flags.StringSliceVar(&macs, staticMACFlagName, nil, "Static MAC addresses to assign to the pods")
+ _ = kubeCmd.RegisterFlagCompletionFunc(staticMACFlagName, completion.AutocompleteNone)
+
networkFlagName := "network"
flags.StringVar(&kubeOptions.Network, networkFlagName, "", "Connect pod to CNI network(s)")
_ = kubeCmd.RegisterFlagCompletionFunc(networkFlagName, common.AutocompleteNetworkFlag)
@@ -128,6 +134,15 @@ func kube(cmd *cobra.Command, args []string) error {
if yamlfile == "-" {
yamlfile = "/dev/stdin"
}
+
+ for _, mac := range macs {
+ m, err := net.ParseMAC(mac)
+ if err != nil {
+ return err
+ }
+ kubeOptions.StaticMACs = append(kubeOptions.StaticMACs, m)
+ }
+
report, err := registry.ContainerEngine().PlayKube(registry.GetContext(), yamlfile, kubeOptions.PlayKubeOptions)
if err != nil {
return err