Skip to content

Commit

Permalink
Configure client to become a pod. A user would use kubectl exec to ru…
Browse files Browse the repository at this point in the history
…n the testing tasks.
  • Loading branch information
AndrewQuijano committed Jun 21, 2023
1 parent ff31bd2 commit 88b8012
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 40 deletions.
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ drawing of what the DT looks like.
To make it easier for deploying on the cloud, we also provided a method to export our system into Kubernetes.
This would assume one execution rather than multiple executions.

#### Set Training and testing files
First, you need to edit the job files:
1. In the `client_testing_job.yaml` file, you need to change the first argument to point to the right VALUES file
2. In the `server_site_training_job.yaml` file, you need to change the first argument to point to the right ARFF file
#### Set Training data set
In the `server_site_training_job.yaml` file, you need to change the first argument to point to the right ARFF file.

#### Creating a Kubernetes Secret
You should set up a Kubernetes secret file, called `ppdt-secrets.yaml` in the `k8/level-sites` folder.
Expand Down Expand Up @@ -144,21 +142,22 @@ and check the logs to confirm we see `Server-site ready to get public keys from
After the server site is ready we are ready to run the client.
To run the client, simply run the following command.
To run a classification, you need to pass a command to the client too.
kubectl apply -f k8/client
kubectl exec <CLIENT-SITE-POD> -- bash -c "gradle run -PchooseRole=weka.finito.client --args <VALUES-FILE>"
To get the results, access the logs as described in the previous steps for both the client and level-sites.
#### Re-running with different experiments
- *Case 1: Re-run with different testing set*
As the job created the pod, you would connect to the pod and run the modified gradle command with the other VALUES file.
```bash
kubectl exec <CLIENT-SITE-POD> -- bash -c "gradle run -PchooseRole=weka.finito.client --args <NEW-VALUES-FILE>"
kubectl exec <CLIENT-SITE-POD> -- bash -c "gradle run -PchooseRole=weka.finito.client --args <NEW-VALUES-FILE>"
```
- *Case 2: Train level-sites with new DT and new testing set*
First, you need to edit the `client_testing_job.yaml` file to point to a new VALUES file.
Also, you need to edit the `server_site_training_job.yaml` file to point to a new ARFF file.
Finally, make sure that `TEST_AGAIN` is NOT set to `1`.
You need to edit the `server_site_training_job.yaml` file to point to a new ARFF file.
```bash
# Delete job
kubectl delete -f k8/server-site
Expand All @@ -169,6 +168,7 @@ kubectl apply -f k8/server-site
# Wait a few seconds to for server-site to be ready to get the client key...
# Or just check the server-site being ready as shown in the previous section
kubectl apply -f k8/client
kubectl exec <CLIENT-SITE-POD> -- bash -c "gradle run -PchooseRole=weka.finito.client --args <VALUES-FILE>"
```
#### Clean up

Expand All @@ -180,9 +180,9 @@ If you want to re-build everything in the experiment, run the following
### Running it on an EKS Cluster

#### Installation
1. First install [eksctl](https://eksctl.io/introduction/#installation)
- First install [eksctl](https://eksctl.io/introduction/#installation)

2. Create a user. Using Access analyzer, the customer inline policy needed is listed here:
- Create a user. Using Access analyzer, the customer inline policy needed is listed here:
* still undergoing more testing
```json
{
Expand Down Expand Up @@ -219,30 +219,28 @@ If you want to re-build everything in the experiment, run the following
]
}
```
- Obtain AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY of the user account. [See the documentation provided here](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html)

3. Obtain AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY of the user account. [See the documentation provided here](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html)

4. run `aws configure` to input the access id and credential.
- run `aws configure` to input the access id and credential.

5. Run the following command to create the cluster
- Run the following command to create the cluster
```bash
eksctl create cluster --config-file eks-config/config.yaml
```

5. Confirm the EKS cluster exists using the following
- Confirm the EKS cluster exists using the following
```bash
eksctl get clusters --region us-east-2
```

#### Running the experiment
1. Once you confirm the cluster is created, you need to register the cluster with kubectl:
- Once you confirm the cluster is created, you need to register the cluster with kubectl:
```bash
aws eks update-kubeconfig --name ppdt --region us-east-2
```

2. Run the same commands as shown in [here](#running-kubernetes-commands)

3. Obtain the results of the classification using `kubectl logs` to the pods deployed on EKS.
- Run the same commands as shown in [here](#running-kubernetes-commands)
- Obtain the results of the classification using `kubectl logs` to the pods deployed on EKS.

#### Clean up
Destroy the EKS cluster using the following:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
apiVersion: batch/v1
kind: Job
apiVersion: apps/v1
kind: Deployment
metadata:
name: ppdt-client-deploy
labels:
app: ppdt-client-deploy
spec:
replicas: 1
selector:
matchLabels:
pod: ppdt-client-deploy
template:
metadata:
labels:
pod: ppdt-level-site-01-deploy
spec:
subdomain: ppdt-client-service # has to match Service name
restartPolicy: OnFailure

containers:
- name: ppdt-client-deploy
image: ppdt:experiment
command: ["/bin/sh"]
args: ["-c", "gradle run -PchooseRole=weka.finito.client --args /data/hypothyroid.values"]
ports:
- containerPort: 9000
env:
- name: TREE_ROLE
value: "CLIENT"
Expand All @@ -34,5 +40,3 @@ spec:

- name: GRADLE_USER_HOME
value: "gradle_user_home"

backoffLimit: 4
4 changes: 2 additions & 2 deletions k8/client/client_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ apiVersion: v1
metadata:
name: ppdt-client-service
spec:
clusterIP: None # clusterIP must be None to create a headless service
selector:
job-name: ppdt-client-deploy # must match Job name
pod: ppdt-client-deploy
ports:
- protocol: TCP
port: 9000
targetPort: 9000
type: NodePort
1 change: 0 additions & 1 deletion k8/level_sites/level_site_01_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: ppdt-level-site-01-service
spec:
selector:
#app: assignment3-django-deploy
pod: ppdt-level-site-01-deploy
ports:
- protocol: TCP
Expand Down
1 change: 0 additions & 1 deletion k8/level_sites/level_site_02_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: ppdt-level-site-02-service
spec:
selector:
#app: assignment3-django-deploy
pod: ppdt-level-site-02-deploy
ports:
- protocol: TCP
Expand Down
1 change: 0 additions & 1 deletion k8/level_sites/level_site_03_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: ppdt-level-site-03-service
spec:
selector:
#app: assignment3-django-deploy
pod: ppdt-level-site-03-deploy
ports:
- protocol: TCP
Expand Down
1 change: 0 additions & 1 deletion k8/level_sites/level_site_04_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: ppdt-level-site-04-service
spec:
selector:
#app: assignment3-django-deploy
pod: ppdt-level-site-04-deploy
ports:
- protocol: TCP
Expand Down
1 change: 0 additions & 1 deletion k8/level_sites/level_site_05_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: ppdt-level-site-05-service
spec:
selector:
#app: assignment3-django-deploy
pod: ppdt-level-site-05-deploy
ports:
- protocol: TCP
Expand Down
1 change: 0 additions & 1 deletion k8/level_sites/level_site_06_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: ppdt-level-site-06-service
spec:
selector:
#app: assignment3-django-deploy
pod: ppdt-level-site-06-deploy
ports:
- protocol: TCP
Expand Down
1 change: 0 additions & 1 deletion k8/level_sites/level_site_07_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: ppdt-level-site-07-service
spec:
selector:
#app: assignment3-django-deploy
pod: ppdt-level-site-07-deploy
ports:
- protocol: TCP
Expand Down
1 change: 0 additions & 1 deletion k8/level_sites/level_site_08_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: ppdt-level-site-08-service
spec:
selector:
#app: assignment3-django-deploy
pod: ppdt-level-site-08-deploy
ports:
- protocol: TCP
Expand Down
1 change: 0 additions & 1 deletion k8/level_sites/level_site_09_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: ppdt-level-site-09-service
spec:
selector:
#app: assignment3-django-deploy
pod: ppdt-level-site-09-deploy
ports:
- protocol: TCP
Expand Down
1 change: 0 additions & 1 deletion k8/level_sites/level_site_10_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: ppdt-level-site-10-service
spec:
selector:
#app: assignment3-django-deploy
pod: ppdt-level-site-10-deploy
ports:
- protocol: TCP
Expand Down
1 change: 1 addition & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ elif [[ $ROLE == "LEVEL_SITE" ]]; then
elif [[ $ROLE == "CLIENT" ]]; then
echo "Role: client"
# gradle -g gradle_user_home run -PchooseRole=weka.finito.client
while :; do sleep 5 ; done
else
echo "Sorry, this is not a valid MPC-PPDT role. Please try again."
exit
Expand Down

0 comments on commit 88b8012

Please sign in to comment.