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

manager: add support for Kind #204

Merged
merged 2 commits into from
Jul 19, 2021
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
6 changes: 2 additions & 4 deletions vpp-manager/startup/interface_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,8 @@ func loadInterfaceConfigFromLinux(params *config.VppManagerParams) (*config.Inte
conf.Mtu = link.Attrs().MTU

pciId, err := utils.GetInterfacePciId(params.MainInterface)
if err != nil {
return nil, err
}
if pciId == "" {
// We allow PCI not to be found e.g for AF_PACKET
if err != nil || pciId == "" {
log.Warnf("Could not find pci device for %s", params.MainInterface)
} else {
conf.PciId = pciId
Expand Down
11 changes: 9 additions & 2 deletions vpp-manager/uplink/dpdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ type DPDKDriver struct {
UplinkDriverData
}

func (d *DPDKDriver) IsSupported(warn bool) bool {
return true
func (d *DPDKDriver) IsSupported(warn bool) (supported bool) {
var ret bool
supported = true
ret = d.conf.PciId != ""
if !ret && warn {
log.Warnf("did not find pci device id for interface")
}
supported = supported && ret
return supported
}

func (d *DPDKDriver) PreconfigureLinux() (err error) {
Expand Down
1 change: 0 additions & 1 deletion vpp-manager/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ func getPciIdFromLink(path string) (string, error) {
}

func GetInterfacePciId(interfaceName string) (string, error) {
// We allow PCI not to be found e.g for AF_PACKET
// Grab PCI id - last PCI id in the real path to /sys/class/net/<device name>
deviceLinkPath := fmt.Sprintf("/sys/class/net/%s/device", interfaceName)
pciId, err := getPciIdFromLink(deviceLinkPath)
Expand Down
4 changes: 2 additions & 2 deletions vpp-manager/vpp_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func (v *VppRunner) configureLinuxTap(link netlink.Link) (err error) {
if err == syscall.EEXIST {
log.Warnf("add addr %+v via vpp EEXIST, %+v", addr, err)
} else if err != nil {
return errors.Wrapf(err, "Error adding address %s to tap interface", addr)
log.Errorf("Error adding address %s to tap interface: %v", addr, err)
}
}
for _, route := range v.conf.Routes {
Expand All @@ -228,7 +228,7 @@ func (v *VppRunner) configureLinuxTap(link netlink.Link) (err error) {
if err == syscall.EEXIST {
log.Warnf("add route %+v via vpp EEXIST, %+v", route, err)
} else if err != nil {
return errors.Wrapf(err, "cannot add route %+v via vpp", route)
log.Errorf("cannot add route %+v via vpp: %v", route, err)
}
}

Expand Down
1 change: 1 addition & 0 deletions yaml/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ build: clean
@kubectl kustomize overlays/dpdk > generated/calico-vpp-dpdk.yaml
@kubectl kustomize overlays/eks > generated/calico-vpp-eks.yaml
@kubectl kustomize overlays/eks-dpdk > generated/calico-vpp-eks-dpdk.yaml
@kubectl kustomize overlays/kind > generated/calico-vpp-kind.yaml
ifneq ($(strip $(TAG)),)
@sed -i.bak "s|:latest|:$(TAG)|g" generated/*.yaml
@rm -f generated/*.yaml.bak
Expand Down
68 changes: 34 additions & 34 deletions yaml/generated/calico-vpp-dpdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3709,6 +3709,40 @@ spec:
k8s-app: calico-vpp-node
spec:
containers:
- env:
- name: DATASTORE_TYPE
value: kubernetes
- name: WAIT_FOR_DATASTORE
value: "true"
- name: NODENAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SERVICE_PREFIX
valueFrom:
configMapKeyRef:
key: service_prefix
name: calico-vpp-config
image: docker.io/calicovpp/agent:prerelease
imagePullPolicy: IfNotPresent
name: agent
resources:
requests:
cpu: 250m
securityContext:
privileged: true
volumeMounts:
- mountPath: /var/run/calico
name: var-run-calico
readOnly: false
- mountPath: /var/lib/calico/felix-plugins
name: felix-plugins
readOnly: false
- mountPath: /var/run/vpp
name: vpp-rundir
- mountPath: /run/netns/
mountPropagation: Bidirectional
name: netns
- env:
- name: CALICOVPP_NATIVE_DRIVER
valueFrom:
Expand Down Expand Up @@ -3769,40 +3803,6 @@ spec:
- mountPath: /run/netns/
mountPropagation: Bidirectional
name: netns
- env:
- name: DATASTORE_TYPE
value: kubernetes
- name: WAIT_FOR_DATASTORE
value: "true"
- name: NODENAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SERVICE_PREFIX
valueFrom:
configMapKeyRef:
key: service_prefix
name: calico-vpp-config
image: docker.io/calicovpp/agent:prerelease
imagePullPolicy: IfNotPresent
name: agent
resources:
requests:
cpu: 250m
securityContext:
privileged: true
volumeMounts:
- mountPath: /var/run/calico
name: var-run-calico
readOnly: false
- mountPath: /var/lib/calico/felix-plugins
name: felix-plugins
readOnly: false
- mountPath: /var/run/vpp
name: vpp-rundir
- mountPath: /run/netns/
mountPropagation: Bidirectional
name: netns
hostNetwork: true
hostPID: true
nodeSelector:
Expand Down
68 changes: 34 additions & 34 deletions yaml/generated/calico-vpp-eks-dpdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3712,6 +3712,40 @@ spec:
k8s-app: calico-vpp-node
spec:
containers:
- env:
- name: DATASTORE_TYPE
value: kubernetes
- name: WAIT_FOR_DATASTORE
value: "true"
- name: NODENAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SERVICE_PREFIX
valueFrom:
configMapKeyRef:
key: service_prefix
name: calico-vpp-config
image: docker.io/calicovpp/agent:prerelease
imagePullPolicy: IfNotPresent
name: agent
resources:
requests:
cpu: 250m
securityContext:
privileged: true
volumeMounts:
- mountPath: /var/run/calico
name: var-run-calico
readOnly: false
- mountPath: /var/lib/calico/felix-plugins
name: felix-plugins
readOnly: false
- mountPath: /var/run/vpp
name: vpp-rundir
- mountPath: /run/netns/
mountPropagation: Bidirectional
name: netns
- env:
- name: CALICOVPP_HOOK_BEFORE_VPP_RUN
value: echo 'sudo systemctl stop network ; sudo systemctl kill network'
Expand Down Expand Up @@ -3785,40 +3819,6 @@ spec:
- mountPath: /run/netns/
mountPropagation: Bidirectional
name: netns
- env:
- name: DATASTORE_TYPE
value: kubernetes
- name: WAIT_FOR_DATASTORE
value: "true"
- name: NODENAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SERVICE_PREFIX
valueFrom:
configMapKeyRef:
key: service_prefix
name: calico-vpp-config
image: docker.io/calicovpp/agent:prerelease
imagePullPolicy: IfNotPresent
name: agent
resources:
requests:
cpu: 250m
securityContext:
privileged: true
volumeMounts:
- mountPath: /var/run/calico
name: var-run-calico
readOnly: false
- mountPath: /var/lib/calico/felix-plugins
name: felix-plugins
readOnly: false
- mountPath: /var/run/vpp
name: vpp-rundir
- mountPath: /run/netns/
mountPropagation: Bidirectional
name: netns
hostNetwork: true
hostPID: true
nodeSelector:
Expand Down
68 changes: 34 additions & 34 deletions yaml/generated/calico-vpp-eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3709,6 +3709,40 @@ spec:
k8s-app: calico-vpp-node
spec:
containers:
- env:
- name: DATASTORE_TYPE
value: kubernetes
- name: WAIT_FOR_DATASTORE
value: "true"
- name: NODENAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SERVICE_PREFIX
valueFrom:
configMapKeyRef:
key: service_prefix
name: calico-vpp-config
image: docker.io/calicovpp/agent:prerelease
imagePullPolicy: IfNotPresent
name: agent
resources:
requests:
cpu: 250m
securityContext:
privileged: true
volumeMounts:
- mountPath: /var/run/calico
name: var-run-calico
readOnly: false
- mountPath: /var/lib/calico/felix-plugins
name: felix-plugins
readOnly: false
- mountPath: /var/run/vpp
name: vpp-rundir
- mountPath: /run/netns/
mountPropagation: Bidirectional
name: netns
- env:
- name: CALICOVPP_HOOK_BEFORE_VPP_RUN
value: echo 'sudo systemctl stop network ; sudo systemctl kill network'
Expand Down Expand Up @@ -3780,40 +3814,6 @@ spec:
- mountPath: /run/netns/
mountPropagation: Bidirectional
name: netns
- env:
- name: DATASTORE_TYPE
value: kubernetes
- name: WAIT_FOR_DATASTORE
value: "true"
- name: NODENAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SERVICE_PREFIX
valueFrom:
configMapKeyRef:
key: service_prefix
name: calico-vpp-config
image: docker.io/calicovpp/agent:prerelease
imagePullPolicy: IfNotPresent
name: agent
resources:
requests:
cpu: 250m
securityContext:
privileged: true
volumeMounts:
- mountPath: /var/run/calico
name: var-run-calico
readOnly: false
- mountPath: /var/lib/calico/felix-plugins
name: felix-plugins
readOnly: false
- mountPath: /var/run/vpp
name: vpp-rundir
- mountPath: /run/netns/
mountPropagation: Bidirectional
name: netns
hostNetwork: true
hostPID: true
nodeSelector:
Expand Down
Loading