Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

none CNI: error if portmap plug-in is required but unavailable #8684

Merged
merged 1 commit into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/minikube/cni/flannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ limitations under the License.
package cni

import (
"os/exec"

"github.com/pkg/errors"
"k8s.io/minikube/pkg/minikube/config"
)

Expand Down Expand Up @@ -637,6 +640,12 @@ func (c Flannel) String() string {

// Apply enables the CNI
func (c Flannel) Apply(r Runner) error {
// Mostly applicable to the 'none' driver
_, err := r.RunCmd(exec.Command("stat", "/opt/cni/bin/portmap"))
if err != nil {
return errors.Wrap(err, "required 'portmap' CNI plug-in not found")
}

return applyManifest(c.cc, r, manifestAsset([]byte(flannelTmpl)))
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/minikube/cni/kindnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package cni

import (
"bytes"
"os/exec"
"text/template"

"github.com/pkg/errors"
Expand Down Expand Up @@ -168,6 +169,12 @@ func (c KindNet) manifest() (assets.CopyableFile, error) {

// Apply enables the CNI
func (c KindNet) Apply(r Runner) error {
// This is mostly applicable to the 'none' driver
_, err := r.RunCmd(exec.Command("stat", "/opt/cni/bin/portmap"))
medyagh marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return errors.Wrap(err, "required 'portmap' CNI plug-in not found")
}

m, err := c.manifest()
if err != nil {
return errors.Wrap(err, "manifest")
Expand Down
11 changes: 10 additions & 1 deletion test/integration/net_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,16 @@ func TestNetworkPlugins(t *testing.T) {
}
if !t.Failed() {
t.Run("KubeletFlags", func(t *testing.T) {
rr, err := Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "pgrep -a kubelet"))
var rr *RunResult
var err error

// none does not support 'minikube ssh'
if NoneDriver() {
rr, err = Run(t, exec.CommandContext(ctx, "pgrep", "-a", "kubelet"))
} else {
rr, err = Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "pgrep -a kubelet"))
}

if err != nil {
t.Fatalf("ssh failed: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update this message. since it is not SSH in none

}
Expand Down