Skip to content

Latest commit

 

History

History
157 lines (110 loc) · 4.66 KB

development.md

File metadata and controls

157 lines (110 loc) · 4.66 KB

Development Guide

Table of Contents

This document is the canonical source of truth for things like supported toolchain versions for building TKE.

Please submit an [issue] on Github if you

  • Notice a requirement that this doc does not capture.
  • Find a different doc that specifies requirements (the doc should instead link here).

Requirements

TKE development helper scripts assume an up-to-date GNU tools environment. Recent Linux distros should work out-of-the-box.

macOS ships with outdated BSD-based tools. We recommend installing [macOS GNU tools].

Note that Mingw64/Cygwin on Windows is not supported yet.

If you don't have Git-LFS installed, see Git-LFS for instructions on how to install on different operating systems.

Go

TKE's backend is written in Go. If you don't have a Go development environment, please set one up.

TKE requires Go
0.8-0.12 1.12.5
1.0+ 1.13.3

TKE uses go modules to manage dependencies.

Once you have set up your golang development environment, make sure the environment variables contains:

go env -w GOPRIVATE="tkestack.io,tkestack.com,helm.sh,go.etcd.io,k8s.io,go.uber.org"

Node.js

TKE's frontend is written in Typescript. To bundle TKE's frontend code, you need a Node.js and NPM execution environment, please set one up.

TKE requires Node.js requires NPM
0.8-0.12 9.4+ 5.6+
1.0+ 10.3+ 6.1+

Clone source code

# Clone the repository on your machine
git clone git@github.com:tkestack/tke.git

# If you don't have a SSH key, feel free to clone using HTTPS instead
# git clone https://github.com/tkestack/tke.git

Building binary

The following section is a quick start on how to build TKE on a local OS/shell environment.

make build

The best way to validate your current setup is to build a small part of TKE. This way you can address issues without waiting for the full build to complete. To build a specific part of TKE use the BINS environment variable to let the build scripts know you want to build only a certain package/executable.

make build BINS=${package_you_want}
make build BINS="${package_you_want_1} ${package_you_want_2}"

Note: This applies to all top level folders under tke/cmd.

So for the tke-gateway, you can run:

make build BINS=tke-gateway

If everything checks out you will have an executable in the _output/{platform} directory to play around with.

Note: If you are using CDPATH, you must either start it with a leading colon, or unset the variable. The make rules and scripts to build require the current directory to come first on the CD search path in order to properly navigate between directories.

cd ${working_dir}/tke
make

To build binaries for all platforms:

make build.all

To build a specific os/arch of TKE use the PLATFORMS environment variable to let the build scripts know you want to build only for os/arch.

make build.all PLATFORMS="linux_amd64 windows_amd64 darwin_amd64"

Building docker image

In a production environment, it is recommended to run the TKE components in the Kubernetes cluster. TKE will build and push the image to the Docker Hub after each release.

If you don't have docker installed, see here for instructions on how to install on different operating systems.

If you need to build a container image locally, you can simply execute the instructions:

make image

If you want to build a container image of just one or more components, you can use IMAGES variables to control:

make image IMAGES=${package_you_want}
make image IMAGES="${package_you_want_1} ${package_you_want_2}"

Note: This applies to all top level folders under tke/cmd.

So for the tke-platform-api, you can run:

make image IMAGES=tke-platform-api

For more functions of other components, please see here. To run tke system locally, please see here.