Skip to content

Commit

Permalink
KubeFATE support FATE-Serving v2.1.5 (#606) (#624)
Browse files Browse the repository at this point in the history
* feat docker-compose support FATE-Serving v2.1.5

Signed-off-by: Chenlong Ma <[email protected]>

* feat: k8s support FATE-Serving v2.1.5

Signed-off-by: Chenlong Ma <[email protected]>

* chart of fate-serving support ingressClass

Signed-off-by: Chenlong Ma <[email protected]>

* fix base path of fate-serving

Signed-off-by: Chenlong Ma <[email protected]>

* fix base path of fate-serving.
add cacheSwitch
rm redis form docker-compose

Signed-off-by: Chenlong Ma <[email protected]>

* fix route_table read only

Signed-off-by: Chenlong Ma <[email protected]>

* fix fate-serving chart lint

Signed-off-by: Chenlong Ma <[email protected]>

* fix CI of docker deploy

Signed-off-by: Chenlong Ma <[email protected]>

* fix if podSecurityPolicy.enabled is true getting error 'helm install error, unable to build kubernetes objects from release manifest: error validating "": error validating data: apiVersion not set'

Signed-off-by: Chenlong Ma <[email protected]>

Co-authored-by: owlet42 <[email protected]>
  • Loading branch information
LaynePeng and owlet42 authored May 26, 2022
1 parent 38fdcb9 commit d710a7d
Show file tree
Hide file tree
Showing 28 changed files with 447 additions and 322 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#
# These files are text and should be normalized (Convert crlf => lf)
*.PNG binary
*.png binary
*.jpg binary

#
# Exclude files from exporting
Expand Down
2 changes: 1 addition & 1 deletion build/ci/docker-deploy/docker_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -x
dir=$(dirname $0)

CONTAINER_NUM=13
CONTAINER_NUM=12

echo "# config prepare"
target_dir=/data/projects/fate
Expand Down
2 changes: 1 addition & 1 deletion docker-deploy/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RegistryURI=
TAG=1.8.0-release
SERVING_TAG=2.0.4-release
SERVING_TAG=2.1.5-release

# PREFIX: namespace on the registry's server.
# RegistryURI: address of the local registry
Expand Down
153 changes: 96 additions & 57 deletions docker-deploy/README.md

Large diffs are not rendered by default.

204 changes: 120 additions & 84 deletions docker-deploy/README_zh.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker-deploy/docker_deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2019-2020 VMware, Inc.
# Copyright 2019-2022 VMware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
22 changes: 10 additions & 12 deletions docker-deploy/generate_config.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2019-2020 VMware, Inc.
# Copyright 2019-2022 VMware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -443,6 +443,8 @@ EOF
eval party_id=\${party_list[${i}]}
eval party_ip=\${party_ip_list[${i}]}
eval serving_ip=\${serving_ip_list[${i}]}
eval serving_admin_username=${serving_admin_username}
eval serving_admin_password=${serving_admin_password}

rm -rf serving-$party_id/
mkdir -p serving-$party_id/confs
Expand All @@ -451,26 +453,22 @@ EOF
cp serving_template/docker-compose-serving.yml serving-$party_id/docker-compose.yml
if [ "$RegistryURI" != "" ]; then
sed -i 's#federatedai#${RegistryURI}/federatedai#g' ./serving-$party_id/docker-compose.yml
# should not use federatedai in here
sed -i 's#image: "redis:5"#image: "${RegistryURI}/federatedai/redis:5"#g' ./serving-$party_id/docker-compose.yml
fi
# generate conf dir
cp ${WORKINGDIR}/.env ./serving-$party_id

# serving admin
sed -i "s/admin.username=<serving_admin.username>/admin.username=${serving_admin_username}/g" ./serving-$party_id/confs/serving-admin/conf/application.properties
sed -i "s/admin.password=<serving_admin.password>/admin.password=${serving_admin_password}/g" ./serving-$party_id/confs/serving-admin/conf/application.properties

# serving server
sed -i "s/127.0.0.1:9380/${party_ip}:9380/g" ./serving-$party_id/confs/serving-server/conf/serving-server.properties
sed -i "s/<redis.ip>/${redis_ip}/g" ./serving-$party_id/confs/serving-server/conf/serving-server.properties
sed -i "s/<redis.port>/${redis_port}/g" ./serving-$party_id/confs/serving-server/conf/serving-server.properties
sed -i "s/<redis.password>/${redis_password}/g" ./serving-$party_id/confs/serving-server/conf/serving-server.properties
sed -i "s/<redis.password>/${redis_password}/g" ./serving-$party_id/docker-compose.yml
sed -i "s#model.transfer.url=http://127.0.0.1:9380/v1/model/transfer#model.transfer.url=http://${party_ip}:9380/v1/model/transfer#g" ./serving-$party_id/confs/serving-server/conf/serving-server.properties

# network
sed -i "s/name: <fate-network>/name: confs-${party_id}_fate-network/g" serving-$party_id/docker-compose.yml



# serving proxy
sed -i "s/coordinator=9999/coordinator=${party_id}/g" ./serving-$party_id/confs/serving-proxy/conf/application.properties
sed -i "s/coordinator=<partyID>/coordinator=${party_id}/g" ./serving-$party_id/confs/serving-proxy/conf/application.properties
cat >./serving-$party_id/confs/serving-proxy/conf/route_table.json <<EOF
{
"route_table": {
Expand Down Expand Up @@ -504,7 +502,7 @@ $(for ((j = 0; j < ${#party_list[*]}; j++)); do
"default": {
"default": [
{
"ip": "default-serving-proxy",
"ip": "serving-proxy",
"port": 8869
}
]
Expand Down
9 changes: 4 additions & 5 deletions docker-deploy/parties.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ mysql_user=fate
mysql_password=fate_dev
mysql_db=fate_flow

# modify if you are going to use an external redis
redis_ip=redis
redis_port=6379
redis_password=fate_dev

name_node=hdfs://namenode:9000

# Define fateboard login information
fateboard_username=admin
fateboard_password=admin

# Define serving admin login information
serving_admin_username=admin
serving_admin_password=admin
37 changes: 17 additions & 20 deletions docker-deploy/serving_template/docker-compose-serving.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
########################################################
# Copyright 2019-2020 VMware, Inc. #
# SPDX-License-Identifier: Apache-2.0 #
########################################################
# Copyright 2019-2022 VMware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

version: '3'

Expand All @@ -15,8 +23,8 @@ services:
ports:
- "8000:8000"
volumes:
- ./confs/serving-server/conf/serving-server.properties:/data/projects/fate/serving-server/conf/serving-server.properties
- ./confs/serving-server/cache:/data/projects/fate/serving-server/.fate
- ./confs/serving-server/conf/serving-server.properties:/data/projects/fate-serving/serving-server/conf/serving-server.properties
- ./confs/serving-server/cache:/root/.fate
networks:
- fate-serving-network

Expand All @@ -28,18 +36,8 @@ services:
expose:
- 8879
volumes:
- ./confs/serving-proxy/conf/application.properties:/data/projects/fate/serving-proxy/conf/application.properties
- ./confs/serving-proxy/conf/route_table.json:/data/projects/fate/serving-proxy/conf/route_table.json
networks:
- fate-serving-network

redis:
image: "redis:5"
expose:
- 6379
command: redis-server --requirepass <redis.password>
volumes:
- ./confs/redis/data:/data
- ./confs/serving-proxy/conf/application.properties:/data/projects/fate-serving/serving-proxy/conf/application.properties
- ./confs/serving-proxy/conf/route_table.json:/data/projects/fate-serving/serving-proxy/conf/route_table.json
networks:
- fate-serving-network

Expand All @@ -59,7 +57,6 @@ services:
ports:
- "8350:8350"
volumes:
- ./confs/serving-admin/conf/application.properties:/data/projects/fate/serving-admin/conf/application.properties
command: /bin/sh -c "java -cp conf/:lib/*:fate-serving-admin.jar com.webank.ai.fate.serving.admin.Bootstrap -c conf/application.properties"
- ./confs/serving-admin/conf/application.properties:/data/projects/fate-serving/serving-admin/conf/application.properties
networks:
- fate-serving-network
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

server.port=8350
# cache
#local.cache.expire=300
Expand All @@ -10,5 +26,7 @@ zk.url=serving-zookeeper:2181
# grpc
#grpc.timeout=5000
# username & password
admin.username=admin
admin.password=admin
admin.username=<serving_admin.username>
admin.password=<serving_admin.password>

spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
# coordinator same as Party ID
coordinator=9999
coordinator=<partyID>
server.port=8059
#inference.service.name=serving
#random, consistent
Expand All @@ -23,10 +23,8 @@ server.port=8059
#auth.file=/data/projects/fate-serving/serving-proxy/conf/auth_config.json
# zk router
#useZkRouter=true
#useRegister=false
#useZkRouter=false
zk.url=serving-zookeeper:2181
#zk.url=localhost:2181,localhost:2182,localhost:2183
useZkRouter=true
# zk acl
#acl.enable=false
#acl.username=
Expand All @@ -35,7 +33,19 @@ zk.url=serving-zookeeper:2181
#proxy.grpc.intra.port=8879
# inter-partyid port
#proxy.grpc.inter.port=8869

# grpc
# only support PLAINTEXT, TLS(we use Mutual TLS here), if use TSL authentication
#proxy.grpc.inter.negotiationType=PLAINTEXT
# only needs to be set when negotiationType is TLS
#proxy.grpc.inter.CA.file=/data/projects/fate-serving/serving-proxy/conf/ssl/ca.crt
# negotiated client side certificates
#proxy.grpc.inter.client.certChain.file=/data/projects/fate-serving/serving-proxy/conf/ssl/client.crt
#proxy.grpc.inter.client.privateKey.file=/data/projects/fate-serving/serving-proxy/conf/ssl/client.pem
# negotiated server side certificates
#proxy.grpc.inter.server.certChain.file=/data/projects/fate-serving/serving-proxy/conf/ssl/server.crt
#proxy.grpc.inter.server.privateKey.file=/data/projects/fate-serving/serving-proxy/conf/ssl/server.pem

#proxy.grpc.inference.timeout=3000
#proxy.grpc.inference.async.timeout=1000
#proxy.grpc.unaryCall.timeout=3000
Expand All @@ -45,4 +55,4 @@ zk.url=serving-zookeeper:2181
#proxy.async.timeout=5000
#proxy.async.coresize=10
#proxy.async.maxsize=100
#proxy.grpc.batch.inference.timeout=10000
#proxy.grpc.batch.inference.timeout=10000
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ port=8000
# cache
#remoteModelInferenceResultCacheSwitch=false
#cache.type=local
#model.cache.path=
#model.cache.path=/data/projects/fate-serving/serving-server
# local cache
#local.cache.maxsize=10000
#local.cache.expire=30
#local.cache.interval=3
# external cache
redis.ip=<redis.ip>
redis.port=<redis.port>
#redis.ip=
#redis.port=
### configure this parameter to use cluster mode
#redis.cluster.nodes=127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
### this password is common in stand-alone mode and cluster mode
redis.password=<redis.password>
#redis.password=
#redis.timeout=10
#redis.expire=3000
#redis.maxTotal=100
Expand All @@ -39,6 +39,7 @@ proxy=serving-proxy:8879
# adapter
feature.single.adaptor=com.webank.ai.fate.serving.adaptor.dataaccess.MockAdapter
feature.batch.adaptor=com.webank.ai.fate.serving.adaptor.dataaccess.MockBatchAdapter
http.adapter.url=http://127.0.0.1:9380/v1/http/adapter/getFeature
# model transfer
model.transfer.url=http://127.0.0.1:9380/v1/model/transfer
# zk router
Expand All @@ -49,3 +50,7 @@ useZkRouter=true
#acl.enable=false
#acl.username=
#acl.password=

# LR algorithm config
#lr.split.size=500
#lr.use.parallel=false
4 changes: 2 additions & 2 deletions helm-charts/FATE-Serving/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
appVersion: v2.0.4
appVersion: v2.1.5
description: A Helm chart for FATE-Serving
name: fate-serving
version: v2.0.4
version: v2.1.5
sources:
- https://github.com/FederatedAI/KubeFATE
- https://github.com/FederatedAI/FATE-Serving
32 changes: 20 additions & 12 deletions helm-charts/FATE-Serving/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2021 VMware, Inc.
# Copyright 2019-2022 VMware, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -10,7 +10,7 @@
# limitations under the License.

{{ if .Values.servingProxy.include }}
apiVersion: networking.k8s.io/v1beta1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: serving-proxy
Expand All @@ -25,15 +25,19 @@ metadata:
{{ toYaml .Values.ingress.servingProxy.annotations | indent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingressClassName }}
rules:
{{- range .Values.ingress.servingProxy.hosts }}
- host: {{ .name }}
http:
paths:
- path: {{ default "/" .path }}
pathType: Prefix
backend:
serviceName: serving-proxy
servicePort: 8059
service:
name: serving-proxy
port:
number: 8059
{{- end }}
{{- if .Values.ingress.servingProxy.tls }}
tls:
Expand All @@ -43,7 +47,7 @@ spec:
{{ end }}

{{ if .Values.servingAdmin.include }}
apiVersion: networking.k8s.io/v1beta1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: serving-admin
Expand All @@ -58,15 +62,19 @@ metadata:
{{ toYaml .Values.ingress.servingAdmin.annotations | indent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingressClassName }}
rules:
{{- range .Values.ingress.servingAdmin.hosts }}
- host: {{ .name }}
http:
paths:
- path: {{ default "/" .path }}
backend:
serviceName: serving-admin
servicePort: 8350
- host: {{ .name }}
http:
paths:
- path: {{ default "/" .path }}
pathType: Prefix
backend:
service:
name: serving-admin
port:
number: 8350
{{- end }}
{{- if .Values.ingress.servingAdmin.tls }}
tls:
Expand Down
Loading

0 comments on commit d710a7d

Please sign in to comment.