Skip to content

Commit

Permalink
Add egress-router-cni init container
Browse files Browse the repository at this point in the history
This commit adds a new init container for the deployment of the
egress-router-cni plugin to the hosts.
  • Loading branch information
danielmellado committed Oct 8, 2020
1 parent 7ef869e commit bd414f1
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bindata/network/multus/multus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,25 @@ spec:
value: "/usr/src/multus-cni/rhel8/bin/"
- name: DEFAULT_SOURCE_DIRECTORY
value: "/usr/src/multus-cni/bin/"
- name: egress-router-binary-copy
image: "quay.io/dmellado/egress-router-test:latest"
image: {{.EgressRouterImage}}
command: ["/entrypoint/cnibincopy.sh"]
volumeMounts:
- mountPath: /entrypoint
name: cni-binary-copy
- mountPath: /host/opt/cni/bin
name: cnibin
- mountPath: /host/etc/os-release
name: os-release
readOnly: true
env:
- name: RHEL7_SOURCE_DIRECTORY
value: "/usr/src/egress-router-cni/rhel7/bin/"
- name: RHEL8_SOURCE_DIRECTORY
value: "/usr/src/egress-router-cni/rhel8/bin/"
- name: DEFAULT_SOURCE_DIRECTORY
value: "/usr/src/egress-router-cni/bin/"
- name: cni-plugins
image: {{.CNIPluginsImage}}
command: ["/entrypoint/cnibincopy.sh"]
Expand Down
2 changes: 2 additions & 0 deletions manifests/0000_70_cluster-network-operator_03_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ spec:
value: "5000"
- name: OVN_CONTROLLER_INACTIVITY_PROBE
value: "30000"
- name: EGRESS_ROUTER_IMAGE
value: "quay.io/dmellado/egress-router-test:latest"
- name: KURYR_DAEMON_IMAGE
value: "quay.io/openshift/origin-kuryr-cni:4.3"
- name: KURYR_CONTROLLER_IMAGE
Expand Down
4 changes: 4 additions & 0 deletions manifests/image-references
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ spec:
from:
kind: DockerImage
name: quay.io/openshift/origin-ovn-kubernetes:4.3
- name: egress-router
from:
kind: DockerImage
name: quay.io/dmellado/egress-router-test:latest
- name: kuryr-cni
from:
kind: DockerImage
Expand Down
25 changes: 25 additions & 0 deletions pkg/network/egress_router.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package network

import (
"os"
"path/filepath"

"github.com/openshift/cluster-network-operator/pkg/render"
"github.com/pkg/errors"
uns "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

// renderEgressRouterConfig returns the manifests of Egress Router CNI
func renderEgressRouterConfig(manifestDir string) ([]*uns.Unstructured, error) {
objs := []*uns.Unstructured{}

data = render.MakeRenderData()
data.Data["EgressRouterImage"] = os.Getenv("EGRESS_ROUTER_IMAGE")

manifests, err := render.RenderDir(filepath.Join(manifestDir, "network/egress-router-cni"), &data)
if err != nil {
return nil, errors.Wrap(err, "failed to render egress router cni manifests")
}
objs = append(objs, manifests...)
return objs, nil
}
6 changes: 6 additions & 0 deletions pkg/network/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ func Render(conf *operv1.NetworkSpec, bootstrapResult *bootstrap.BootstrapResult
}
objs = append(objs, o...)

// render EgressRouter
o, err = renderEgressRouter(conf, manifestDir)
if err != nil {
return nil, err
}

// render default network
o, err = renderDefaultNetwork(conf, bootstrapResult, manifestDir)
if err != nil {
Expand Down

0 comments on commit bd414f1

Please sign in to comment.