Skip to content

Instantly share code, notes, and snippets.

@junka
Last active May 7, 2024 09:52
Show Gist options
  • Save junka/11d7d31d9c08e8d1116f83572a6483af to your computer and use it in GitHub Desktop.
Save junka/11d7d31d9c08e8d1116f83572a6483af to your computer and use it in GitHub Desktop.
Dockerfile for gobgp
# syntax = docker/dockerfile:experimental
FROM debian:buster
LABEL maintainer="wan.junjie@foxmail.com"
ARG VER
ARG DEBIAN_FRONTEND=noninteractive
ARG TARGETARCH
RUN apt-get update
RUN apt-get -qy install curl ca-certificates
ENV HOME /root
WORKDIR /root
RUN curl -sSf -O -L --retry 5 https://github.com/osrg/gobgp/releases/download/v${VER}/gobgp_${VER}_linux_${TARGETARCH}.tar.gz
RUN tar -C /usr/local/bin -xzvf gobgp_${VER}_linux_${TARGETARCH}.tar.gz
CMD [ "gobgpd", "-f", "/etc/gobgp/gobgp.conf" ]
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: gobgp
namespace: kube-system
annotations:
kubernetes.io/description: |
This daemonset launches the gobgp dameon.
spec:
selector:
matchLabels:
app: gobgp
updateStrategy:
type: OnDelete
template:
metadata:
labels:
app: gobgp
component: network
type: infra
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: role
operator: In
values:
- ovngw
- ovngw-dpdk
tolerations:
- operator: Exists
effect: NoSchedule
priorityClassName: system-cluster-critical
serviceAccountName: ovn
hostNetwork: true
hostPID: true
containers:
- name: gobgp
image: "your.private.hub/gobgp:2.22.0"
imagePullPolicy: IfNotPresent
command: ["gobgpd -f /etc/gobgp/gobgp.conf"]
securityContext:
runAsUser: 0
privileged: true
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.NodeName
volumeMounts:
- mountPath: /etc/gobgp
name: host-etc-gobgp
readinessProbe:
exec:
command:
- gobgp
- neighbor
periodSeconds: 30
livenessProbe:
exec:
command:
- gobgp
- neighbor
initialDelaySeconds: 10
periodSeconds: 30
failureThreshold: 30
resources:
requests:
memory: 256Mi
limits:
memory: 512Mi
nodeSelector:
kubernetes.io/os: "linux"
volumes:
- name: host-etc-gobgp
hostPath:
path: /etc/gobgp
REGISTRY=your.private.hub
gobgpVER=2.22.0
gobgp:
docker buildx build --platform linux/amd64,linux/arm64 --build-arg VER=${gobgpVER} -t ${REGISTRY}/gobgp:${gobgpVER} -f Dockerfile.gobgp . --push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment