e72689f456
ViNO will need to be able to "bubble up" information about the physical hosts and label the nodes appropriately. The target of this change is to add the VM Bridge Interface IP address as a label. To accomplish this, this change: - Adds nodelabeler/main.go containing code based off code from [0] this code is responsible for labeling a variable node, with the ip address obtained from a variable interface name - Adds a dockerfile to place the binary created by nodelabeler/main.go in a minimal image to be run as a DaemonSet - Adds a DaemonSet responsible for spawning this container on each host. Notably the hostNetwork: true flag is used in order to get the correct interface name and IP address. - Minor changes to go.mod and go.sum as new dependencies are introduced by nodelabeler/main.go [0] https://github.com/vexxhost/node-labeler Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me> Change-Id: Ibdaef6dc08bcfaccbead29eee29787971c2399d0
33 lines
1.3 KiB
Docker
33 lines
1.3 KiB
Docker
# Default base images for builder and release images, can be overriden during build
|
|
ARG BUILDER_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.13
|
|
ARG RELEASE_IMAGE=scratch
|
|
|
|
# Create the binary in a builder image, so the release image can be kept small
|
|
FROM ${BUILDER_IMAGE} as builder
|
|
|
|
ENV PATH "/usr/local/go/bin:$PATH"
|
|
|
|
SHELL [ "/bin/bash", "-cex" ]
|
|
WORKDIR /usr/src/nodelabeler
|
|
|
|
# Take advantage of caching for dependency acquisition
|
|
COPY go.mod go.sum /usr/src/nodelabeler/
|
|
RUN go mod download
|
|
|
|
# Create a static binary - because net package is used, a dynamic binary will not work with scratch
|
|
COPY nodelabeler/main.go /usr/src/nodelabeler/
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags="-w -s -extldflags '-static'" -o /go/bin/nodelabeler
|
|
|
|
# Transfer the binary to a clean release image
|
|
FROM ${RELEASE_IMAGE}
|
|
|
|
LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode' \
|
|
org.opencontainers.image.url='https://airshipit.org' \
|
|
org.opencontainers.image.documentation='https://docs.airshipit.org/nodelabeler/' \
|
|
org.opencontainers.image.source='https://opendev.org/airship/nodelabeler' \
|
|
org.opencontainers.image.vendor='The Airship Authors' \
|
|
org.opencontainers.image.licenses='Apache-2.0'
|
|
|
|
COPY --from=builder /go/bin/nodelabeler /go/bin/nodelabeler
|
|
USER 65534
|
|
CMD ["./go/bin/nodelabeler"] |