Skip to content

Instantly share code, notes, and snippets.

View anfernee's full-sized avatar

Yongkun Anfernee Gui anfernee

  • Google
  • San Francisco Bay area
View GitHub Profile

Prerequisite

Create VM in google cloud:

gcloud compute instances create $INSTANCE --image-project=ubuntu-os-cloud --image-family ubuntu-2004-lts --min-cpu-platform="Intel Skylake" --machine-type="n1-standard-32" --zone=us-central1-c --network-interface='' --network-interface network=custom-network1,subnet=subnet1 

Install libvirt:

sudo apt update && sudo apt install libvirt-daemon-system libvirt-clients virtinst

List available filter functions:

cat /sys/kernel/debug/tracing/available_filter_functions

ChatGPT says:

cat /proc/kallsyms | grep ' [Tt] '
2023-06-22T03:48:44Z [debug] Used defaults from parsed flat file config @ /etc/cni/net.d/whereabouts.d/whereabouts.conf
2023-06-22T03:48:44Z [debug] ADD - IPAM configuration successfully read: {Name:whereaboutsexample Type:whereabouts Routes:[] Addresses:[] IPRanges:[{OmitRanges:[] Range:192.168.2.224/28 RangeStart:192.168.2.224 RangeEnd:<nil>}] OmitRanges:[] DNS:{Nameservers:[] Domain: Search:[] Options:[]} Range: RangeStart:<nil> RangeEnd:<nil> GatewayStr: LeaderLeaseDuration:1500 LeaderRenewDeadline:1000 LeaderRetryPeriod:500 LogFile:/var/log/whereabouts.log LogLevel:debug ReconcilerCronExpression:30 4 * * * OverlappingRanges:true SleepForRace:0 Gateway:<nil> Kubernetes:{KubeConfigPath:/etc/cni/net.d/whereabouts.d/whereabouts.kubeconfig K8sAPIRoot:} ConfigurationPath: PodName:netshoot-deployment-77bc5477c4-dc7mw PodNamespace:default NetworkName:}
2023-06-22T03:48:44Z [debug] Beginning IPAM for ContainerID: ceed7f96e1b31566dec70bdde1d6ea7b8f20ce1f8c3599b4415ba9e7acf3db00
2023-06-22T03:48:44Z [debug] Started
# Install the necessary tools.
sudo apt-get update && sudo apt-get install build-essential git make coreutils -y
# Install clang-10 llvm-10.
echo "Running ebpf unit test, installing clang-10 and llvm-10"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 15CF4D18AF4F7421
sudo add-apt-repository -y "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main"
sudo apt-get update && sudo apt install clang-10 llvm-10 -y
# Install the newest version of golang.
# Install the newest version of golang.
sudo add-apt-repository ppa:longsleep/golang-backports -y && sudo apt update && sudo apt install golang-go -y
# Install clang-11 and llvm-11 and make
sudo apt install clang-11 llvm-11 -y make
# Update the clang command used for test
export CLANG=clang-11
export LLC=llc-11
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: kindnet
namespace: kube-system
labels:
tier: node
app: kindnet
k8s-app: kindnet
@anfernee
anfernee / nginx.yaml
Created September 10, 2022 05:01
k8s manifests
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
# Generated by iptables-save v1.6.1 on Wed Aug 4 16:59:19 2021
*mangle
:PREROUTING ACCEPT [856536:2689798381]
:INPUT ACCEPT [846190:2658161040]
:FORWARD ACCEPT [10346:31637341]
:OUTPUT ACCEPT [838510:556224859]
:POSTROUTING ACCEPT [848856:587862200]
:KUBE-KUBELET-CANARY - [0:0]
:KUBE-PROXY-CANARY - [0:0]
COMMIT
Serial port 1 (console) output for gke-a54a21-cppv
�[2J�[01;01H�[=3h�[2J�[01;01HCSM BBS Table full.
BdsDxe: loading Boot0001 "UEFI Google PersistentDisk " from PciRoot(0x0)/Pci(0x3,0x0)/Scsi(0x1,0x0)
BdsDxe: starting Boot0001 "UEFI Google PersistentDisk " from PciRoot(0x0)/Pci(0x3,0x0)/Scsi(0x1,0x0)

UEFI: Attempting to start image.
Description: UEFI Google PersistentDisk 
FilePath: PciRoot(0x0)/Pci(0x3,0x0)/Scsi(0x1,0x0)
OptionNumber: 1.

THE PR

The PR contains 2 commits: one fix to the datapath; the other e2e test which tests both the fix and the basic funtionatlity. The problem is the basic functionality part fails the e2e test. However, it is only reproducible in e2e test, not in dev cluster. We also included the same functionality in Anthos. I haven't figured out the reason.

Prerequisite

You would need a Linux machine (Ubuntu is fine), and install virtualbox on the machine.