-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile.ovn-kubernetes.ubuntu
More file actions
85 lines (62 loc) · 3.69 KB
/
Dockerfile.ovn-kubernetes.ubuntu
File metadata and controls
85 lines (62 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
# The standard name for this image is ovn-kube-ubuntu
# Notes:
# This is for a development build where the ovn-kubernetes utilities
# are built in this Dockerfile and included in the image (instead of the deb package)
#
#
# So this file will change over time.
ARG BUILDER_IMAGE
#############################################
# Stage to build OVN Kubernetes from Source #
#############################################
FROM --platform=${BUILDPLATFORM} ${BUILDER_IMAGE} AS ovnkube-builder
ARG TARGETARCH
ARG TARGETOS=linux
ARG OVN_KUBERNETES_DIR
WORKDIR /workspace
COPY ${OVN_KUBERNETES_DIR} ovn-kubernetes
# Fix the git repository for the submodule so that it points to an actual git repository.
# The ovn-kubernetes build process relies on having access to git information and can not be built as a submodule.
RUN rm -rf ovn-kubernetes/.git
COPY .git/modules/${OVN_KUBERNETES_DIR} ovn-kubernetes/.git
RUN sed -i '/worktree = /d' ovn-kubernetes/.git/config
# Build the OVN Kubernetes binaries using the make target inside its repo.
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} make -C ovn-kubernetes/dist/images bld
#################################
# Main Ubuntu Image Stage #
#################################
FROM ubuntu:25.10
ARG TARGETARCH
ARG TARGETOS=linux
USER root
RUN apt-get update && apt-get install -y iproute2 curl software-properties-common util-linux nftables
# Install OVS and OVN packages.
RUN apt-get update && apt-get install -y openvswitch-switch openvswitch-common ovn-central ovn-common ovn-host
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${TARGETARCH}/kubectl" \
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
RUN mkdir -p /var/run/openvswitch
# Built in ../../go_controller, then the binaries are copied here.
# put things where they are in the pkg
RUN mkdir -p /usr/libexec/cni/
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/ovnkube /workspace/ovn-kubernetes/dist/images/ovn-kube-util /workspace/ovn-kubernetes/dist/images/ovndbchecker /workspace/ovn-kubernetes/dist/images/hybrid-overlay-node /workspace/ovn-kubernetes/dist/images/ovnkube-identity /workspace/ovn-kubernetes/dist/images/ovnkube-observ /usr/bin/
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/ovn-k8s-cni-overlay /usr/libexec/cni/ovn-k8s-cni-overlay
# ovnkube.sh is the entry point. This script examines environment
# variables to direct operation and configure ovn
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/ovnkube.sh /root/
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/ovndb-raft-functions.sh /root/
# override the pkg's ovn_k8s.conf with this local copy
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/ovn_k8s.conf /etc/openvswitch/ovn_k8s.conf
# copy git commit number into image
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/git_info /root
# iptables wrappers
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/iptables-scripts/iptables /usr/sbin/
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/iptables-scripts/iptables-save /usr/sbin/
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/iptables-scripts/iptables-restore /usr/sbin/
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/iptables-scripts/ip6tables /usr/sbin/
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/iptables-scripts/ip6tables-save /usr/sbin/
COPY --from=ovnkube-builder /workspace/ovn-kubernetes/dist/images/iptables-scripts/ip6tables-restore /usr/sbin/
LABEL io.k8s.display-name="ovn-kubernetes" \
io.k8s.description="ovnkube ubuntu image"
WORKDIR /root
ENTRYPOINT /root/ovnkube.sh