Skip to content

Latest commit

 

History

History
127 lines (90 loc) · 4.81 KB

BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md

File metadata and controls

127 lines (90 loc) · 4.81 KB

Overview

This document explains how to install kind ("kubernetes in docker"), including a local docker registry, create a kubernetes cluster, build forklift from source and install it on that cluster.

We also install kubevirt so that the cluster can be used as a VM migration target.

Only the backend is installed, i.e. operator/controller/validation, without the UI, because it is meant to be the target for running automated tests.

Prerequisites

All in one script

Run the script [build_and_setup_everything_bazel_manually.sh] (build_and_setup_everything_bazel_manually.sh)

this script will:

  1. create a local docker registry
  2. download and create a kind K8s cluster
  3. get the latest forklift code (https://github.com/kubev2v/forklift).
  4. build the forklift images using bazel
  5. push the images to the local registry using bazel
  6. deploy forklift from the local registry images
  7. install migration providers for e2e testing

In order to just install the latest release of forklift please see INSTALL_FORKLIFT_ON_KIND.md.

environmenet variables

  • FORKLIFT_DIR - specify alternative forklift path.

providers

it is possible to install the following source providers as part of k8s kind cluster :

Run the script:

cluster/providers/install-provider.sh <provider-name>

when <provider-name> can be one of those:

  • ovirt

  • openstack

    • configuration environment variables:
      variable Description Required
      NFS_IP_ADDRESS NFS server ip address V
      NFS_SHARE path to the nfs export. V
      INSTALL_NFS install nfs server locally
  • vsphere

  • ova

  • all

Verify that forklift is running

The kind container:

$ docker container ls
CONTAINER ID   IMAGE                  COMMAND                  CREATED          STATUS          PORTS                       NAMES
298d058aa24e   kindest/node:v1.25.0   "/usr/local/bin/entr…"   12 minutes ago   Up 12 minutes   127.0.0.1:36679->6443/tcp   kind-control-plane
b7f23a116b8b   registry:2             "/entrypoint.sh /etc…"   12 minutes ago   Up 12 minutes   127.0.0.1:5001->5000/tcp    kind-registry

The running pods should look like this:

$ kubectl get pod -n konveyor-forklift
NAME                                                              READY   STATUS      RESTARTS   AGE
cef4e22ed1b3d40ac67fe676ede6173d27cf3fac387c18ee8b65d8442bssfqg   0/1     Completed   0          4m16s
forklift-controller-6857cc454b-j972t                              2/2     Running     0          3m
forklift-operator-6b6d55f97f-52k6t                                1/1     Running     0          3m58s
forklift-validation-6d46d4b679-cgqmb                              1/1     Running     0          2m58s
konveyor-forklift-67rbj                                           1/1     Running     0          5m29s

Set CLUSTER and TOKEN (see above) and call:

$ curl -k "$CLUSTER/apis/forklift.konveyor.io/v1beta1/namespaces/konveyor-forklift/providers" --header "Authorization: Bearer $TOKEN"

You can also create a port forwarding to the forklift inventory-service (which is not exposed externally, by default):

$ kubectl port-forward -n konveyor-forklift service/forklift-inventory 9090:8080

This allows you to call the service directly, like this:

$ curl "http://localhost:9090/providers" --header "Authorization: Bearer $TOKEN"

Or just use kubectl (which will say "No resources found in konveyor-forklift namespace." until a provider has been created):

$ kubectl get -n konveyor-forklift providers

Cleanup

Steps for cleaning up, in case the process is to be repeated in the same environment:

  • Stop the registry container and delete it (docker stop, docker container rm).
  • Delete the registry image and all forklift images (docker rmi).
  • Destroy the kind cluster (kind delete cluster).
  • Delete the kind image (docker rmi).
  • Delete the checked out git repos for forklift-operator, forklift-controller, forklift-validation.

Documentation

The Forklift API is described here.