Skip to content

Commit

Permalink
Merge branch 'main' into sanfern-dev-root-progs
Browse files Browse the repository at this point in the history
Signed-off-by: Santhosh Fernandes <santhosh.fernandes@gmail.com>
  • Loading branch information
sanfern committed Jun 21, 2023
2 parents 9963150 + 916e7ca commit 6b2eaad
Show file tree
Hide file tree
Showing 15 changed files with 237 additions and 71 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-build-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

steps:
- name: Setup Go 1.18.6
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version: '1.18.6'

Expand All @@ -38,7 +38,7 @@ jobs:
echo "GOPATH=$gopath" >> $env:GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9

- name: Format
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Setup Go 1.18.6
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version: '1.18.6'

Expand All @@ -37,7 +37,7 @@ jobs:
sudo apt-get install gcc libc-dev bash perl curl make
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9

- name: Format
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ jobs:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs

- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9

- name: Initialize CodeQL
uses: github/codeql-action/init@29b1f65c5e92e24fe6b6647da1eaabe529cec70f
uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@29b1f65c5e92e24fe6b6647da1eaabe529cec70f
uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a
4 changes: 2 additions & 2 deletions .github/workflows/scorecards-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
persist-credentials: false

Expand Down Expand Up @@ -73,6 +73,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard so it will be visible
# at https://github.com/l3af-project/l3afd/security/code-scanning.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@29b1f65c5e92e24fe6b6647da1eaabe529cec70f
uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a
with:
sarif_file: results.sarif
8 changes: 5 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import (
)

const (
ENV_PROD = "PROD"
ENV_PROD = "PROD"
KERNEL_MAJOR_VERSION = 5
KERNEL_MINOR_VERSION = 15
)

