Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Restructured multus to use Go standard project layout.
- Loading branch information
Showing
43 changed files
with
326 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
os: linux | ||
language: go | ||
# see https://docs.travis-ci.com/user/reference/overview/#Virtualization-environments | ||
# for the detail | ||
# sudo: requried | ||
dist: bionic | ||
|
||
services: | ||
- docker | ||
|
||
go: | ||
- 1.13.x | ||
|
||
env: | ||
global: | ||
- GO111MODULE=on | ||
- REGISTRY_USER=${REGISTRY_USER:-nfvpe} | ||
- REGISTRY_PASS=${REGISTRY_PASS} | ||
- REPOSITORY_NAME=${REPOSITORY_NAME} | ||
- REPOSITORY_USER=${REPOSITORY_USER} | ||
- DOCKER_CLI_EXPERIMENTAL="enabled" | ||
- secure: "${REGISTRY_SECURE}" | ||
jobs: | ||
- TARGET=amd64 | ||
- TARGET=ppc64le | ||
|
||
before_install: | ||
- if [ "${REPOSITORY_NAME}" = "" ]; then export REPOSITORY_NAME=multus; fi | ||
- sudo apt-get update -qq | ||
- go get github.com/mattn/goveralls | ||
|
||
install: | ||
- go get -u golang.org/x/lint/golint | ||
|
||
before_script: | ||
# Make gopath... to run golint/go fmt/go vet | ||
# Suppress golint for fixing lint later. | ||
- golint ./... | grep -v vendor | grep -v ALL_CAPS | xargs -r false | ||
- go fmt ./... | ||
- go vet ./... | ||
# - gocyclo -over 15 ./multus | ||
|
||
script: | ||
- GOARCH="${TARGET}" ./hack/build-go.sh | ||
- | | ||
if [ "${TARGET}" == "amd64" ]; then | ||
sudo env PATH=${PATH} ./scripts/test.sh | ||
goveralls -coverprofile=coverage.out -service=travis-ci | ||
docker build -t ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 . | ||
docker build -t ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le -f Dockerfile.ppc64le . | ||
docker build -t ${REPOSITORY_USER}/${REPOSITORY_NAME}-origin:latest -f Dockerfile.openshift . | ||
fi | ||
deploy: | ||
# Release on versioned tag (e.g. v1.0) | ||
- provider: script | ||
#cleanup: false | ||
script: curl -sL https://git.io/goreleaser | ||
on: | ||
tags: true | ||
all_branches: true | ||
condition: "$TARGET = amd64 && $TRAVIS_TAG =~ ^v[0-9].*$ && ! -z $GITHUB_TOKEN && $TRAVIS_OS_NAME = linux" | ||
# Push images to Dockerhub on tag | ||
- provider: script | ||
cleanup: false | ||
script: > | ||
bash -c ' | ||
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest; | ||
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable; | ||
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-amd64; | ||
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:$TRAVIS_TAG; | ||
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-ppc64le; | ||
docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS"; | ||
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64; | ||
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le; | ||
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-amd64; | ||
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-ppc64le; | ||
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:$TRAVIS_TAG; | ||
export DOCKER_CLI_EXPERIMENTAL="enabled"; | ||
docker manifest create ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le; | ||
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 --arch amd64; | ||
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le --arch ppc64le; | ||
docker manifest push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest; | ||
docker manifest create ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-ppc64le; | ||
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-amd64 --arch amd64; | ||
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-ppc64le --arch ppc64le; | ||
docker manifest push ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable; | ||
echo done' | ||
on: | ||
tags: true | ||
all_branches: true | ||
condition: "$TRAVIS_TAG =~ ^v[0-9].*$ && -n $REGISTRY_USER && -n $REGISTRY_PASS && -n $REPOSITORY_NAME && -n $REPOSITORY_USER" | ||
# Push images to Dockerhub on merge to master | ||
- provider: script | ||
on: | ||
branch: master | ||
condition: "-n $REGISTRY_USER && -n $REGISTRY_PASS && -n $REPOSITORY_NAME && -n $REPOSITORY_USER" | ||
script: > | ||
bash -c ' | ||
docker tag ${REPOSITORY_USER}/:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot; | ||
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-amd64; | ||
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-ppc64le; | ||
docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS"; | ||
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-amd64; | ||
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-ppc64le; | ||
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64; | ||
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le; | ||
docker manifest create ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-ppc64le; | ||
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-amd64 --arch amd64; | ||
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-ppc64le --arch ppc64le; | ||
docker manifest push ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot; | ||
docker manifest create ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le; | ||
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 --arch amd64; | ||
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le --arch ppc64le; | ||
docker manifest push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest; | ||
echo done' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) 2017 Intel Corporation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// This is a "Multi-plugin".The delegate concept refered from CNI project | ||
// It reads other plugin netconf, and then invoke them, e.g. | ||
// flannel or sriov plugin. | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"gopkg.in/intel/multus-cni.v3/pkg/multus" | ||
"github.com/containernetworking/cni/pkg/skel" | ||
cniversion "github.com/containernetworking/cni/pkg/version" | ||
) | ||
|
||
|
||
func main() { | ||
|
||
// Init command line flags to clear vendored packages' one, especially in init() | ||
flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError) | ||
|
||
// add version flag | ||
versionOpt := false | ||
flag.BoolVar(&versionOpt, "version", false, "Show application version") | ||
flag.BoolVar(&versionOpt, "v", false, "Show application version") | ||
flag.Parse() | ||
if versionOpt == true { | ||
fmt.Printf("%s\n", multus.PrintVersionString()) | ||
return | ||
} | ||
|
||
skel.PluginMain( | ||
func(args *skel.CmdArgs) error { | ||
result, err := multus.CmdAdd(args, nil, nil) | ||
if err != nil { | ||
return err | ||
} | ||
return result.Print() | ||
}, | ||
func(args *skel.CmdArgs) error { | ||
return multus.CmdCheck(args, nil, nil) | ||
}, | ||
func(args *skel.CmdArgs) error { return multus.CmdDel(args, nil, nil) }, | ||
cniversion.All, "meta-plugin that delegates to other CNI plugins") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.