Building Trident has following requirements:
- Glide 0.12.2 or greater.
- Docker 1.10 or greater when using the Makefile targets.
- Go 1.9 or greater is optionally required when building Trident natively.
Use make build
to fetch dependencies, run a containerized build, and generate
Trident images. This is the simplest and the recommended way to build Trident.
Before building Trident natively, its dependencies must be fetched using Glide 0.12.2 or greater. If Glide is already installed, run
glide install -v
The -v
flag is necessary to strip vendored dependencies from the
Kubernetes package. Alternatively, if Glide is not installed, running
make get
will fetch, build, and install Glide natively and then runs the glide install
command above.
Once the dependencies have been fetched, Trident can be built with go build
.
Multiple Makefile targets, many of which are containerized, are available for building Trident. However, Glide is a native dependency.
The targets take the following environment variables as parameters:
$REGISTRY_ADDR
: IP address and port of a local Docker registry.$TRIDENT_IMAGE
: name for the Trident Docker image; defaults totrident
.$TRIDENT_VERSION
: tag for the Trident Docker image; defaults to the last stable release version for Trident.$BIN
: name of the output binary. Defaults totrident_orchestrator
.
-
make get
: Fetches, builds, and installs Glide natively. Then callsglide install
to fetch dependencies. -
make build
: Builds Trident and builds Trident launcher. Seetrident_build_all
andlauncher_build
targets for additional detail. -
make clean
: Removes containers, container images, and build artifacts inbin/
. -
make dist
: Builds Trident and creates the Trident installer package. -
make install
: Calls thebuild
target and then runs containerizedgo install
. -
make test
: Starts an etcd container (for use by the tests incore/
andpersistent_store/
) and runsgo test
on the project. Unlike most other targets, this performs a native build. -
make vet
: Runsgo vet
. -
make trident_build
: Builds Trident in a Go container, placing the trident_orchestrator and tridentctl binaries intobin/
. A docker image is created and tagged as[$REGISTRY_ADDR/]$TRIDENT_IMAGE:$VERSION_TAG
, with the bracketed portion omitted if$REGISTRY_ADDR
is unset. This tag defaults totrident
. -
make trident_build_all
: Executes theget
target, which fetches Trident's dependencies, prior to callingtrident_build
. -
make tridentctl_build
: Builds only the tridentctl binary. The$GOOS
and$GOARCH
environment variables can be set to compile the tridentctl binary for an unsupported target system.