type Config struct {
Expand Down Expand Up @@ -103,8 +105,8 @@ func ReadConfig(configPath string) (*Config, error) {
DataCenter: LoadConfigString(confReader, "l3afd", "datacenter"),
BPFDir: LoadConfigString(confReader, "l3afd", "bpf-dir"),
BPFLogDir: LoadOptionalConfigString(confReader, "l3afd", "bpf-log-dir", ""),
MinKernelMajorVer: LoadOptionalConfigInt(confReader, "l3afd", "kernel-major-version", 5),
MinKernelMinorVer: LoadOptionalConfigInt(confReader, "l3afd", "kernel-minor-version", 1),
MinKernelMajorVer: LoadOptionalConfigInt(confReader, "l3afd", "kernel-major-version", KERNEL_MAJOR_VERSION),
MinKernelMinorVer: LoadOptionalConfigInt(confReader, "l3afd", "kernel-minor-version", KERNEL_MINOR_VERSION),
EBPFRepoURL: LoadConfigString(confReader, "ebpf-repo", "url"),
HttpClientTimeout: LoadOptionalConfigDuration(confReader, "l3afd", "http-client-timeout", 10*time.Second),
MaxEBPFReStartCount: LoadOptionalConfigInt(confReader, "l3afd", "max-ebpf-restart-count", 3),
Expand Down
60 changes: 51 additions & 9 deletions docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 47 additions & 7 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,17 @@
"description": "Program stop command",
"type": "string"
},
"cmd_update": {
"description": "Program update config command",
"type": "string"
},
"config_args": {
"description": "Map of arguments to config command",
"$ref": "#/definitions/models.L3afDNFArgs"
"allOf": [
{
"$ref": "#/definitions/models.L3afDNFArgs"
}
]
},
"config_file_path": {
"description": "Config file location",
Expand All @@ -203,7 +211,11 @@
},
"map_args": {
"description": "Config BPF Map of arguments",
"$ref": "#/definitions/models.L3afDNFArgs"
"allOf": [
{
"$ref": "#/definitions/models.L3afDNFArgs"
}
]
},
"map_name": {
"description": "BPF map to store next program fd",
Expand Down Expand Up @@ -242,15 +254,35 @@
},
"start_args": {
"description": "Map of arguments to start command",
"$ref": "#/definitions/models.L3afDNFArgs"
"allOf": [
{
"$ref": "#/definitions/models.L3afDNFArgs"
}
]
},
"status_args": {
"description": "Map of arguments to status command",
"$ref": "#/definitions/models.L3afDNFArgs"
"allOf": [
{
"$ref": "#/definitions/models.L3afDNFArgs"
}
]
},
"stop_args": {
"description": "Map of arguments to stop command",
"$ref": "#/definitions/models.L3afDNFArgs"
"allOf": [
{
"$ref": "#/definitions/models.L3afDNFArgs"
}
]
},
"update_args": {
"description": "Map of arguments to update command",
"allOf": [
{
"$ref": "#/definitions/models.L3afDNFArgs"
}
]
},
"user_program_daemon": {
"description": "User program daemon or not",
Expand Down Expand Up @@ -319,7 +351,11 @@
"properties": {
"bpf_programs": {
"description": "List of eBPF program names to remove",
"$ref": "#/definitions/models.BPFProgramNames"
"allOf": [
{
"$ref": "#/definitions/models.BPFProgramNames"
}
]
},
"host_name": {
"description": "Host name or pod name",
Expand All @@ -336,7 +372,11 @@
"properties": {
"bpf_programs": {
"description": "List of bpf programs",
"$ref": "#/definitions/models.BPFPrograms"
"allOf": [
{
"$ref": "#/definitions/models.BPFPrograms"
}
]
},
"host_name": {
"description": "Host name or pod name",
Expand Down
28 changes: 21 additions & 7 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ definitions:
cmd_stop:
description: Program stop command
type: string
cmd_update:
description: Program update config command
type: string
config_args:
$ref: '#/definitions/models.L3afDNFArgs'
allOf:
- $ref: '#/definitions/models.L3afDNFArgs'
description: Map of arguments to config command
config_file_path:
description: Config file location
Expand All @@ -42,7 +46,8 @@ definitions:
description: User program is plugin or not
type: boolean
map_args:
$ref: '#/definitions/models.L3afDNFArgs'
allOf:
- $ref: '#/definitions/models.L3afDNFArgs'
description: Config BPF Map of arguments
map_name:
description: BPF map to store next program fd
Expand Down Expand Up @@ -71,14 +76,21 @@ definitions:
description: Sequence position in the chain
type: integer
start_args:
$ref: '#/definitions/models.L3afDNFArgs'
allOf:
- $ref: '#/definitions/models.L3afDNFArgs'
description: Map of arguments to start command
status_args:
$ref: '#/definitions/models.L3afDNFArgs'
allOf:
- $ref: '#/definitions/models.L3afDNFArgs'
description: Map of arguments to status command
stop_args:
$ref: '#/definitions/models.L3afDNFArgs'
allOf:
- $ref: '#/definitions/models.L3afDNFArgs'
description: Map of arguments to stop command
update_args:
allOf:
- $ref: '#/definitions/models.L3afDNFArgs'
description: Map of arguments to update command
user_program_daemon:
description: User program daemon or not
type: boolean
Expand Down Expand Up @@ -125,7 +137,8 @@ definitions:
models.L3afBPFProgramNames:
properties:
bpf_programs:
$ref: '#/definitions/models.BPFProgramNames'
allOf:
- $ref: '#/definitions/models.BPFProgramNames'
description: List of eBPF program names to remove
host_name:
description: Host name or pod name
Expand All @@ -137,7 +150,8 @@ definitions:
models.L3afBPFPrograms:
properties:
bpf_programs:
$ref: '#/definitions/models.BPFPrograms'
allOf:
- $ref: '#/definitions/models.BPFPrograms'
description: List of bpf programs
host_name:
description: Host name or pod name
Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ require (
golang.org/x/sys v0.8.0 // exclude
)

require github.com/golang/mock v1.6.0
require (
github.com/florianl/go-tc v0.4.2
github.com/golang/mock v1.6.0
)

require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/florianl/go-tc v0.4.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/spec v0.20.8 // indirect
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ github.com/jsimonetti/rtnetlink v0.0.0-20201220180245-69540ac93943/go.mod h1:z4c
github.com/jsimonetti/rtnetlink v0.0.0-20210122163228-8d122574c736/go.mod h1:ZXpIyOK59ZnN7J0BV99cZUPmsqDRZ3eq5X+st7u/oSA=
github.com/jsimonetti/rtnetlink v0.0.0-20210212075122-66c871082f2b/go.mod h1:8w9Rh8m+aHZIG69YPGGem1i5VzoyRC8nw2kA8B+ik5U=
github.com/jsimonetti/rtnetlink v0.0.0-20210525051524-4cc836578190/go.mod h1:NmKSdU4VGSiv1bMsdqNALI4RSvvjtz65tTMCnD05qLo=
github.com/jsimonetti/rtnetlink v0.0.0-20211022192332-93da33804786 h1:N527AHMa793TP5z5GNAn/VLPzlc0ewzWdeP/25gDfgQ=
github.com/jsimonetti/rtnetlink v0.0.0-20211022192332-93da33804786/go.mod h1:v4hqbTdfQngbVSZJVWUhGE/lbTFf9jb+ygmNUDQMuOs=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
Expand Down
Loading

0 comments on commit 6b2eaad

Please sign in to comment.