From 95a6af888a2ac3d7d6e7e6bc0769740f7b2cee4f Mon Sep 17 00:00:00 2001 From: Jeroen Galjaard Date: Wed, 20 Apr 2022 12:00:23 +0200 Subject: [PATCH] Update charts to allow for dynamic dispatch of configuration files --- Dockerfile | 9 ++++--- README.md | 9 +++++-- charts/fltk-values.yaml | 3 ++- charts/orchestrator/configs | 1 - .../templates/fl-experiment-config.yaml | 11 ++++++++ .../templates/fl-server-config.yaml | 8 +++--- .../orchestrator/templates/fl-server-pod.yaml | 25 +++++++++++-------- charts/orchestrator/values.yaml | 7 ++++-- 8 files changed, 50 insertions(+), 23 deletions(-) delete mode 120000 charts/orchestrator/configs create mode 100644 charts/orchestrator/templates/fl-experiment-config.yaml diff --git a/Dockerfile b/Dockerfile index ebdaf91c..ad7bc67e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 422dfe4b..6c0aa80e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/charts/fltk-values.yaml b/charts/fltk-values.yaml index 70eb3908..1fb340cf 100644 --- a/charts/fltk-values.yaml +++ b/charts/fltk-values.yaml @@ -1,5 +1,6 @@ fltk: - config: cloud_experiment.yaml + configDir: config + workDir: /opt/federation-lab provider: domain: gcr.io projectName: test-bed-distml diff --git a/charts/orchestrator/configs b/charts/orchestrator/configs deleted file mode 120000 index 5992d109..00000000 --- a/charts/orchestrator/configs +++ /dev/null @@ -1 +0,0 @@ -../../configs \ No newline at end of file diff --git a/charts/orchestrator/templates/fl-experiment-config.yaml b/charts/orchestrator/templates/fl-experiment-config.yaml new file mode 100644 index 00000000..ac2f221c --- /dev/null +++ b/charts/orchestrator/templates/fl-experiment-config.yaml @@ -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 }} \ No newline at end of file diff --git a/charts/orchestrator/templates/fl-server-config.yaml b/charts/orchestrator/templates/fl-server-config.yaml index ccf69f6d..2276b919 100644 --- a/charts/orchestrator/templates/fl-server-config.yaml +++ b/charts/orchestrator/templates/fl-server-config.yaml @@ -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 }} \ No newline at end of file diff --git a/charts/orchestrator/templates/fl-server-pod.yaml b/charts/orchestrator/templates/fl-server-pod.yaml index f7707390..4e5dee66 100644 --- a/charts/orchestrator/templates/fl-server-pod.yaml +++ b/charts/orchestrator/templates/fl-server-pod.yaml @@ -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" @@ -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 diff --git a/charts/orchestrator/values.yaml b/charts/orchestrator/values.yaml index 47d773d3..65a977c8 100644 --- a/charts/orchestrator/values.yaml +++ b/charts/orchestrator/values.yaml @@ -2,5 +2,8 @@ orchestrator: cpu: 500m memory: 500Mi runtime: - configurationFile: configs/example_arrival_config.json - experimentFile: configs/federated_tasks/example_arrival_config.json \ No newline at end of file + configurationFile: configuration.fltk.json + experimentFile: experiment.fltk.json + provided: + configurationFile: configs/federated_tasks/example_arrival_config.json + experimentFile: configs/example_arrival_config.json