This doc outlines how to build common-instancetypes
and which dependencies are required.
A Makefile
with common operations is supplied with this repository.
The following tools are required by each Makefile
target:
make
make lint
make generate
make readme
make schema
make validate
make test-lint
By default make
runs the lint
, validate
, readme
, test-lint
and test
targets and their dependencies.
The following targets are provided by the Makefile
make lint
: Run linting jobs on source and generated files.make generate
: Generate the common-instancetypes bundles. Output can be found in./_build
.make validate
: Validate generated files against the OpenAPI schema of KubeVirt.make schema
: Grab and convert the KubeVirt OpenAPI schema to a JSON schema to be used byvalidate
.make test
: Run unit tests against source files.make test-fmt
: Run go fmt against test source files.make test-vet
: Run go vet against test source files.make test-lint
: Run golangci-lint against test source files.make check-tree-clean
: Check for uncommitted changes in generated files.make cluster-functest
: Run functests against latest stable KubeVirt.make kubevirt-functest
: Run functests against latestmain
KubeVirt.make readme
: Regenerate the list of provided resources at the end ofREADME.md
.make clean
: Clean up generated files by otherMakefile
targets.make build_image
: Build container image which provides build dependencies.make push_image
: Build and push container image which provides build dependencies.make kustomize
: Install vendoredkustomize
from./tools
into./_bin
.make kubeconform
: Install vendoredkubeconform
from./tools
into./_bin
.make yq
: Install vendoredyq
from./tools
into./_bin
.make golangci-lint
: Installgolangci-lint
version specified inMakefile
into./_bin
.make deploy
: Deploycommon-instancetypes
to an external cluster.make functest
: Run functest against an external cluster.
A Dockerfile
is available that provides the openapi2jsonschema
, shellcheck
and yamllint
dependencies. The golang based depedencies are vendored in the ./tools
directory. To run them golang is required, which is also provided by the Dockerfile
.
To build and use this simply set the COMMON_INSTANCETYPES_CRI
env variable to docker
or podman
before running make build_image
:
$ COMMON_INSTANCETYPES_CRI=podman make build_image
$ COMMON_INSTANCETYPES_CRI=podman make
Run the following command to build the common-instancetypes bundles:
make
The resulting bundles can be found in the ./_build
directory.
kustomize is used to generate these resources before applying them to the cluster with kubectl
:
$ kustomize build | kubectl apply -f -
A number of resource specific kustomize build configs are also provided and allow limited generation. For instance the following command will generate and install only the VirtualMachineInstancetype
resources:
$ kustomize build VirtualMachineInstancetypes | kubectl apply -f -
Additional targets are avilable for VirtualMachineClusterInstancetypes
, VirtualMachineClusterPreferences
and VirtualMachinePreferences
.
This repository contains following methods to spin up a cluster for testing purposes:
make cluster-{up|sync|down}
- Spin up a kubevirtci cluster and install the latest release of KubeVirt.
make kubevirt-{up|sync|down}
- Spin up a kubevirtci cluster and build and install the latest
main
KubeVirt.
- Spin up a kubevirtci cluster and build and install the latest
The sync
target syncs resources on the cluster with the local tree.
For more documentation on the usage of kubevirtci clusters see kubevirtci's README.md.