Giter Site home page Giter Site logo

pathfinder's Introduction

Pathfinder

CRD Development

First of all install kubebuilder

os=$(go env GOOS)
arch=$(go env GOARCH)

# download kubebuilder and extract it to tmp
curl -L https://go.kubebuilder.io/dl/2.3.1/${os}/${arch} | tar -xz -C /tmp/

# move to a long-term location and put it on your path
# (you'll need to set the KUBEBUILDER_ASSETS env var if you put it somewhere else)
sudo mv /tmp/kubebuilder_2.3.1_${os}_${arch} /usr/local/kubebuilder
export PATH=$PATH:/usr/local/kubebuilder/bin

Create a directory and do

kubebuilder init --domain xmbsmdsj
# This will generate an empty project
# Including entry, dependencies, initial kubernetes configs

Add an api Pathfinder

kubebuilder create api --group pathfinder --version v1 PathFinder

# We will need both type and controller for this, so select Yes for both
# This step setup data type and some utils code like deepcopy and Scheme registration for 
# Out CRD

How to use?

Step 1: Deploy CRD to your cluster

$ make install

Step 2: Build image for pathfinder controller

$ make docker-push

Step 3: Deploy third party components and pathfinder controller on cluster

# cert-manager is required for pathfinder to run
$ make deploy-thirdparty
$ make deploy

Step 4: Deploy Sample

make deploy-sample

Step 5: Setup region for your pathfinder

Just modify the region value in Pathfinder's spec

Step N: Make your service discoverable

In order to make service discoverable, you only need to add a few annotations to service object, like this

apiVersion: v1
kind: Service
metadata:
  annotations:
    XM-PathFinder-Region: some-region # Region must match existing path-finder's region
    XM-PathFinder-Service: Activated
    XM-PathFinder-ServiceName: my-svc

Use PathFinder client go

It is pretty straitforward to access PathFinders using go client.

// You can either use config files to access remote cluster
config, err := clientcmd.BuildConfigFromFlags("", config)

// Or just use in-cluster setup if you are running your app
// in k8s pod
config, err := rest.InClusterConfig()

// Create a pf client from kube config
pfclient, err := client.New(config)

// Perform your operations on pathfinder here

pathfinder's People

Watchers

 avatar  avatar

Forkers

wylswz yichen-sh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.