Skip to content

Latest commit

 

History

History
70 lines (59 loc) · 2.71 KB

developer-guide.md

File metadata and controls

70 lines (59 loc) · 2.71 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. If you are not working in Linux, here you should use `make docker-build`
make dev-images
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:

Then run the following command will solve the problem:

kustomize build config/crd | kubectl create -f -

di-operator 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

Install global components of DIJob defined in AggregatorConfig:

kubectl create -f examples/di-mock-agconfig.yaml -n di-system