Skip to content

Commit

Permalink
cni: add supported & unsupported plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbw committed Jan 24, 2019
1 parent dce9eaf commit b6047c4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 16 deletions.
19 changes: 19 additions & 0 deletions bindata/network/multus/multus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,25 @@ spec:
tolerations:
- operator: Exists
serviceAccountName: multus
initContainers:
- name: cni-plugins-supported
image: {{.CNIPluginsSupportedImage}}
command: ["/bin/sh"]
args: ["-c", "cp -rf /usr/src/plugins/bin/* /host/opt/cni/bin"]
securityContext:
privileged: true
volumeMounts:
- mountPath: /host/opt/cni/bin
name: cnibin
- name: cni-plugins-unsupported
image: {{.CNIPluginsUnsupportedImage}}
command: ["/bin/sh"]
args: ["-c", "cp -rf /usr/src/plugins/bin/* /host/opt/cni/bin"]
securityContext:
privileged: true
volumeMounts:
- mountPath: /host/opt/cni/bin
name: cnibin
containers:
- name: kube-multus
image: {{.MultusImage}}
Expand Down
4 changes: 4 additions & 0 deletions manifests/0000_07_cluster-network-operator_03_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ spec:
value: "docker.io/openshift/origin-hypershift:v4.0.0"
- name: MULTUS_IMAGE
value: "docker.io/nfvpe/multus:snapshot"
- name: CNI_PLUGINS_SUPPORTED_IMAGE
value: "docker.io/nfvpe/container-networking-plugins-supported"
- name: CNI_PLUGINS_UNSUPPORTED_IMAGE
value: "docker.io/nfvpe/container-networking-plugins-unsupported"
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
8 changes: 8 additions & 0 deletions manifests/image-references
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ spec:
from:
kind: DockerImage
name: quay.io/openshift/origin-multus-cni:v4.0.0
- name: cni-plugins-supported
from:
kind: DockerImage
name: quay.io/openshift/origin-container-networking-plugins-supported:v4.0.0
- name: cni-plugins-unsupported
from:
kind: DockerImage
name: quay.io/openshift/origin-container-networking-plugins-unsupported:v4.0.0
2 changes: 2 additions & 0 deletions pkg/network/multus.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ func renderMultusConfig(manifestDir string) ([]*uns.Unstructured, error) {
// render the manifests on disk
data := render.MakeRenderData()
data.Data["MultusImage"] = os.Getenv("MULTUS_IMAGE")
data.Data["CNIPluginsSupportedImage"] = os.Getenv("CNI_PLUGINS_SUPPORTED_IMAGE")
data.Data["CNIPluginsUnsupportedImage"] = os.Getenv("CNI_PLUGINS_UNSUPPORTED_IMAGE")

manifests, err := render.RenderDir(filepath.Join(manifestDir, "network/multus"), &data)
if err != nil {
Expand Down
16 changes: 0 additions & 16 deletions pkg/network/multus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
netv1 "github.com/openshift/cluster-network-operator/pkg/apis/networkoperator/v1"
"github.com/openshift/cluster-network-operator/pkg/apply"

uns "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

. "github.com/onsi/gomega"
)

Expand Down Expand Up @@ -60,20 +58,6 @@ func TestRenderMultus(t *testing.T) {
g.Expect(objs).To(ContainElement(HaveKubernetesID("ClusterRoleBinding", "", "multus")))
g.Expect(objs).To(ContainElement(HaveKubernetesID("DaemonSet", "multus", "multus")))

// make sure all deployments are in the master
for _, obj := range objs {
if obj.GetKind() != "Deployment" {
continue
}

sel, found, err := uns.NestedStringMap(obj.Object, "spec", "template", "spec", "nodeSelector")
g.Expect(err).NotTo(HaveOccurred())
g.Expect(found).To(BeTrue())

_, ok := sel["node-role.kubernetes.io/master"]
g.Expect(ok).To(BeTrue())
}

// Make sure every obj is reasonable:
// - it is supported
// - it reconciles to itself (steady state)
Expand Down

0 comments on commit b6047c4

Please sign in to comment.