From a429a7e5f4acf818903c0f9237b14def36c0ab66 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 11 Feb 2022 15:27:55 -0500 Subject: [PATCH] Document how to build a custom image * Patch Makefile to allow overriding the APP_NAME, so any image can be built using `make image`. * Add some docs about how to build & use an image. --- Makefile | 2 +- doc/hacking.md | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dbdbc4929..286d6173c 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ DOCKERFILE?=Dockerfile CRD_BASES=./config/crd/bases -export APP_NAME=sriov-network-operator +export APP_NAME?=sriov-network-operator TARGET=$(TARGET_DIR)/bin/$(APP_NAME) IMAGE_TAG?=ghcr.io/k8snetworkplumbingwg/$(APP_NAME):latest MAIN_PKG=cmd/manager/main.go diff --git a/doc/hacking.md b/doc/hacking.md index 390029ab7..5b6be6f9e 100644 --- a/doc/hacking.md +++ b/doc/hacking.md @@ -71,3 +71,29 @@ Identify controller-runtime version referenced by kubebuilder Check controller-runtime's go.mod file As a result, we can determine the versions of the k8s dependencies in the operator's go.mod. + +## Build an custom image + +To build the SR-IOV network operator container image: + + ```bash + make image + +If you want to build another image (e.g. webhook or config-daemon), you'll need to do +the following: + + ```bash + export DOCKERFILE=Dockerfile.sriov-network-config-daemon + export APP_NAME=sriov-network-config-daemon + make image + + export DOCKERFILE=Dockerfile.webhook + export APP_NAME=sriov-network-webhook + make image + +Then you'll need to push the image to a registry using e.g. `buildah push`. +Before deploying the Operator, you want to export these variables to use that custom image: + + ```bash + export SRIOV_NETWORK_CONFIG_DAEMON_IMAGE= + (...)