Skip to content

Commit

Permalink
Support multi arch travis-ci job and docker image
Browse files Browse the repository at this point in the history
Add CI job for ppc64le machine and create a manifest for the image
in both amd64 and ppc64le archs

Signed-off-by: mamduhala <[email protected]>
  • Loading branch information
Mmduh-483 authored and zshi-redhat committed Mar 16, 2020
1 parent 9c12a6d commit 9619991
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 5 deletions.
31 changes: 27 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
language: go

matrix:
include:
- name: amd64
os: linux
env: ARCH=amd64
- name: ppc64le
os: linux-ppc64le
env:
- ARCH=ppc64le
- DOCKERFILE=images/Dockerfile.ppc64le

before_install:
- sudo apt-get update -qq
- sudo systemctl restart docker

script:
- make test
Expand All @@ -16,17 +28,28 @@ deploy:
# Push image to Dockerhub on merge to master
- provider: script
skip_cleanup: true
script: docker push nfvpe/sriov-device-plugin
script: >
bash -c '
if [ "${ARCH}" == "amd64" ]; then
docker push nfvpe/sriov-device-plugin;
fi
docker tag nfvpe/sriov-device-plugin nfvpe/sriov-device-plugin:$ARCH;
docker push nfvpe/sriov-device-plugin:$ARCH;
echo done'
on:
branch: master
# Push image to Dockerhub on tag
- provider: script
skip_cleanup: true
script: >
bash -c '
docker tag nfvpe/sriov-device-plugin nfvpe/sriov-device-plugin:$TRAVIS_TAG;
docker push nfvpe/sriov-device-plugin:$TRAVIS_TAG;
echo foo'
if [ "${ARCH}" == "amd64" ]; then
docker tag nfvpe/sriov-device-plugin nfvpe/sriov-device-plugin:"$TRAVIS_TAG";
docker push nfvpe/sriov-device-plugin:"$TRAVIS_TAG";
fi
docker tag nfvpe/sriov-device-plugin nfvpe/sriov-device-plugin:"$TRAVIS_TAG-$ARCH";
docker push nfvpe/sriov-device-plugin:"$TRAVIS_TAG-$ARCH";
echo done'
on:
tags: true
all_branches: true
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export GOBIN

# Docker
IMAGEDIR=$(BASE)/images
DOCKERFILE=$(CURDIR)/images/Dockerfile
DOCKERFILE?=$(CURDIR)/images/Dockerfile
TAG=nfvpe/sriov-device-plugin
# Accept proxy settings for docker
DOCKERARGS=
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- [Deploy demo Pod connecting to pre-created SR-IOV networks](#deploy-demo-pod-connecting-to-pre-created-sr-iov-networks)
- [Verify status and the network connections of the demo Pod](#verify-status-and-the-network-connections-of-the-demo-pod)
- [Pod device information](#pod-device-information)
- [Multi Architecture Support](#multi-architecture-support)
- [Issues and Contributing](#issues-and-contributing)

## SRIOV Network Device Plugin
Expand Down Expand Up @@ -462,6 +463,22 @@ The allocated device information is exported in Container's environment variable
For example, if 2 devices are allocated from `intel.com/sriov` extended resource then the allocated device information will be found in following env variable:
`PCIDEVICE_INTEL_COM_SRIOV=0000:03:02.1,0000:03:04.3`

## Multi Architecture Support

The supported architectures:
* AMD64
* PPC64LE

Buiding image for AMD64:
```
$ DOCKERFILE=Dockerfile make image
```

Buiding image for PPC64LE:
```
$ DOCKERFILE=images/Dockerfile.ppc64le TAG=nfvpe/sriov-device-plugin:ppc64le make image
```

## Issues and Contributing

We welcome your feedback and contributions to this project. Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines.
Expand Down
56 changes: 56 additions & 0 deletions deployments/k8s-v1.10-v1.15/sriovdp-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,59 @@ spec:
items:
- key: config.json
path: config.json

---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: kube-sriov-device-plugin-ppc64le
namespace: kube-system
labels:
tier: node
app: sriovdp
spec:
template:
metadata:
labels:
tier: node
app: sriovdp
spec:
hostNetwork: true
hostPID: true
nodeSelector:
beta.kubernetes.io/arch: ppc64le
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
serviceAccountName: sriov-device-plugin
containers:
- name: kube-sriovdp
image: nfvpe/sriov-device-plugin:ppc64le
imagePullPolicy: Never
args:
- --log-dir=sriovdp
- --log-level=10
securityContext:
privileged: true
volumeMounts:
- name: devicesock
mountPath: /var/lib/kubelet/
readOnly: false
- name: log
mountPath: /var/log
- name: config-volume
mountPath: /etc/pcidp
volumes:
- name: devicesock
hostPath:
path: /var/lib/kubelet/
- name: log
hostPath:
path: /var/log
- name: config-volume
configMap:
name: sriovdp-config
items:
- key: config.json
path: config.json
60 changes: 60 additions & 0 deletions deployments/k8s-v1.16/sriovdp-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,63 @@ spec:
items:
- key: config.json
path: config.json

---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: kube-sriov-device-plugin-ppc64le
namespace: kube-system
labels:
tier: node
app: sriovdp
spec:
selector:
matchLabels:
name: sriov-device-plugin
template:
metadata:
labels:
name: sriov-device-plugin
tier: node
app: sriovdp
spec:
hostNetwork: true
hostPID: true
nodeSelector:
beta.kubernetes.io/arch: ppc64le
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
serviceAccountName: sriov-device-plugin
containers:
- name: kube-sriovdp
image: nfvpe/sriov-device-plugin:ppc64le
imagePullPolicy: Never
args:
- --log-dir=sriovdp
- --log-level=10
securityContext:
privileged: true
volumeMounts:
- name: devicesock
mountPath: /var/lib/kubelet/
readOnly: false
- name: log
mountPath: /var/log
- name: config-volume
mountPath: /etc/pcidp
volumes:
- name: devicesock
hostPath:
path: /var/lib/kubelet/
- name: log
hostPath:
path: /var/log
- name: config-volume
configMap:
name: sriovdp-config
items:
- key: config.json
path: config.json
21 changes: 21 additions & 0 deletions images/Dockerfile.ppc64le
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ppc64le/golang:alpine as builder

ADD . /usr/src/sriov-network-device-plugin

ENV HTTP_PROXY $http_proxy
ENV HTTPS_PROXY $https_proxy
RUN apk add --update --virtual build-dependencies build-base linux-headers make && \
cd /usr/src/sriov-network-device-plugin && \
make clean && \
make build

FROM ppc64le/alpine
RUN apk add hwdata-pci
COPY --from=builder /usr/src/sriov-network-device-plugin/build/sriovdp /usr/bin/
WORKDIR /

LABEL io.k8s.display-name="SRIOV Network Device Plugin PPC64LE"

ADD ./images/entrypoint.sh /

ENTRYPOINT ["/entrypoint.sh"]

0 comments on commit 9619991

Please sign in to comment.