Skip to content

Commit

Permalink
Update charts to allow for dynamic dispatch of configuration files
Browse files Browse the repository at this point in the history
  • Loading branch information
JMGaljaard committed Apr 20, 2022
1 parent da913d6 commit 95a6af8
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 23 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ RUN apt-get update \
# Setup pip3.9
RUN apt install -y curl python3.9-distutils
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
RUN python3.9 get-pip.py
RUN python3 get-pip.py
# Add Pre-downloaded models (otherwise needs be run every-time)
ADD data/ data/

# Use cache for pip, otherwise we repeatedly pull from repository
COPY requirements-cpu.txt ./requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip,mode=0777 python3.9 -m pip install -r requirements.txt

# Make type of docker image comatible
ARG req_type
COPY requirements-${REQUIREMENT_TYPE:-cpu}.txt ./requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip,mode=0777 python3 -m pip install -r requirements.txt

# Add FLTK and configurations
ADD fltk fltk
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,15 @@ should. You may also skip this step and work on your code, but it might be good
before running into trouble later.

```bash
cd charts
helm install flearner ./orchestrator --namespace test -f fltk-values.yaml --set-file orchestrator.configuration=./configs/quantities/kubernetes.conf
helm install flearner charts/orchestrator --namespace test -f charts/fltk-values.yaml\
--set-file orchestrator.experiment=./configs/federated_tasks/example_arrival_config.json,\
orchestrator.configuration=./configs/example_cloud_experiment.json
```

To debug the deployment append with the `--debug` flag, note that you may need to uninstall a prior deployment.
Alternatively, you can use the `upgrade` argument, however, currently the orchestrator does not support updated
releases. Pull requests are welcome for adding this functionality.

**N.B.** Passing the `--set-file` flag is optional, but will take by default the
`benchmarking/example_cloud_experiment.json` file. This follows the symlink in `charts/orchestrator/configs/`,
as Helm does not allow for accessing files outside a charts directory.
Expand Down
3 changes: 2 additions & 1 deletion charts/fltk-values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
fltk:
config: cloud_experiment.yaml
configDir: config
workDir: /opt/federation-lab
provider:
domain: gcr.io
projectName: test-bed-distml
Expand Down
1 change: 0 additions & 1 deletion charts/orchestrator/configs

This file was deleted.

11 changes: 11 additions & 0 deletions charts/orchestrator/templates/fl-experiment-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: fltk-experiment-config
data:
experiment.fltk.json: |-
{{ if .Values.orchestrator.experiment }}
{{ .Values.orchestrator.experiment | indent 4 }}
{{ else if .Values.orchestrator.provided.experimentFile }}
{{ .Files.Get .Values.orchestrator.provided.experimentFile | indent 4 }}
{{ end }}
8 changes: 4 additions & 4 deletions charts/orchestrator/templates/fl-server-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: ConfigMap
metadata:
name: fltk-orchestrator-config
data:
experiment.fltk.json: |-
configuration.fltk.json: |-
{{ if .Values.orchestrator.configuration }}
{{ .Values.orchestrator.configuration | indent 4 }} # Requires set-file to be passed during the template generation.
{{ else if .Values.orchestrator.configurationFile }}
{{ .Values.orchestrator.configurationFile | indent 4 }} # Requires a systemlink to be present within the template.
{{ .Values.orchestrator.configuration | indent 4 }}
{{ else if .Values.orchestrator.provided.configurationFile }}
{{ .Files.Get .Values.orchestrator.provided.configurationFile | indent 4 }}
{{ end }}
25 changes: 15 additions & 10 deletions charts/orchestrator/templates/fl-server-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ spec:
- fltk
args:
- cluster
- {{ .Values.orchestrator.runtime.configurationFile }}
- {{ .Values.orchestrator.runtime.experimentFile }}
- {{ .Values.fltk.configDir }}/{{ .Values.orchestrator.runtime.configurationFile }} # The configuration file (generator settings & logging)
- {{ .Values.fltk.configDir }}/{{ .Values.orchestrator.runtime.experimentFile }} # The experiment file (arrivals)
env:
- name: PYTHONUNBUFFERED
value: "1"
Expand All @@ -29,16 +29,21 @@ spec:
cpu: {{ (.Values.orchestrator.cpu | int) }}
memory: {{ (.Values.orchestrator.memory | int) }}
volumeMounts:
- mountPath: /opt/federation-lab/output
name: fl-server-claim
- name: fl-server-log-volume
mountPath: {{ .Values.fltk.workDir }}/output
readOnly: true
- name: fltk-orchestrator-config-volume
mountPath: {{ .Values.fltk.workDir }}/{{ .Values.fltk.configDir }}
readOnly: true
- mountPath: /opt/federation-lab/config
name: fltk-orchestrator-config
restartPolicy: Never
volumes:
- name: fl-server-claim
- name: fl-server-log-volume
persistentVolumeClaim:
claimName: fl-server-claim
- name: fltk-orchestrator-config
configMap:
name: fltk-orchestrator-config
- name: fltk-orchestrator-config-volume
projected:
sources:
- configMap:
name: fltk-orchestrator-config
- configMap:
name: fltk-experiment-config
7 changes: 5 additions & 2 deletions charts/orchestrator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ orchestrator:
cpu: 500m
memory: 500Mi
runtime:
configurationFile: configs/example_arrival_config.json
experimentFile: configs/federated_tasks/example_arrival_config.json
configurationFile: configuration.fltk.json
experimentFile: experiment.fltk.json
provided:
configurationFile: configs/federated_tasks/example_arrival_config.json
experimentFile: configs/example_arrival_config.json

0 comments on commit 95a6af8

Please sign in to comment.