English | Chinese

Naftis is a web-based dashboard for Istio. It helps user manage their Istio tasks more easily. Using Naftis we can custom our own task templates, then build task from them and execute it.

Documentation

Code Structure

.├ ─ bin # Directory Store Binary ├─ config # Directory Store Configuration Files │ ├─ In-cluster Kubernetes Cluster Configuration file │ ├─ In-local. Toml # In Local Machine Configuration file ├─ Install # Helm Charts │ ├── Helm │ ├─ mysql │ ├─ SRC # Source Code ├─ API # Backend Server Source code │ ├─ │ ├─ ├─ Hand Motion # HTTP, motion graphics, motion graphics, motion graphics, motion graphics, motion graphics, motion graphics, motion graphics, motion graphics, motion graphics ├─ Log # Log Package Wraps │ ├── Middleware # HTTP Middlewares │ ├─ Model # Common Models │ ├── Heavy Metal HTTP contact area │ ├─ Service # some wraped services │ ├─ Storer # db storer │ ├─ Util # Utilities │ ├─ version │ ├─ ├─ go # index of crimp server │ ├─ # Frontend Source code │ ├─ build # Webpack scripts │ ├─ SRC # Truly Frontend Source Code │ ├─ package.json │ ├─ ├─ ├─ Class exercises, ├─ class exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercises ├─ img │ ├─ ├─ build.sh │ ├─ clean.sh # ├─ conn Manifest for Naftis deployment in Kubernetes │ ├─ Go │ ├─ Naftis. SQL # Naftis Migrate SQL scripts │ ├── ├─ ├─ download.txt # download.txt # download.txt # download.txt # download.txt # download.txt # Frontend Image ├─ Anti-Flag # Dep Version Anti-Flag # DeP Version Anti-Flag # Gopkg. Toml # dep Depencies version primarily Hand - Edited File ├── LICENSE ├─ Makefile # Project's Makefile ├─ mysql.yaml # Kubernetes Naftis API and UI manifest, Generate by Helm ├── Naftis. Yaml # Kubernetes naftis MySQL Manifest, └── └ └─ Mshortcut Script for Local RunningCopy the code

Features

  • Integrates with some real-time dashboards
  • Customizable task template
  • Support Rollback specific task
  • Optimized Istio service graph with supporting of specifying particular root service node
  • With diagnose data of Istio services and pods
  • Out of the box, easy deployment with kubectl commands
  • 1.0 supported Istio

Requirements

  • Istio > 1.0
  • Kubernetes > = 1.9.0
  • HIUI > = 1.0.0

HIUI

Naftis dashboard use powerful HIUI (A React based UI components which released by Xiaomi FE Team) to built responsive UI, more reference:

github.com/XiaoMi/hiui

Quick Started

kubectl create namespace naftis && kubectl apply -n naftis -f mysql.yaml && kubectl apply -n naftis -f naftis.yaml

# port forward Naftis
kubectl -n naftis port-forward $(kubectl -n naftis get pod -l app=naftis-ui -o jsonpath='{.items[0].metadata.name}') 8080:80 &

# explorer http://localhost:8080/ with your browser, default user name and password is "admin".Copy the code

Detailed Deployments

Running Under Kubernetes Cluster

# create Naftis namespace $ kubectl create namespace naftis # ensure Naftis namespace is created $ kubectl get namespace  naftis NAME STATUS AGE naftis Active 18m # deploy Naftis MySQL service $ kubectl apply -n naftis -f mysql.yaml # ensure  MySQL service is deployed $ kubectl get svc -n naftis NAME READY STATUS RESTARTS AGE naftis-mysql-c78f99d6c-kblbq 1/1 Running 0 9s naftis-mysql-test 1/1 Running 0 10s # deploy Naftis API and UI service $ kubectl apply -n naftis -f naftis.yaml # ensure Naftis all services is correctly defined and running $ kubectl get svc -n naftis NAME TYPE Cluster-ip external-ip PORT(S) AGE Naftis-API ClusterIP 10.233.3.144 < None > 50000/TCP 7s Naftis-mysql ClusterIP 10.233.57.230 < None > 3306/TCP 55s naftis-ui LoadBalancer 10.233.18.125 <pending> 80:31286/TCP 6s $kubectl get pod -n naftis NAME READY STATUS RESTARTS AGE naftis-api-0 1/2 Running 0 19s naftis-mysql-c78f99d6c-kblbq 1/1 Running 0 1m naftis-mysql-test 1/1 Running 0 1m naftis-ui-69f7d75f47-4jzwz 1/1 Running 0 19s # browse Naftis via port-forward $ kubectl -n naftis port-forward $(kubectl -n naftis get pod -l app=naftis-ui -o jsonpath='{.items[0].metadata.name}') & 8080-80Copy the code

Explorer http://localhost:8080/ with your browser, default user name and password is “admin”.

Running Under Local Machine

Migration

# run migrate sql script
mysql> source ./tool/naftis.sql;

# modify in-local.toml and replace with your own MySQL DSN.Copy the code

Start API Server

  • Linux
make build && ./bin/naftis-api start -c config/in-local.toml # building and starting naftis-apiCopy the code

or

./runCopy the code
  • Mac OS
GOOS=darwin GOARCH=amd64 make build && ./bin/naftis-api start -c config/in-local.toml # building and starting naftis-apiCopy the code

or

GOOS=darwin GOARCH=amd64 ./runCopy the code

Modify Nginx Proxy Config

cp tool/naftis.conf <your-nginx-conf-directory>/naftis.conf
# modify naftis.conf and then reload NginxCopy the code

Start Node Proxy Server

cd src/ui
npm install
npm run dev # start node proxy

# Explorer http://localhost:5200/ with your browser.Copy the code

Previews

Dashboard

Services

Service Detail

Service Pod

Task Templates

Task Tpl

Task View

Task New

Create Task

Istio Diagnosis

Docker Images

Naftis api and ui image has been published on Docker Hub in api and ui.

Developer’s Guide

Fetch source code

go get github.com/xiaomi/naftisCopy the code

Setting environment variables

Add the follow exports to your ~/.profile. autoenv is also strongly recommended.

# Change GOOS and GOARCH with your environment.
export GOOS="linux"   # or replace with "darwin", etc.
export GOARCH="amd64" # or replace with "386", etc.

# Change USER with your Docker Hub account for pulling and pushing custom docker container builds.
export USER="sevennt"
export HUB="docker.io/$USER"Copy the code

If you choose autoenv to export environment variables, type cd . to make it work.

Go Dependency

We use dep to manage our go dependencies.

# install dep
go get -u github.com/golang/dep
dep ensure -v # install dependciesCopy the code

Code Style

Other Directives

make # make all targets make build # build api binaries, frontend assets, and Kubernetes manifest make build.api # build backend binaries make build.ui # build frontend assets make build.manifest # build Kubernetes manifest make fmt # go fmt codes make lint # lint codes make vet # vet codes make test  # run tests make tar # compress directories make docker # build docker images make docker.api # build backend docker images make docker.ui # build frontend docker images make push # push images to docker.io ./bin/naftis-api -h # show help messages ./bin/naftis-api version # show binary build version messages ./tool/cleanup.sh # clean up NaftisCopy the code

Architecture

TODO List

  • Add testcases
  • Supporting query Istio resource
  • Add Links of Grafana, Jaeger, Prometheus

License

The Apache License 2.0