How to add a service to OpenPAI ? A simple guideline
While the process I implemented a docker pull-through cache service inside pai, I struggled to clarify how a service should be and service-configuration.yml generated.
A service directory structure
In general, a service directory should have 2 or 3 sub-directory: "build"(optional), "config", "deploy".
- The "build" directory contains a dockerfile to generate service specific container when developer need custom docker for service.
- The "config" directory contains a config yaml file and a python script to add dynamic configurations. Both of those files have restrict naming convention: the config yaml file should be named as "<service_name>.yaml", the python script should be named as "<service_name_replace"-"with"_">.py. Consider "docker-cache/config/" as a sample, the config file name is "docker-cache.yaml", and the python script name is "docker_cache.py".
- The "deploy" directory contains many files related to service deployment. Those files can devided to 3 types: k8s api files, service operation scripts and service entry file. The entry file is service.yaml, which describes meta info of a service.
How service-configuration.yml generate
How kubespray work
pylon config to add endpoint