Skip to content

Commit

Permalink
Merge branch 'main' into iprange
Browse files Browse the repository at this point in the history
Signed-off-by: Laszlo Kiraly <[email protected]>
  • Loading branch information
ljkiraly authored May 17, 2024
2 parents dc21e63 + fb1687a commit 0460407
Show file tree
Hide file tree
Showing 13 changed files with 230 additions and 504 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ jobs:

golangci-lint:
uses: networkservicemesh/.github/.github/workflows/golangci-lint.yaml@main
with:
linter-version: v1.45.2

excludeFmtErrorf:
uses: networkservicemesh/.github/.github/workflows/exclude-fmt-errorf.yaml@main

restrictNSMDeps:
uses: networkservicemesh/.github/.github/workflows/restrict-nsm-deps.yaml@main
with:
allowed_repositories: "api, sdk, sdk-k8s, sdk-kernel, sdk-sriov, sdk-vpp"
allowed_repositories: "api, sdk, sdk-k8s, sdk-kernel, sdk-sriov, sdk-vpp, govpp, vpphelper"

checkgomod:
uses: networkservicemesh/.github/.github/workflows/checkgomod.yaml@main
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/docker-push-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ name: Docker push ghcr
on:
push:
branches: [main]
workflow_run:
types:
- completed
workflows:
- 'automerge'
jobs:
push:
if: ${{ github.repository != 'networkservicemesh/cmd-template' && (github.event.workflow_run.conclusion == 'success' && github.actor == 'nsmbot' || github.event_name == 'push') }}
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/docker-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ on:
push:
branches:
- main
workflow_run:
types:
- completed
workflows:
- 'automerge'
jobs:
push:
if: ${{ github.repository != 'networkservicemesh/cmd-template' && (github.event.workflow_run.conclusion == 'success' && github.actor == 'nsmbot' || github.event_name == 'push') }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ on:
- completed
workflows:
- "ci"
branches:
- release/*
jobs:
get-tag:
name: Get tag
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && contains(github.event.workflow_run.head_branch, 'release/') }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
tag: ${{ steps.get-tag-step.outputs.tag }}
steps:
- name: Get tag
run: |
branch=${{github.event.workflow_run.head_branch}}
echo '::set-output name=tag::'${branch#release/}
echo tag=${branch#release/} >> $GITHUB_OUTPUT
id: get-tag-step

check-gomod-deps:
Expand All @@ -30,8 +32,6 @@ jobs:
create-release:
needs: [get-tag, check-gomod-deps]
uses: networkservicemesh/.github/.github/workflows/release.yaml@main
with:
tag: ${{ needs.get-tag.outputs.tag }}
secrets:
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}

Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/update-deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ on:
push:
branches:
- main
workflow_run:
types:
- completed
workflows:
- 'automerge'
jobs:
update-deployments-k8s:
if: ${{ github.repository != 'networkservicemesh/cmd-template' && (github.event.workflow_run.conclusion == 'success' && github.actor == 'nsmbot' || github.event_name == 'push') }}
if: ${{ github.repository != 'networkservicemesh/cmd-template' }}
uses: networkservicemesh/.github/.github/workflows/update-deployments.yaml@main
secrets:
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }}
22 changes: 10 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
run:
# concurrency: 6
go: "1.17"
go: "1.20"
timeout: 2m
issues-exit-code: 1
tests: true
Expand Down Expand Up @@ -42,13 +42,11 @@ linters-settings:
min-len: 2
min-occurrences: 2
depguard:
list-type: blacklist
include-go-root: false
packages:
- errors
packages-with-error-message:
# specify an error message to output when a blacklisted package is used
- errors: "Please use \"github.com/pkg/errors\" instead of \"errors\" in go imports"
rules:
main:
deny:
- pkg: errors
desc: Please use github.com/pkg/errors instead of errors in go imports
misspell:
locale: US
unparam:
Expand Down Expand Up @@ -110,7 +108,6 @@ linters-settings:
- regexpPattern
- singleCaseSwitch
- sloppyLen
# - sloppyReassign
- stringXbytes
- switchTrue
- typeAssertChain
Expand All @@ -129,7 +126,6 @@ linters-settings:
linters:
disable-all: true
enable:
# - rowserrcheck
- goheader
- bodyclose
- deadcode
Expand All @@ -149,7 +145,6 @@ linters:
- gosimple
- govet
- ineffassign
# - lll
- misspell
- nakedret
- exportloopref
Expand All @@ -159,14 +154,17 @@ linters:
- typecheck
- unconvert
- unparam
# - unused
- varcheck
- whitespace
issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
exclude-rules:
- path: main.go
linters:
- revive
text: 'package-comments: should have a package comment'
- path: main.go
linters:
- funlen
Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM golang:1.18.2-buster as go
FROM golang:1.20.12 as go
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOBIN=/bin
RUN go install github.com/go-delve/delve/cmd/[email protected]
ADD https://github.com/spiffe/spire/releases/download/v1.2.2/spire-1.2.2-linux-x86_64-glibc.tar.gz .
RUN tar xzvf spire-1.2.2-linux-x86_64-glibc.tar.gz -C /bin --strip=2 spire-1.2.2/bin/spire-server spire-1.2.2/bin/spire-agent
ARG BUILDARCH=amd64
RUN go install github.com/go-delve/delve/cmd/[email protected]
ADD https://github.com/spiffe/spire/releases/download/v1.8.7/spire-1.8.7-linux-${BUILDARCH}-musl.tar.gz .
RUN tar xzvf spire-1.8.7-linux-${BUILDARCH}-musl.tar.gz -C /bin --strip=2 spire-1.8.7/bin/spire-server spire-1.8.7/bin/spire-agent

FROM go as build
WORKDIR /build
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ This repo contains 'nse-remote-vlan' an NSE application for Network Service Mesh

`nse-remote-vlan` accept following environment variables:

* NSM_NAME Name of the endpoint
* NSM_CONNECT_TO An URL of registry service to connect to
* NSM_MAX_TOKEN_LIFETIME Maximum lifetime of tokens
* NSM_CIDR_PREFIX CIDR Prefix or IP range(s) to assign IPs from (IPv4 and/or IPv6)
* NSM_REGISTER_SERVICE if true then registers network service on startup
* NSM_LISTEN_ON tcp:// url to be listen on. It will be used as public to register NSM
* NSM_SERVICES List of supported services
* `NSM_NAME` - Name of the endpoint (default: "vlan-server")
* `NSM_CONNECT_TO` - url of registry service to connect to (default: "nsm-registry-svc:5002")
* `NSM_MAX_TOKEN_LIFETIME` - maximum lifetime of tokens (default: "24h")
* `NSM_REGISTRY_CLIENT_POLICIES` - paths to files and directories that contain registry client policies (default: "etc/nsm/opa/common/.*.rego,etc/nsm/opa/registry/.*.rego,etc/nsm/opa/client/.*.rego")
* `NSM_CIDR_PREFIX` - CIDR Prefix to assign IPs (IPv4 and/or IPv6) from (default: "169.254.0.0/16")
* `NSM_CIDR_PREFIX` - CIDR Prefix or IP range(s) to assign IPs from (IPv4 and/or IPv6)
* `NSM_REGISTER_SERVICE` - if true then registers network service on startup (default: "true")
* `NSM_LISTEN_ON` - tcp:// url to be listen on. It will be used as public to register NSM (default: "tcp://:5003")
* `NSM_OPEN_TELEMETRY_ENDPOINT` - OpenTelemetry Collector Endpoint (default: "otel-collector.observability.svc.cluster.local:4317")
* `NSM_METRICS_EXPORT_INTERVAL` - interval between metrics exports (default: "10s")
* `NSM_LOG_LEVEL` - Log level (default: "INFO")
* `NSM_SERVICES` - list of supported services

## Build

Expand Down Expand Up @@ -93,4 +98,4 @@ docker run --privileged -e DLV_LISTEN_FORWARDER=:50000 -p 40000:40000 -p 50000:5
```

Please note, the tests **start** the cmd, so until you connect to port 40000 with your debugger and walk the tests
through to the point of running cmd, you will not be able to attach a debugger on port 50000 to the cmd.
through to the point of running cmd, you will not be able to attach a debugger on port 50000 to the cmd.
75 changes: 44 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,63 +1,76 @@
module github.com/networkservicemesh/cmd-nse-remote-vlan

go 1.18
go 1.20

require (
github.com/antonfisher/nested-logrus-formatter v1.3.1
github.com/edwarnicke/grpcfd v1.1.2
github.com/golang/protobuf v1.5.2
github.com/golang/protobuf v1.5.3
github.com/kelseyhightower/envconfig v1.4.0
github.com/networkservicemesh/api v1.6.2-0.20221205183940-84c7ff837cdd
github.com/networkservicemesh/sdk v0.5.1-0.20221229093003-75d6d5d1c617
github.com/networkservicemesh/api v1.13.1-0.20240424210452-d0df98851760
github.com/networkservicemesh/sdk v0.5.1-0.20240516075535-3b79590e3be7
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.0
github.com/spiffe/go-spiffe/v2 v2.0.0
github.com/stretchr/testify v1.8.0
google.golang.org/grpc v1.49.0
google.golang.org/protobuf v1.28.1
github.com/spiffe/go-spiffe/v2 v2.1.7
github.com/stretchr/testify v1.8.4
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.33.0
)

require (
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/OneOfOne/xxhash v1.2.8 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/edwarnicke/exechelper v1.0.2 // indirect
github.com/edwarnicke/genericsync v0.0.0-20220910010113-61a344f9bc29 // indirect
github.com/edwarnicke/serialize v1.0.7 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/open-policy-agent/opa v0.44.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/tchap/go-patricia/v2 v2.3.1 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/yashtewari/glob-intersection v0.1.0 // indirect
github.com/zeebo/errs v1.2.2 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.28.0 // indirect
go.opentelemetry.io/otel v1.9.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.31.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 // indirect
go.opentelemetry.io/otel/metric v0.31.0 // indirect
go.opentelemetry.io/otel/sdk v1.9.0 // indirect
go.opentelemetry.io/otel/sdk/metric v0.31.0 // indirect
go.opentelemetry.io/otel/trace v1.9.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
google.golang.org/genproto v0.0.0-20220908141613-51c1cc9bc6d0 // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
github.com/zeebo/errs v1.3.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
go.opentelemetry.io/otel v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.43.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.43.0 // indirect
go.opentelemetry.io/otel/metric v1.20.0 // indirect
go.opentelemetry.io/otel/sdk v1.20.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.20.0 // indirect
go.opentelemetry.io/otel/trace v1.20.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.9.3 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 0460407

Please sign in to comment.