Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Update README and Copyright (#36)
Browse files Browse the repository at this point in the history
* Update README to comply with markdownlint rules

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

* Update Copyright

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

---------

Signed-off-by: Chenlong Ma <[email protected]>
  • Loading branch information
owlet42 authored Feb 9, 2023
1 parent e3fd36a commit e83682a
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 39 deletions.
45 changes: 30 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# fate-operator: Kubernetes Operator for FATE (Federated AI Technology Enabler)

## Overview

The FATE-Operator makes it easy to deploy and run federated machine learning (FML) jobs on Kubernetes. It is a early version, all suggestions and feature requests are valueables for us. Raising issues is appreciate.
Expand All @@ -8,11 +9,11 @@ The FATE-Operator makes it easy to deploy and run federated machine learning (FM
Federated machine learning (FML) is a machine learning setting where many clients (e.g. mobile devices or organizations) collaboratively train a model under the coordination of a central server while keeping the training data decentralized. Only the encrypted mediate parameters are exchanged between clients with MPC or homomorphic encryption.
![Federated Machine Learning](doc/diagrams/fate-operator-fl.png)

FML has received significant interest recently, because of its effectiveness to solve data silos and data privacy preserving problems. Companies participated in federated machine learning include 4Paradigm, Ant Financial, Data Republic, Google, Huawei, Intel, JD.com, Microsoft, Nvidia, OpenMind, Pingan Technology, Sharemind, Tencent, VMware, Webank etc.
FML has received significant interest recently, because of its effectiveness to solve data silos and data privacy preserving problems. Companies participated in federated machine learning include 4Paradigm, Ant Financial, Data Republic, Google, Huawei, Intel, JD.com, Microsoft, Nvidia, OpenMind, Pingan Technology, Sharemind, Tencent, VMware, Webank etc.

Depending on the differences in features and sample data space, federated machine learning can be classified into _horizontal federated machine learning_, _vertical federated machine learning_ and _federated transfer learning_. Horizontal federated machine learning is also called sample-based federated machine learning, which means data sets share the same feature space but have different samples. With horizontal federated machine learning, we can gather the relatively small or partial datasets into a big one to increase the performance of trained models. Vertical federated machine learning is applicable to the cases where there are two datasets with different feature space but share same sample ID. With vertical federated machine learning we can train a model with attributes from different organizations for a full profile. Vertical federated machine learning is required to redesign most of machine learning algorithms. Federated transfer learning applies to scenarios where there are two datasets with different features space but also different samples.
Depending on the differences in features and sample data space, federated machine learning can be classified into _horizontal federated machine learning_, _vertical federated machine learning_ and _federated transfer learning_. Horizontal federated machine learning is also called sample-based federated machine learning, which means data sets share the same feature space but have different samples. With horizontal federated machine learning, we can gather the relatively small or partial datasets into a big one to increase the performance of trained models. Vertical federated machine learning is applicable to the cases where there are two datasets with different feature space but share same sample ID. With vertical federated machine learning we can train a model with attributes from different organizations for a full profile. Vertical federated machine learning is required to redesign most of machine learning algorithms. Federated transfer learning applies to scenarios where there are two datasets with different features space but also different samples.

[FATE (Federated AI Technology Enabler)](https://fate.fedai.org) is an open source project initialized by Webank, [now hosted at the Linux Foundation](https://fate.fedai.org/2019/09/18/first-digital-only-bank-in-china-joins-linux-foundation/). FATE is the only open source FML framework that supports both horizontal and vertical FML currently. The architecture design of FATE is focused on providing FML platform for enterprises. [KubeFATE](https://github.com/FederatedAI/KubeFATE) is an open source project to deploy FATE on Kubernetes and is a proven effective solution for FML use cases.
[FATE (Federated AI Technology Enabler)](https://fate.fedai.org) is an open source project initialized by Webank, [now hosted at the Linux Foundation](https://fate.fedai.org/2019/09/18/first-digital-only-bank-in-china-joins-linux-foundation/). FATE is the only open source FML framework that supports both horizontal and vertical FML currently. The architecture design of FATE is focused on providing FML platform for enterprises. [KubeFATE](https://github.com/FederatedAI/KubeFATE) is an open source project to deploy FATE on Kubernetes and is a proven effective solution for FML use cases.

More technologies of Federated machine learning, please refer to [Reference section](#reference)

Expand All @@ -21,59 +22,73 @@ More technologies of Federated machine learning, please refer to [Reference sect
## Quick user guide

### Installation

The fate-operator can be installed by following steps.

#### Install CRDs to Kubernetes

```bash
$ make install
make install
```

#### Uninstall CRDs from Kubernetes

```bash
$ make uninstall
make uninstall
```

#### Building controller images
The Docker images are built and pushed to Dockerhub.

The Docker images are built and pushed to Dockerhub.
[fate-operator](https://hub.docker.com/r/federatedai/fate-controller)

Alternatively, we can build the images manually by commands,

```bash
$ make docker-build
make docker-build
```

#### Deploying controller

```bash
$ make deploy
make deploy
```

### Deploying KubeFATE

KubeFATE is the infrastructure management service for multiple FATE clusters in one organization. It will only deploy once. To deploy a KubeFATE service, we use the YAML refer to [app_v1beta1_kubefate.yaml](./config/samples/app_v1beta1_kubefate.yaml) as an example,

```bash
$ kubectl create -f ./config/samples/app_v1beta1_kubefate.yaml
kubectl create -f ./config/samples/app_v1beta1_kubefate.yaml
```

### Deploying FATE

FATE is the cluster we run FML jobs. To deploy a FATE cluster, we use YAML refer to [app_v1beta1_fatecluster.yaml](./config/samples/app_v1beta1_fatecluster.yaml) as an example,

```bash
$ kubectl create -f ./config/samples/app_v1beta1_fatecluster.yaml
kubectl create -f ./config/samples/app_v1beta1_fatecluster.yaml
```

### Submitting an FML Job
Once KubeFATE and FATE cluster deployed, we can submit a FML job with `FateJob` config file. In current version, the FATE Job is defined by `DSL pipeline` and `Module Config` two parts. The details refer to [app_v1beta1_fatejob.yaml](./config/samples/app_v1beta1_fatejob.yaml).

Once KubeFATE and FATE cluster deployed, we can submit a FML job with `FateJob` config file. In current version, the FATE Job is defined by `DSL pipeline` and `Module Config` two parts. The details refer to [app_v1beta1_fatejob.yaml](./config/samples/app_v1beta1_fatejob.yaml).

```bash
kubectl create -f ./config/samples/app_v1beta1_fatejob.yaml
```
In this example, only a `secure add` operation will be processed. For more example, we can refer to [FATE Examples](https://github.com/FederatedAI/FATE/tree/master/examples/federatedml-1.x-examples). In each example, the files end with `_dsl`, e.g. https://github.com/FederatedAI/FATE/blob/master/examples/federatedml-1.x-examples/hetero_linear_regression/test_hetero_linr_cv_job_dsl.json is the job pipeline and what should be put in `pipeline` field; and the files end with `_conf`, e.g. https://github.com/FederatedAI/FATE/blob/master/examples/federatedml-1.x-examples/hetero_linear_regression/test_hetero_linr_cv_job_conf.json is the config of each components and what should be put in `modulesConf` field.

In this example, only a `secure add` operation will be processed. For more example, we can refer to [FATE Examples](https://github.com/FederatedAI/FATE/tree/master/examples/federatedml-1.x-examples). In each example, the files end with `_dsl`, e.g. <https://github.com/FederatedAI/FATE/blob/master/examples/federatedml-1.x-examples/hetero_linear_regression/test_hetero_linr_cv_job_dsl.json> is the job pipeline and what should be put in `pipeline` field; and the files end with `_conf`, e.g. <https://github.com/FederatedAI/FATE/blob/master/examples/federatedml-1.x-examples/hetero_linear_regression/test_hetero_linr_cv_job_conf.json> is the config of each components and what should be put in `modulesConf` field.

### Checking created resource status

The status of created resource can be monitor with `kubectl get` command,

```bash
$ kubectl get kubefate,fatecluster,fatejob -A -o yaml
kubectl get kubefate,fatecluster,fatejob -A -o yaml
```

## Reference
1. Qiang Yang, Yang Liu, Tianjian Chen, and Yongxin Tong. Federated machine learning: Concept and applications. CoRR, abs/1902.04885, 2019. URL http://arxiv.org/abs/1902.04885
2. Peter Kairouz et al. Advances and open problems in federated learning. arXiv preprint arXiv:1912.04977

1. Qiang Yang, Yang Liu, Tianjian Chen, and Yongxin Tong. Federated machine learning: Concept and applications. CoRR, abs/1902.04885, 2019. URL <http://arxiv.org/abs/1902.04885>
2. Peter Kairouz et al. Advances and open problems in federated learning. arXiv preprint arXiv:1912.04977
2 changes: 1 addition & 1 deletion api/v1beta1/fatecluster_types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion api/v1beta1/fatejob_types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion api/v1beta1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion api/v1beta1/kubefate_types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion controllers/common.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion controllers/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
11 changes: 4 additions & 7 deletions controllers/fatecluster/client.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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 All @@ -19,10 +19,11 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/go-logr/logr"
"io/ioutil"
"net/http"
"time"

"github.com/go-logr/logr"
)

func NewKubefateClient(ApiVersion, Domain, Username, Password string, Log *logr.Logger) (*KubefateClient, error) {
Expand Down Expand Up @@ -52,11 +53,7 @@ func (kfc *KubefateClient) CheckClient() bool {
time.Sleep(time.Second * 2)
}

if retry < 0 {
return false
}

return true
return retry >= 0
}

func (kfc *KubefateClient) GetVersion() (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion controllers/fatecluster/fateCluster.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
5 changes: 4 additions & 1 deletion controllers/fatecluster/token.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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 @@ -31,6 +31,9 @@ func getToken(loginUrl, username, pasword string) (string, error) {
}

loginJsonB, err := json.Marshal(login)
if err != nil {
return "", err
}

body := bytes.NewReader(loginJsonB)
Request, err := http.NewRequest("POST", loginUrl, body)
Expand Down
2 changes: 1 addition & 1 deletion controllers/fatecluster/type.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion controllers/fatecluster_controller.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion controllers/fatecluster_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion controllers/fatejob_controller.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion controllers/fatejob_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion controllers/kubefate_controller.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion controllers/kubefate_controller_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion controllers/suite_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 VMware, Inc.
* Copyright 2019-2023 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

0 comments on commit e83682a

Please sign in to comment.