4 Star 14 Fork 5

OpenDILab开源决策智能平台 / DI-orchestrator

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
developer-guide.md 2.84 KB
一键复制 编辑 原始数据 按行查看 历史

Developer Guide

Prerequisites

  • a well prepared kubernetes cluster. Follow the instructions to create a kubernetes cluster, or create a local kubernetes node referring to kind or minikube
  • kustomize. Installed by the following command
curl -s "https://raw.githubusercontent.com/\
kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"  | bash
  • cert-manager. Installation on kubernetes referenced to cert-manager docs. Or you can install by the following command.
kubectl create -f ./config/certmanager/cert-manager.yaml

Project Initialization

This project is based on kubebuilder v3, since CRDs generated by kubebuilder v2 is not compatible in kubernetes v1.20.

kubebuilder init --domain opendilab.org --license apache2 --owner "The OpenDILab authors"

kubebuilder create api --group diengine --version v1alpha1 --kind DIJob

kubebuilder create api --group diengine --version v1alpha1 --kind AggregatorConfig

CRD Design

Make codes in dijob_types.go and aggregatorconfig_types.go with your requirements, and generate deepcopy functions.

make generate

Generate new CRD files with the following command.

make manifests

New CRD files will be generated in ./config/crd/bases

Controller Logic

Referenced to controllers

DI Server Logic

Referenced to server

Installation

Run the following command in the project root directory.

# build images. 
make docker-build
make docker-push
# deploy di-operator and server to cluster
make dev-deploy

Since the CustomResourceDefinitions are too long, you will probably find the following error:

The CustomResourceDefinition "dijobs.diengine.opendilab.org" is invalid: metadata.annotations: Too long: must have at most 262144 bytes

Then running the following command will solve the problem:

kustomize build config/crd | kubectl create -f -

di-operator, di-webhook and di-server will be installed in di-system namespace.

$ kubectl get pod -n di-system
NAME                               READY   STATUS    RESTARTS   AGE
di-operator-57cc65d5c9-5vnvn       1/1     Running   0          59s
di-server-7b86ff8df4-jfgmp         1/1     Running   0          59s
di-webhook-45jgi23fhc-9yght        1/1     Running   0          59s

Install global components of DIJob defined in AggregatorConfig:

kubectl create -f config/samples/agconfig.yaml -n di-system
Go
1
https://gitee.com/opendilab/DI-orchestrator.git
git@gitee.com:opendilab/DI-orchestrator.git
opendilab
DI-orchestrator
DI-orchestrator
main

搜索帮助