Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/linters/.codespellrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[codespell]
skip = *.pdf,*.png,*.jpg,*.gif,*.ico,go.sum
ignore-words-list = notin,NotIn
1 change: 1 addition & 0 deletions .github/linters/.gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ title = "gitleaks config"
paths = [
'''^\.?gitleaks.toml$''',
'''topo/node/srl/generate_certificate_success$''', # exclude dummy test file with random cert
'''x/webhook/manifests/tls\.secret\.yaml$''',
'''(.*?)super-linter.log$''', # exclude linter logs which might contain past errored runs with keys/certs
'''(.*?)(png|jpg|gif|doc|docx|pdf|bin|xls|pyc|zip)$''',
'''(go.mod|go.sum)$'''
Expand Down
4 changes: 3 additions & 1 deletion .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
default: true
extends: markdownlint/style/prettier

MD001: false # header levels

MD013: false # line length

MD028: false # blank lines between indents

MD033: false # inline HTML
MD033: false # inline HTML
103 changes: 52 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,51 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/openconfig/kne)](https://goreportcard.com/report/github.com/openconfig/kne)
[![GoDoc](https://godoc.org/istio.io/istio?status.svg)](https://pkg.go.dev/github.com/openconfig/kne)
[![License: BSD](https://img.shields.io/badge/license-Apache%202-blue)](https://opensource.org/licenses/Apache-2.0)
[![GitHub Super-Linter](https://github.com/openconfig/kne/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter)
[![Coverage Status](https://coveralls.io/repos/github/openconfig/kne/badge.svg?branch=main)](https://coveralls.io/github/openconfig/kne?branch=main)

This is not an officially supported Google product.

## Goal

For network emulation, there are many approaches using VM's for emulation of a
hardware router. Arista, Cisco, Juniper, Drivenets, and Nokia have multiple implementations
of their network operating system and various generations of hardware emulation.
These systems are very good for most validation of vendor control plane
implementations and data plane for limited certifications. The idea of this
project is to provide a standard "interface" so that vendors can produce a
standard container implementation which can be used to build complex topologies.

* Have standard lifecycle management infrastructure for allowing multiple vendor
device emulations to be present in a single "topology"
* Allow for control plane access via standard k8s networking
* Provide a common networking interface for the forwarding plane between network
pods.
* Data plane wires between pods
* Control plane wires between topology manager
* Define service implementation for allowing interaction with the topology
hardware router. Arista, Cisco, Juniper, Drivenets, and Nokia have multiple
implementations of their network operating system and various generations of
hardware emulation. These systems are very good for most validation of vendor
control plane implementations and data plane for limited certifications. The
idea of this project is to provide a standard "interface" so that vendors can
produce a standard container implementation which can be used to build complex
topologies.

- Have standard lifecycle management infrastructure for allowing multiple
vendor device emulations to be present in a single "topology"
- Allow for control plane access via standard k8s networking
- Provide a common networking interface for the forwarding plane between
network pods.
- Data plane wires between pods
- Control plane wires between topology manager
- Define service implementation for allowing interaction with the topology
manager service.
* Topology manager is the public API for allowing external users to manipulate
the link state in the topology.
* The topology manager will run as a service in k8s environment.
* It will provide a gRPC interface for tests to interact with
* It will listen to CRDs published via the network device pods for discovery
* Data plane connections for connectivity between pods must be a public
- Topology manager is the public API for allowing external users to
manipulate the link state in the topology.
- The topology manager will run as a service in k8s environment.
- It will provide a gRPC interface for tests to interact with
- It will listen to CRDs published via the network device pods for
discovery
- Data plane connections for connectivity between pods must be a public
transport mechanism
* This can't be implemented as just exposing "x eth devices on the pod"
because Linux doesn't understand the associated control messages which are
needed to make this work like a wire.
* Transceiver state, optical characteristics, wire state, packet filtering /
shaping / drops
* LACP or other port aggregation protocols or APS cannot be simulated
- This can't be implemented as just exposing "x eth devices on the pod"
because Linux doesn't understand the associated control messages which
are needed to make this work like a wire.
- Transceiver state, optical characteristics, wire state, packet filtering
/ shaping / drops
- LACP or other port aggregation protocols or APS cannot be simulated
correctly
* The topology manager will start a topology agent on each host for the pod to
directly interact with.
* The topology agent will provide the connectivity between nodes
* Define how pods boot an initial configuration
* Ideally, this method would allow for dynamic
* Define how pods express services for use in-cluster as well as external
- The topology manager will start a topology agent on each host for the
pod to directly interact with.
- The topology agent will provide the connectivity between nodes
- Define how pods boot an initial configuration
- Ideally, this method would allow for dynamic
- Define how pods express services for use in-cluster as well as external
services

## Use Cases
Expand Down Expand Up @@ -88,23 +89,23 @@ Kubernetes Network Emulation (KNE).

### Usage Metrics Reporting

The KNE CLI optionally collects anonymous usage metrics. **This is turned OFF
by default.** We use the metrics to gauge the health and performance of various
KNE operations (i.e. cluster deployment, topology creation) on an **opt-in**
basis. There is a global flag `--report_usage` that when provided shares
anonymous details about certain KNE CLI commands. Collected data can be seen in
the [event proto definition](proto/event.proto). **Usage metrics are NOT shared
by default.** Additionally the PubSub project and topic the events are published
to are configurable. If you want to track your own private metrics about your
KNE usage then that is supported by providing a Cloud PubSub project/topic of
your choosing. Full details about how/when usage events are published can be
found in the codebase [here](metrics/metrics.go). We appreciate usage metric
reporting as it helps us develop a better KNE experience for all of our users.
Whether that be detecting an abnormally high number of cluster deployment
failures due to an upgrade to an underlying dependency introduced by a new
commit, or detecting a bug from a scenario where the failure rate for topologies
over *n* links is far greater than *n-1* links. Usage metric reporting is
helpful tool for the KNE developers.
The KNE CLI optionally collects anonymous usage metrics. **This is turned OFF by
default.** We use the metrics to gauge the health and performance of various KNE
operations (i.e. cluster deployment, topology creation) on an **opt-in** basis.
There is a global flag `--report_usage` that when provided shares anonymous
details about certain KNE CLI commands. Collected data can be seen in the
[event proto definition](proto/event.proto). **Usage metrics are NOT shared by
default.** Additionally the PubSub project and topic the events are published to
are configurable. If you want to track your own private metrics about your KNE
usage then that is supported by providing a Cloud PubSub project/topic of your
choosing. Full details about how/when usage events are published can be found in
the [codebase](metrics/metrics.go). We appreciate usage metric reporting as it
helps us develop a better KNE experience for all of our users. Whether that be
detecting an abnormally high number of cluster deployment failures due to an
upgrade to an underlying dependency introduced by a new commit, or detecting a
bug from a scenario where the failure rate for topologies over _n_ links is far
greater than _n-1_ links. Usage metric reporting is helpful tool for the KNE
developers.

## Thanks

Expand Down
55 changes: 33 additions & 22 deletions cloudbuild/postsubmit.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,46 @@
---
steps:
- id: packer_init_external
name: "us-west1-docker.pkg.dev/gep-kne/packer/packer:1.9.1"
args: ["init", "cloudbuild/external.pkr.hcl"]
waitFor: ["-"] # run the builds concurrently

args:
- "init"
- "cloudbuild/external.pkr.hcl"
waitFor:
- "-" # run the builds concurrently

- id: packer_build_external
name: "us-west1-docker.pkg.dev/gep-kne/packer/packer:1.9.1"
args: ["build", "cloudbuild/external.pkr.hcl"]
env: [
"PKR_VAR_build_id=$BUILD_ID",
"PKR_VAR_short_sha=$SHORT_SHA",
"PKR_VAR_branch_name=$BRANCH_NAME",
"PKR_VAR_zone=${_ZONE}",
]
waitFor: [packer_init_external]

args:
- "build"
- "cloudbuild/external.pkr.hcl"
env:
- "PKR_VAR_build_id=$BUILD_ID"
- "PKR_VAR_short_sha=$SHORT_SHA"
- "PKR_VAR_branch_name=$BRANCH_NAME"
- "PKR_VAR_zone=${_ZONE}"
waitFor:
- packer_init_external

- id: packer_init_internal
name: "us-west1-docker.pkg.dev/gep-kne/packer/packer:1.9.1"
args: ["init", "cloudbuild/internal.pkr.hcl"]
waitFor: ["-"] # run the builds concurrently
args:
- "init"
- "cloudbuild/internal.pkr.hcl"
waitFor:
- "-" # run the builds concurrently

- id: packer_build_internal
name: "us-west1-docker.pkg.dev/gep-kne/packer/packer:1.9.1"
args: ["build", "cloudbuild/internal.pkr.hcl"]
env: [
"PKR_VAR_build_id=$BUILD_ID",
"PKR_VAR_short_sha=$SHORT_SHA",
"PKR_VAR_branch_name=$BRANCH_NAME",
"PKR_VAR_zone=${_ZONE}",
]
waitFor: [packer_init_internal]
args:
- "build"
- "cloudbuild/internal.pkr.hcl"
env:
- "PKR_VAR_build_id=$BUILD_ID"
- "PKR_VAR_short_sha=$SHORT_SHA"
- "PKR_VAR_branch_name=$BRANCH_NAME"
- "PKR_VAR_zone=${_ZONE}"
waitFor:
- packer_init_internal

timeout: 5400s

Expand Down
3 changes: 2 additions & 1 deletion cloudbuild/presubmit.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
steps:
- id: kne_test
name: us-west1-docker.pkg.dev/$PROJECT_ID/utilities/remote-builder
Expand Down Expand Up @@ -26,4 +27,4 @@ timeout: 2700s

options:
pool:
name: 'projects/kne-external/locations/us-central1/workerPools/kne-cloudbuild-pool'
name: "projects/kne-external/locations/us-central1/workerPools/kne-cloudbuild-pool"
1 change: 1 addition & 0 deletions cloudbuild/vendors/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# kind-bridge.yaml cluster config file sets up a kind cluster where default PTP CNI plugin
# is swapped with the Bridge CNI plugin.
# Bridge CNI plugin is required by some Network OSes to operate.
---
cluster:
kind: Kind
spec:
Expand Down
1 change: 1 addition & 0 deletions cmd/deploy/testdata/kind-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
cluster:
kind: Kind
spec:
Expand Down
1 change: 1 addition & 0 deletions deploy/kne/external-multinode-cdnos.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# external-multinode.yaml cluster config file sets up ingress, cni, and controllers in an existing k8 cluster.
# This spec instructs Metallb to use a docker network named multinode.
# The "external" cluster lifecycle is not managed by the KNE deployment.
---
cluster:
kind: External
spec:
Expand Down
1 change: 1 addition & 0 deletions deploy/kne/external-multinode.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# external-multinode.yaml cluster config file sets up ingress, cni, and controllers in an existing k8 cluster.
# This spec instructs Metallb to use a docker network named multinode.
# The "external" cluster lifecycle is not managed by the KNE deployment.
---
cluster:
kind: External
spec:
Expand Down
1 change: 1 addition & 0 deletions deploy/kne/external.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# external.yaml cluster config file sets up ingress, cni, and controllers in an existing k8 cluster.
# The "external" cluster lifecycle is not managed by the KNE deployment.
---
cluster:
kind: External
ingress:
Expand Down
3 changes: 2 additions & 1 deletion deploy/kne/kind-bridge-cdnos.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# kind-bridge.yaml cluster config file sets up a kind cluster where default PTP CNI plugin
# is swapped with the Bridge CNI plugin.
# Bridge CNI plugin is required by some Network OSes to operate.
---
cluster:
kind: Kind
spec:
Expand Down Expand Up @@ -36,4 +37,4 @@ controllers:
operator: ../../manifests/controllers/lemming/manifest.yaml
- kind: Cdnos
spec:
operator: ../../manifests/controllers/cdnos/manifest.yaml
operator: ../../manifests/controllers/cdnos/manifest.yaml
1 change: 1 addition & 0 deletions deploy/kne/kind-bridge.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# kind-bridge.yaml cluster config file sets up a kind cluster where default PTP CNI plugin
# is swapped with the Bridge CNI plugin.
# Bridge CNI plugin is required by some Network OSes to operate.
---
cluster:
kind: Kind
spec:
Expand Down
1 change: 1 addition & 0 deletions deploy/kne/kubeadm.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# kubeadm.yaml cluster config file sets up ingress, cni, and controllers in a new k8 cluster
# created using kubeadm. The kubeadm cluster starts as a single node cluster but can be joined
# from other hosts to create a multinode cluster.
---
cluster:
kind: Kubeadm
spec:
Expand Down
33 changes: 17 additions & 16 deletions deploy/ubuntu/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: podrunner
subjects:
- kind: ServiceAccount
name: podrunner
namespace: default
- kind: ServiceAccount
name: podrunner
namespace: default
roleRef:
kind: ClusterRole
name: podrunner
Expand All @@ -19,19 +20,19 @@ metadata:
labels:
k8s-app: foo
rules:
- apiGroups: [""]
resources:
- pods
- services
- logs
verbs:
- create
- update
- patch
- delete
- get
- watch
- list
- apiGroups: [""]
resources:
- pods
- services
- logs
verbs:
- create
- update
- patch
- delete
- get
- watch
- list
---
apiVersion: v1
kind: ServiceAccount
Expand Down
Loading
Loading