-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Boris Glimcher <[email protected]>
- Loading branch information
Showing
7 changed files
with
1,585 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# This file contains all available configuration options | ||
# with their default values. | ||
|
||
# options for analysis running | ||
run: | ||
|
||
# output configuration options | ||
output: | ||
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" | ||
format: colored-line-number | ||
|
||
linters-settings: | ||
funlen: | ||
lines: 120 | ||
statements: 120 | ||
dupl: | ||
threshold: 200 | ||
gocognit: | ||
min-complexity: 32 | ||
|
||
linters: | ||
enable: | ||
- bodyclose | ||
- dogsled | ||
- errcheck | ||
- exportloopref | ||
- funlen | ||
- gochecknoinits | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- prealloc | ||
- revive | ||
- staticcheck | ||
- stylecheck | ||
- unconvert | ||
- unparam | ||
- whitespace | ||
|
||
issues: | ||
# Independently from option `exclude` we use default exclude patterns, | ||
# it can be disabled by this option. To list all | ||
# excluded by default patterns execute `golangci-lint run --help`. | ||
# Default value for this option is true. | ||
exclude-use-default: false | ||
|
||
exclude-rules: | ||
- path: (.+)_test.go | ||
linters: | ||
- funlen | ||
- gocritic | ||
- gocognit | ||
|
||
# Maximum issues count per one linter. Set to 0 to disable. Default is 50. | ||
max-issues-per-linter: 0 | ||
|
||
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3. | ||
max-same-issues: 0 |
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,24 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- repo: https://github.com/renovatebot/pre-commit-hooks | ||
rev: 37.61.4 | ||
hooks: | ||
- id: renovate-config-validator | ||
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook | ||
rev: v9.9.0 | ||
hooks: | ||
- id: commitlint | ||
stages: [commit-msg] | ||
additional_dependencies: ['@commitlint/config-conventional'] | ||
- repo: https://github.com/golangci/golangci-lint | ||
rev: v1.55.2 | ||
hooks: | ||
- id: golangci-lint |
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,25 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (c) 2022-2023 Dell Inc, or its subsidiaries. | ||
|
||
FROM docker.io/library/golang:1.21.4-alpine as builder | ||
|
||
WORKDIR /app | ||
|
||
# Download necessary Go modules | ||
COPY go.mod ./ | ||
COPY go.sum ./ | ||
RUN go mod download | ||
|
||
# build an app | ||
COPY cmd/ cmd/ | ||
COPY pkg/ pkg/ | ||
RUN go build -v -o /opi-cni /app/cmd/... | ||
|
||
# second stage to reduce image size | ||
FROM alpine:3.18 | ||
RUN apk add --no-cache --no-check-certificate hwdata && rm -rf /var/cache/apk/* | ||
COPY --from=builder /opi-cni / | ||
COPY --from=docker.io/fullstorydev/grpcurl:v1.8.9-alpine /bin/grpcurl /usr/local/bin/ | ||
EXPOSE 50051 8082 | ||
CMD [ "/opi-cni", "-grpc_port=50051", "-http_port=8082" ] | ||
HEALTHCHECK CMD grpcurl -plaintext localhost:50051 list || exit 1 |
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,51 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (c) 2023 Dell Inc, or its subsidiaries. | ||
|
||
ROOT_DIR='.' | ||
PROJECTNAME=$(shell basename "$(PWD)") | ||
|
||
# Make is verbose in Linux. Make it silent. | ||
MAKEFLAGS += --silent | ||
|
||
compile: get build | ||
|
||
build: | ||
@echo " > Building binaries..." | ||
@CGO_ENABLED=0 go build -o ${PROJECTNAME} ./cmd/... | ||
|
||
get: | ||
@echo " > Checking if there are any missing dependencies..." | ||
@CGO_ENABLED=0 go get ./... | ||
|
||
tools: | ||
go get golang.org/x/tools/cmd/goimports | ||
go get github.com/kisielk/errcheck | ||
go get github.com/axw/gocov/gocov | ||
go get github.com/matm/gocov-html | ||
go get github.com/tools/godep | ||
go get github.com/mitchellh/gox | ||
go get github.com/golang/lint/golint | ||
|
||
test: | ||
@echo " > Running ginkgo test suites..." | ||
# can replace with a recursive command ginkgo suites are defined for all packages | ||
ginkgo grpc pkg | ||
|
||
vet: | ||
@CGO_ENABLED=0 go vet -v ./... | ||
|
||
errors: | ||
errcheck -ignoretests -blank ./... | ||
|
||
lint: | ||
golint ./... | ||
|
||
imports: | ||
goimports -l -w . | ||
|
||
fmt: | ||
@CGO_ENABLED=0 go fmt ./... | ||
|
||
mock-generate: | ||
@echo " > Starting mock code generation..." | ||
# Generate mocks for exported interfaces |
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 |
---|---|---|
@@ -1,2 +1,33 @@ | ||
# opi-cni | ||
this is a new CNI for DPUs | ||
# Opi CNI is a new CNI for DPUs | ||
|
||
[![Linters](https://github.com/opiproject/opi-cni/actions/workflows/linters.yml/badge.svg)](https://github.com/opiproject/opi-cni/actions/workflows/linters.yml) | ||
[![CodeQL](https://github.com/opiproject/opi-cni/actions/workflows/codeql.yml/badge.svg)](https://github.com/opiproject/opi-cni/actions/workflows/codeql.yml) | ||
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/opiproject/opi-cni/badge)](https://securityscorecards.dev/viewer/?platform=github.com&org=opiproject&repo=opi-cni) | ||
[![tests](https://github.com/opiproject/opi-cni/actions/workflows/go.yml/badge.svg)](https://github.com/opiproject/opi-cni/actions/workflows/go.yml) | ||
[![Docker](https://github.com/opiproject/opi-cni/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/opiproject/opi-cni/actions/workflows/docker-publish.yml) | ||
[![License](https://img.shields.io/github/license/opiproject/opi-cni?style=flat-square&color=blue&label=License)](https://github.com/opiproject/opi-cni/blob/master/LICENSE) | ||
[![codecov](https://codecov.io/gh/opiproject/opi-cni/branch/main/graph/badge.svg)](https://codecov.io/gh/opiproject/opi-cni) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/opiproject/opi-cni)](https://goreportcard.com/report/github.com/opiproject/opi-cni) | ||
[![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/opiproject/opi-cni) | ||
[![Pulls](https://img.shields.io/docker/pulls/opiproject/opi-cni.svg?logo=docker&style=flat&label=Pulls)](https://hub.docker.com/r/opiproject/opi-cni) | ||
[![Last Release](https://img.shields.io/github/v/release/opiproject/opi-cni?label=Latest&style=flat-square&logo=go)](https://github.com/opiproject/opi-cni/releases) | ||
[![GitHub stars](https://img.shields.io/github/stars/opiproject/opi-cni.svg?style=flat-square&label=github%20stars)](https://github.com/opiproject/opi-cni) | ||
[![GitHub Contributors](https://img.shields.io/github/contributors/opiproject/opi-cni.svg?style=flat-square)](https://github.com/opiproject/opi-cni/graphs/contributors) | ||
|
||
This repo includes OPI CNI code for K8S to allow offloading CNI to DPUs. | ||
|
||
## I Want To Contribute | ||
|
||
This project welcomes contributions and suggestions. We are happy to have the Community involved via submission of **Issues and Pull Requests** (with substantive content or even just fixes). We are hoping for the documents, test framework, etc. to become a community process with active engagement. PRs can be reviewed by by any number of people, and a maintainer may accept. | ||
|
||
See [CONTRIBUTING](https://github.com/opiproject/opi/blob/main/CONTRIBUTING.md) and [GitHub Basic Process](https://github.com/opiproject/opi/blob/main/doc-github-rules.md) for more details. | ||
|
||
## Getting started | ||
|
||
:exclamation: `docker-compose` is deprecated. For details, see [Migrate to Compose V2](https://docs.docker.com/compose/migrate/). | ||
|
||
Run `docker-compose up -d` or `docker compose up -d` | ||
|
||
## Diagrams | ||
|
||
Tbd |
Oops, something went wrong.