Skip to content

Instantly share code, notes, and snippets.

@krsna1729
krsna1729 / Dockerfile
Last active January 25, 2019 23:00
{multus-cni, sriov-cni, centralip, sriov-device-plugin} Dockerfile and Daemonset for M-CORD
# Build multus plugin
FROM golang:1.10 AS multus
RUN git clone -q --depth 1 https://github.com/intel/multus-cni.git /go/src/github.com/intel/multus-cni
WORKDIR /go/src/github.com/intel/multus-cni
RUN ./build
# Build sriov plugin
FROM golang:1.10 AS sriov-cni
RUN git clone -q -b dev/k8s-deviceid-model https://github.com/Intel-Corp/sriov-cni.git /go/src/github.com/intel-corp/sriov-cni
WORKDIR /go/src/github.com/intel-corp/sriov-cni
@krsna1729
krsna1729 / afpacket.bess
Last active December 14, 2018 19:12
AF_PACKET testing with BESS
s1u = PMDPort(name="s1u", vdev="net_af_packet0,iface=s1u")
sgi = PMDPort(name="sgi", vdev="net_af_packet1,iface=sgi")
s1u_dpdk = PMDPort(name="s1u_dpdk", port_id=0)
sgi_dpdk = PMDPort(name="sgi_dpdk", port_id=1)
PortInc(port=s1u_dpdk.name) -> PortOut(port=s1u.name)
PortInc(port=s1u.name) -> PortOut(port=s1u_dpdk.name)
PortInc(port=sgi_dpdk.name) -> PortOut(port=sgi.name)
@krsna1729
krsna1729 / openapi-to-code.md
Created November 15, 2018 22:15
openapi generate stub code

Generate golang server code from the openapi v3 spec

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i https://raw.githubusercontent.com/jdegre/5GC_APIs/master/TS29502_Nsmf_PDUSession.yaml \
-g go-server -o /local/out/smf_PDUSession_server \
--skip-validate-spec
@krsna1729
krsna1729 / setup-k8s-ctrd.sh
Last active November 5, 2018 17:56
install kubernetes with containerd. no docker
#!/bin/bash
set -o errexit
set -o pipefail
echo "Pre-reqs"
sudo apt-get -y install wget
sudo modprobe br_netfilter
sudo swapoff -a
VERSION="1.1.4"
@krsna1729
krsna1729 / install-go.sh
Last active March 9, 2019 05:48
install go
sudo su
GO_VER=1.12
wget https://dl.google.com/go/go${GO_VER}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go${GO_VER}.linux-amd64.tar.gz
echo 'export PATH="$PATH:/usr/local/go/bin"' | tee -a /etc/profile
echo 'export GOPATH="$HOME/go"' | tee -a /etc/profile
echo 'export PATH="$PATH:$GOPATH/bin"' | tee -a /etc/profile
@krsna1729
krsna1729 / kubeadm.yaml
Last active December 18, 2018 21:50
customize kubeadm using config file
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
maxPods: "2000"
---
apiVersion: kubeadm.k8s.io/v1alpha3
kind: ClusterConfiguration
kubernetesVersion: stable-1.11
api:
bindPort: 443
@krsna1729
krsna1729 / dpdk-static-link.md
Last active November 2, 2021 21:03
compile statically linked dpdk apps
@krsna1729
krsna1729 / cmake-dpdk-app.md
Last active January 31, 2024 21:07
compiling dpdk apps using cmake

Compiling DPDK and set environment var

cd dpdk
make config T=x86_64-native-linuxapp-gcc
make -j
export RTE_SDK=$(pwd)

Create CMakeLists.txt file for linking sample app with DPDK

@krsna1729
krsna1729 / packer-build-appliance-images.md
Last active November 5, 2018 17:39
building appliance images using packer

Download Packer binary from here and add it to your path. Qemu and associated utilities will be needed.

Its better to use Bento project as a starting point and customize with extra scripts we need, rather than maintaining all of the configs needed to build with Packer. QEMU is supported even though its not listed. Command would be

packer build -only=qemu -var headless=true ubuntu-16.04-amd64.json

The below json is a packer-template to create an ubuntu 16.04 based appliance image, that would output qcow2 image for production, as well as box for developers to work with vagrant. User can pass variables using -var flag from packer build command-line to override defaults.

#################################################
# Install
# sudo -E apt-get update && sudo -E apt-get install -y git dh-autoreconf linux-image-extra-$(uname -r)
sudo -E dnf -y install make git python python-devel autoconf automake libtool kernel-devel-$(uname -r) kernel-modules-$(uname -r) psmisc pciutils
pip install --user six

export MY_DIR=$(pwd)
export DPDK_TAG=v16.11
export OVS_TAG=branch-2.7