Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT : DoNotMerge: v0.4.4 <-- V0.5.6 #219

Draft
wants to merge 69 commits into
base: v0.4.4
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
e74072c
AIR-535 Updating files with new images which have lesser or no securi…
manasabsv26 Dec 22, 2022
50d9ad4
AIR-486 Fix TC build issue
manasabsv26 Dec 15, 2022
8020cf0
Moving from alpine:3.15 to 3.16 and upgrading go packages
manasabsv26 Feb 23, 2023
8f772d5
Running go mod tidy
manasabsv26 Mar 3, 2023
be200ae
Upgrading go packages for hostplumber
manasabsv26 Mar 3, 2023
2be6d6f
Update whereabouts to v0.6-pmk-6
mithilarun Mar 13, 2023
4cea76b
Merge pull request #55 from platform9/private/mithil/upgrade=whereabouts
mithilarun Mar 14, 2023
b4f5a25
Update to newer k8s registry - registry.k8s.io
NeelavaChatterjee Mar 20, 2023
9965159
Merge pull request #56 from platform9/private/atherton/neelava/PMK-5705
NeelavaChatterjee Mar 21, 2023
150c5ee
Use a KubeVirt VM to spawn the DHCPServer
tanaypatankar Jan 19, 2023
a2bf611
Add Kubemacpool installation to DHCPController plugin
tanaypatankar Feb 16, 2023
839b56e
Use a KubeVirt VM to spawn the DHCPServer
tanaypatankar Mar 24, 2023
b47e669
Merge pull request #52 from platform9/private/tanay/kubemacpool
tanaypatankar Mar 24, 2023
a942fc8
Add initial NetworkWizard controller
xagent003 Mar 20, 2023
f6ec61a
Update README, fix bugs
xagent003 Apr 5, 2023
598f80a
KVIRT-120: OVS-DPDK support in the ovs cni plugin
shweta50 Feb 16, 2023
b6043aa
KVIRT-224: Add dpdkConfig to HostNetworkTemplate for vfio-pci binding…
shweta50 Mar 11, 2023
ae31904
Yoshi - Add Public IP BGP support
xagent003 Apr 5, 2023
6bce96e
Yoshi - Generate random Static MAC address for Calico
xagent003 Apr 8, 2023
5796067
YOSHI - Deploy its own plugin dependencies, dont rely addon-operator …
xagent003 Apr 11, 2023
273ddf1
Fix issues deploying dependencies
xagent003 Apr 12, 2023
50957da
Fix adding and removing public IPs to VM
xagent003 Apr 25, 2023
487f9f8
Make dpdk parameters mandatory
shweta50 May 5, 2023
58ce508
KVIRT-244: Support to allocate huge pages of a specific size in OVS-DPDK
shweta50 Apr 28, 2023
3a2f7ad
KVIRT-237: upgrades to resolve vulnerabilities in luigi, OVS, hostplu…
shweta50 May 20, 2023
d01deb5
Get the hugepage size from meminfo (remove HugepageSize parameter from
shweta50 May 20, 2023
54d3055
Indentation fix
shweta50 May 24, 2023
2e09752
KVIRT-256 : Changed Cronjob api verison to v1
Jun 15, 2023
d100870
Updating hostplumber,ovs,multus images for resolving security vulnera…
shweta50 Jun 26, 2023
2b7eb7e
Make dhcp-controller-system namespace privileged
tanaypatankar Jun 29, 2023
97748be
Add nodeSelector to DHCPServer
tanaypatankar Jun 25, 2023
07473b5
GitHub action for Grype scan (#92)
cruizen Jul 11, 2023
84bd4a9
Updating the whereabouts image (#95)
manasabsv26 Jul 19, 2023
6035747
KVIRT-267:Sleep for avoiding reading of truncated lease file in dhcps…
shweta50 Jul 24, 2023
cd18595
Revert: KVIRT-237-upgrades to resolve vulnerabilities in hostplumber
shweta50 Jul 28, 2023
64cde1f
[AIR-895]: Block uninstall of multus of network attachment defination…
joey00072 Aug 2, 2023
3e7b600
[AIR-894] Making network plugins CR singleton (#91)
joey00072 Aug 2, 2023
1b30101
KVIRT-275: updated the version of kubemacpool image to v0.41.0
c-nilesh1984 Aug 4, 2023
bf5b582
KVIRT-237-upgrades to resolve vulnerabilities in hostplumber (#100)
shweta50 Aug 20, 2023
e208883
PMK-6031: security fixes (#104)
joey00072 Oct 5, 2023
69d80a3
AIR-6100: security fixes whereabouts image update (#107)
joey00072 Oct 10, 2023
d410b56
PMK-6032 PMK-6095 PMK-6112: security fixes (#110)
joey00072 Oct 11, 2023
d8a9c49
Update Grype scan action anchore.yml (#112)
cruizen Oct 16, 2023
25ac2eb
Update ci.yml (#113)
cruizen Oct 22, 2023
01c9734
[atherton] Luigi : update golang to 1.19 : build fix (#115)
joey00072 Nov 6, 2023
e4ec9ed
build fix (#116)
joey00072 Nov 7, 2023
72ed9e0
Hostplumber image update v0.5.2 (#117)
joey00072 Nov 7, 2023
a25d7c3
Security fixes (#118)
joey00072 Nov 7, 2023
b15895e
img updated nfd sriov-dp sriov-cni (#119)
joey00072 Nov 7, 2023
4b993de
Create GitHub action workflow govulncheck.yml (#66)
cruizen Nov 8, 2023
e8e59ea
Create GitHub workflow trivy.yml for scanning of security vulnerabili…
cruizen Nov 8, 2023
10e8e0c
Create custom dhcpserver containerdisk (#102)
shweta50 Nov 10, 2023
34e222b
security fixes openvswich dhcp controller (#121)
joey00072 Nov 10, 2023
99af177
AIR-1268: Revert Whereabout version to v0.4.12 (#123)
joey00072 Dec 8, 2023
77f5ab4
Upgraded whereabouts (#127)
joey00072 Jan 11, 2024
2957b5c
Update Whereabouts to v0.6.3 (#128)
joey00072 Feb 27, 2024
2d00cd7
Luigi security fixes : Update to alpine3.18 and go1.21 and fix Trivy …
cruizen Feb 27, 2024
580b799
Minor Fixes in Makefile (#135)
joey00072 Feb 29, 2024
be01b1c
Run go mod tidy and fix img-test in Teamcity build (#138)
cruizen Mar 6, 2024
f431329
update hostplumber:v0.5.4 (#157)
joey00072 Mar 11, 2024
7d9b433
PMK-6377 Changing the label for hostplumber (#180)
vedantjoshi84 May 10, 2024
633173d
Revert "PMK-6377 Changing the label for hostplumber (#180)" (#181)
poojaghumre May 10, 2024
764c688
PMK-6377 Changing labels for hostplumber (#188)
vedantjoshi84 May 20, 2024
ec59180
Making setupENV change (#189)
vedantjoshi84 May 20, 2024
aab84b6
Updating the hostplumber plugin version to 0.5.5 (#191)
vedantjoshi84 May 21, 2024
0685a84
[PMK-6474] : Restrict TLS cipher suites for kube-rbac-proxy container…
cruizen Jul 16, 2024
50db5df
[Backport for PMK 5.10] Added ability to customize hostplumber metric…
manasabsv26 Jul 16, 2024
134cf86
Added metricsPort to hostplumber plugin (#230)
jayanth-tjvrr Aug 14, 2024
28d7eb5
Update sampleplugins.yaml (#241)
cruizen Sep 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/anchore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow checks out code, builds an image, performs a container image
# vulnerability scan with Anchore's Grype tool, and integrates the results with GitHub Advanced Security
# code scanning feature. For more information on the Anchore scan action usage
# and parameters, see https://github.com/anchore/scan-action. For more
# information on Anchore's container image scanning tool Grype, see
# https://github.com/anchore/grype
name: Anchore Grype vulnerability scan

on:
push:
branches: [ "master", "platform9-v*" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '44 8 * * 4'

permissions:
contents: read

jobs:
Anchore-Build-Scan:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag platform9/luigi_dev:latest
- name: Run the Anchore Grype scan action
uses: anchore/scan-action@v3
id: scan
with:
image: "platform9/luigi_dev:latest"
fail-build: false
severity-cutoff: critical
- name: Upload vulnerability report
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
environment: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
go-version: 1.17
go-version: 1.21
check-latest: true
cache: true
- name: Print the version of golang
Expand All @@ -32,12 +32,12 @@ jobs:
environment: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
go-version: 1.17
go-version: 1.21
check-latest: true
cache: true
- name: Print the version of golang
Expand All @@ -47,6 +47,6 @@ jobs:
- name: Build
run: make build
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: ./cover.out
19 changes: 19 additions & 0 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Vuln check
on:
pull_request:
branches:
- "main"
- "v**"
schedule:
- cron: '* * * * *'
permissions:
security-events: write

jobs:
vuln-check:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Golang Vulncheck
uses: Templum/govulncheck-action@v1.0.0
48 changes: 48 additions & 0 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: trivy_scan

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '42 17 * * 0'

permissions:
contents: read

jobs:
build_image:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
name: Build
runs-on: "ubuntu-latest"
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build an image from Dockerfile
run: |
docker build -t docker.io/platform9/luigi:${{ github.sha }} .

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe
with:
image-ref: 'docker.io/platform9/luigi:${{ github.sha }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.17 as builder
FROM golang:1.21 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -23,7 +23,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
# Refer to https://github.com/GoogleContainerTools/distroless for more details
#FROM gcr.io/distroless/static:nonroot

FROM alpine:3.15
FROM alpine:3.18
RUN apk add --no-cache bash
WORKDIR /
COPY --from=builder /workspace/manager .
Expand Down
32 changes: 21 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
SHELL=/bin/bash
# Image URL to use all building/pushing image targets
#IMG ?= controller:latest
VER_LABEL=$(shell ./get-label.bash)
IMG ?= platform9/luigi-plugins:$(VER_LABEL)

ifndef OVERRIDE_LUIGI_VERSION
IMG_TAG = $(shell ./get-label.bash)
else
IMG_TAG ?= $(OVERRIDE_LUIGI_VERSION)
endif

IMG = platform9/luigi-plugins:$(IMG_TAG)
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.23
ENVTEST_K8S_VERSION = 1.27

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand All @@ -14,10 +20,14 @@ GOBIN=$(shell go env GOBIN)
endif

SRCROOT = $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/)
BUILD_DIR :=$(SRCROOT)/bin
BUILD_ROOT = $(SRCROOT)/build
OS=$(shell go env GOOS)
ARCH=$(shell go env GOARCH)

$(BUILD_DIR):
mkdir -p $@

$(BUILD_ROOT):
mkdir -p $@
mkdir -p $@/luigi
Expand Down Expand Up @@ -140,20 +150,20 @@ $(CONTROLLER_GEN): $(LOCALBIN)
.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20230216140739-c98506dc3b8e

img-test:
docker run --rm -v $(SRCROOT):/luigi -w /luigi golang:1.17.7-bullseye bash -c "make test"
docker run --rm -v $(SRCROOT):/luigi -w /luigi golang:1.21 bash -c "GOFLAGS=-buildvcs=false make test"

img-build: img-test $(BUILD_ROOT)
img-build: $(BUILD_DIR) img-test
docker build --network host . -t ${IMG}
echo ${IMG} > $(BUILD_ROOT)/container-tag
echo ${IMG} > $(BUILD_DIR)/container-tag

img-build-push: img-build
docker login
docker push ${IMG}
echo ${IMG} > $(BUILD_ROOT)/container-tag
echo ${IMG} > $(BUILD_DIR)/container-tag

scan:
docker run -v $(BUILD_ROOT)/luigi:/out -v /var/run/docker.sock:/var/run/docker.sock -v $(HOME)/.trivy:/root/.cache aquasec/trivy image -s CRITICAL,HIGH -f json --vuln-type library -o /out/library_vulnerabilities.json --exit-code 22 ${IMG}
docker run -v $(BUILD_ROOT)/luigi:/out -v /var/run/docker.sock:/var/run/docker.sock -v $(HOME)/.trivy:/root/.cache aquasec/trivy image -s CRITICAL,HIGH -f json --vuln-type os -o /out/os_vulnerabilities.json --exit-code 22 ${IMG}
scan: $(BUILD_ROOT)
docker run -v $(BUILD_ROOT)/luigi:/out -v /var/run/docker.sock:/var/run/docker.sock -v $(HOME)/.trivy:/root/.cache aquasec/trivy image -s CRITICAL,HIGH -f json --scanners vuln --vuln-type library -o /out/library_vulnerabilities.json --exit-code 22 ${IMG}
docker run -v $(BUILD_ROOT)/luigi:/out -v /var/run/docker.sock:/var/run/docker.sock -v $(HOME)/.trivy:/root/.cache aquasec/trivy image -s CRITICAL,HIGH -f json --scanners vuln --vuln-type os -o /out/os_vulnerabilities.json --exit-code 22 ${IMG}
4 changes: 3 additions & 1 deletion PROJECT
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
domain: k8s.pf9.io
layout:
- go.kubebuilder.io/v3
multigroup: true
projectName: luigi
repo: github.com/platform9/luigi
resources:
Expand All @@ -14,4 +13,7 @@ resources:
kind: NetworkPlugins
path: github.com/platform9/luigi/api/v1
version: v1
webhooks:
validation: true
webhookVersion: v1
version: "3"
99 changes: 64 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,61 @@
# Luigi

Luigi is a Kubernetes Operator to deploy, manage, and upgrade advanced networking plugins. The default Kubernetes networking model with one CNI and cluster-wide network can be too restrictive for many advanced networking use cases like NFV or virtualization

There are many discrete plugins and solutions, but knowing which ones to use, deploying and managing them can be tedious. Secondary CNIs? Multus? SRIOV? Device plugins? OVS? Which IPAM? What's the current Linux networking state of my nodes? How do I configure my nodes in order to support all of these?

# How to deploy
This will require an already working K8s cluster with DNS and a primary CNI up and running.
## How to deploy

This will require an already working K8s cluster with DNS and a primary CNI up and running.
Deploy the manifest found in samples in this repo:
```

```shell
kubectl apply -f https://raw.githubusercontent.com/platform9/luigi/master/samples/luigi-plugins-operator.yaml
```

A deployment of 1 replica will be created in the luigi-system namespace.

Or, To get started sign up for Platform9 Managed Kubernetes(PMK) for free at platform9.com/signup, see more about our Telco 5G offerings at platform9.com/solutions/telco-5g or contact us at platform9.com/contact. With PMK, Luigi will already be deployed and managed itself

# Plugins supported
## How to build

Platform9 publishes the images to Docker Hub under platform9 organisation.

- Luigi image is published as
`platform9/luigi-plugins:<version tag>`
- Hostplumber image is published as
`platform9/hostplumber:<version tag>`

The version tag is set to the git tag in git repository.
In the absence of a tag, it is set to [git branch]-pmk-[git revision id]

Override the version tag using env variable

- For Luigi:
`OVERRIDE_LUIGI_VERSION`
- For Hostplumber:
`OVERRIDE_HOSTPLUMBER_VERSION`

## Plugins supported

The scope of each plugin is beyond this documentation. But if you know you need it, luigi will deploy the following:

- HostPlumber: A subset of Luigi, an operator to configure/prep networking on the node and retrieve node details
- See: https://github.com/platform9/luigi/blob/master/hostplumber/README.md
- Use to create SRIOV VFs, configure OVS, create VLAN interfaces, etc...
- Recommended unless you have your own tooling to configure nodes
- Multus
- Almost always required - the only way K8S can support multiple CNIs and networks
- SRIOV CNI
- SRIOV Device Plugin
- OpenVSwitch daemon & CLI tools
- OVS CNI plugin
- Macvlan, IPvlan
- Whereabouts IPAM driver
- Required for dynamic IP assignment without an external DHCP service.
- Node Feature Discovery

# Configuration:
- HostPlumber: A subset of Luigi, an operator to configure/prep networking on the node and retrieve node details
- See: [README.md](https://github.com/platform9/luigi/blob/master/hostplumber/README.md)
- Use to create SRIOV VFs, configure OVS, create VLAN interfaces, etc...
- Recommended unless you have your own tooling to configure nodes
- Multus
- Almost always required - the only way K8S can support multiple CNIs and networks
- SRIOV CNI
- SRIOV Device Plugin
- OpenVSwitch daemon & CLI tools
- OVS CNI plugin
- Macvlan, IPvlan
- Whereabouts IPAM driver
- Required for dynamic IP assignment without an external DHCP service.
- Node Feature Discovery

## Configuration

**namespace**: Each plugin will take in a namespace override to deploy, default namespace otherwise

Expand All @@ -42,21 +66,23 @@ The scope of each plugin is beyond this documentation. But if you know you need
**privateRegistryBase**: Some airgapped env's may have a custom container registry. If this is specified, it will replace the public container registry URL (docker.io, gcr.io, quay, etc..) with this path

Each plugin may or may not have some further specific configuration. Here are the current options as of release v0.3:
- HostPlumber - none
- Multus - none
- SRIOV - none
- Node-feature-discovery - none
- OVS - none
- Whereabouts
- ipReconcilerSchedule - specify the CronJob schedule of the whereabouts IP cleanup Job
- ipReconcilerNodeSelector - specify the nodeSelector Labels on which to schedule the ip-reconciler

# NetworkPlugins CRD:

- HostPlumber - none
- Multus - none
- SRIOV - none
- Node-feature-discovery - none
- OVS - none
- Whereabouts
- ipReconcilerSchedule - specify the CronJob schedule of the whereabouts IP cleanup Job
- ipReconcilerNodeSelector - specify the nodeSelector Labels on which to schedule the ip-reconciler

## NetworkPlugins CRD

In it's current phase, only one instance of the CRD is supported. It will reflect the final, desired state of all plugins to be deployed.

If it is present, Luigi will ensure that the plugin is deployed and upgraded. If missing and re-applied, Luigi will remove the plugin if it was previously managing it.

```
```YAML
apiVersion: plumber.k8s.pf9.io/v1
kind: NetworkPlugins
metadata:
Expand All @@ -70,8 +96,6 @@ spec:
multus: {}
whereabouts:
ipReconcilerSchedule: "*/1 * * * *"
ipReconcilerNodeSelector:
foo: bar
# SRIOV actually consists of two plugins - the CNI, and the device-plugin
# Use HostPlumber to create the actual VFs
sriov: {}
Expand All @@ -80,7 +104,7 @@ spec:

The above will deploy all the plugins specified in the default namespace. To override the namespace, and deploy in kube-system:

```
```YAML
apiVersion: plumber.k8s.pf9.io/v1
kind: NetworkPlugins
metadata:
Expand All @@ -100,4 +124,9 @@ spec:
namespace: "kube-system"
```

That is it! Now that you have the secondary CNIs and other related plugins deployed, you may need to prep the nodes before you can actually create Multus Networks and assign them to Pods. In order to do so, use Luigi's own HostPlumber plugin: https://github.com/platform9/luigi/blob/master/hostplumber/README.md
That is it! Now that you have the secondary CNIs and other related plugins deployed, you may need to prep the nodes before you can actually create Multus Networks and assign them to Pods. In order to do so, use Luigi's own HostPlumber plugin. See [README for HostPlumber](https://github.com/platform9/luigi/blob/master/hostplumber/README.md)

## Dev note

This project needs to migrate to Kubebuilder/v4.
webhooks where added manually `make generate && make manifestes` will not add required field for webhook in crds and luigi deployment. refer `samples/luigi-plugins-operator-v2.yaml`
Loading