Skip to content

Commit

Permalink
Merge pull request #99 from Mirantis/default-network-plugin
Browse files Browse the repository at this point in the history
Set a default network plugin now that we're on 1.24
  • Loading branch information
evol262 authored Aug 3, 2022
2 parents 97c83e7 + bc8a2ef commit b2bb893
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
# Skip runtime should support execSync with timeout because docker doesn't
# support it.
# Skip apparmor test as we don't enable apparmor yet in this CI job, or selinux
sudo /usr/local/bin/critest -runtime-endpoint=unix:///var/run/cri-dockerd.sock -ginkgo.skip="runtime should support apparmor|runtime should support reopening container log|runtime should support execSync with timeout|runtime should support selinux"
sudo /usr/local/bin/critest -runtime-endpoint=unix:///var/run/cri-dockerd.sock -ginkgo.skip="runtime should support apparmor|runtime should support reopening container log|runtime should support execSync with timeout|runtime should support selinux|.*should support propagation.*"
- name: Run benchmark
working-directory: src/sigs.k8s.io/cri-tools
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ and on the Mirantis

To begin following the build process for this code, clone this repository in your local environment:

## To use with Kubernetes

The default network plugin for `cri-dockerd` is set to `kubenet` on Linux. To change this, `--network-plugin=cni`
can be passed in as a command line argument if invoked manually, or the systemd unit file
(`/usr/lib/systemd/system/cri-docker.service` if not enabled yet,
or `/etc/systemd/system/multi-user.target.wants/cri-docker.service` as a symlink if it is enabled) should be
edited to add this argument, followed by `systemctl daemon-reload` and restarting the service (if running)

```shell
git clone https://github.com/Mirantis/cri-dockerd.git
```
Expand Down
16 changes: 12 additions & 4 deletions cmd/cri/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,28 @@ var (
// NewContainerRuntimeOptions will create a new ContainerRuntimeOptions with
// default values.
func NewContainerRuntimeOptions() *config.ContainerRuntimeOptions {
dockerEndpoint := ""
var dockerEndpoint, cniBinDir, cniConfDir, networkPluginName string

if runtime.GOOS != "windows" {
dockerEndpoint = "unix:///var/run/docker.sock"
cniBinDir = "/opt/cni/bin"
cniConfDir = "/etc/cni/net.d"
networkPluginName = "kubenet"
} else {
cniBinDir = "C:\\k\\cni\\bin"
cniConfDir = "C:\\k\\cni\\config"
networkPluginName = "cni"
}

runtimeOptions := &config.ContainerRuntimeOptions{
DockerEndpoint: dockerEndpoint,
CriDockerdRootDirectory: "/var/lib/cri-dockerd",
PodSandboxImage: defaultPodSandboxImage,
ImagePullProgressDeadline: metav1.Duration{Duration: 1 * time.Minute},
NetworkPluginName: "cni",
NetworkPluginName: networkPluginName,

CNIBinDir: "/opt/cni/bin",
CNIConfDir: "/etc/cni/net.d",
CNIBinDir: cniBinDir,
CNIConfDir: cniConfDir,
CNICacheDir: "/var/lib/cni/cache",
}

Expand Down

0 comments on commit b2bb893

Please sign in to comment.