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

Commit

Permalink
Made pod-profile-mount-volume service yaml more configurable. (#2785)
Browse files Browse the repository at this point in the history
  • Loading branch information
chhsia0 authored and nfnt committed Nov 28, 2018
1 parent 6c63331 commit a9199ae
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
18 changes: 16 additions & 2 deletions frameworks/helloworld/src/main/dist/pod-profile-mount-volume.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ pods:
profile:
goal: RUNNING
essential: false
cmd: df -t $VOLUME_PROFILE pod-container-path >> pod-container-path/output && df -t $VOLUME_PROFILE profile-container-path >> profile-container-path/output && sleep $SLEEP_DURATION
cmd: >
set -e -x
[ -n "{{{TEST_PROFILE_VOLUME_COMMAND}}}" ]
{{{TEST_PROFILE_VOLUME_COMMAND}}} pod-container-path
{{{TEST_PROFILE_VOLUME_COMMAND}}} profile-container-path
echo profile >> pod-container-path/output
echo profile >> profile-container-path/output
sleep $SLEEP_DURATION
cpus: {{HELLO_CPUS}}
memory: {{HELLO_MEM}}
env:
Expand All @@ -28,7 +35,14 @@ pods:
noprofile:
goal: RUNNING
essential: false
cmd: df -t $VOLUME_PROFILE pod-container-path >> pod-container-path/output && df -t ext4 noprofile-container-path >> noprofile-container-path/output && sleep $SLEEP_DURATION
cmd: >
set -e -x
[ -n "{{{TEST_PROFILE_VOLUME_COMMAND}}}" ]
{{{TEST_PROFILE_VOLUME_COMMAND}}} pod-container-path
! {{{TEST_PROFILE_VOLUME_COMMAND}}} noprofile-container-path
echo noprofile >> pod-container-path/output
echo noprofile >> noprofile-container-path/output
sleep $SLEEP_DURATION
cpus: {{HELLO_CPUS}}
memory: {{HELLO_MEM}}
env:
Expand Down
9 changes: 7 additions & 2 deletions frameworks/helloworld/tests/test_profile_mount_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ def configure_package(configure_security):
try:
sdk_install.uninstall(config.PACKAGE_NAME, config.SERVICE_NAME)
options = {
"service": {"yaml": "pod-profile-mount-volume"},
"hello": {"volume_profile": "xfs"} # hardcoded in `tools/create_testing_volumes.py`.
"service": {
"test_profile_volume_command": "df -t xfs",
"yaml": "pod-profile-mount-volume"
},
"hello": {
"volume_profile": "xfs" # hardcoded in `tools/create_testing_volumes.py`.
}
}

sdk_install.install(config.PACKAGE_NAME, config.SERVICE_NAME, NUM_HELLO, additional_options=options)
Expand Down
5 changes: 5 additions & 0 deletions frameworks/helloworld/universe/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
"type": "boolean",
"default": true
},
"test_profile_volume_command": {
"description": "A shell command to test if a given path is on a profile volume, or empty for no test",
"type": "string",
"default": ""
},
"scenario": {
"description": "A comma-separated list of SDK customization scenarios to perform on the service(s)",
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions frameworks/helloworld/universe/marathon.json.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"KEYSTORE_APP_VERSION": "{{tls.keystore_app_version}}",
"NGINX_CONTAINER_VERSION": "{{tls.nginx_container_version}}",
"TEST_BOOLEAN": "{{service.test_boolean}}",
"TEST_PROFILE_VOLUME_COMMAND": "{{{service.test_profile_volume_command}}}",
"SCENARIOS": "{{service.scenario}}",
"ALLOW_REGION_AWARENESS": "{{service.allow_region_awareness}}",
"HELLO_PORT_ONE": "{{hello.port_one}}",
Expand Down

0 comments on commit a9199ae

Please sign in to comment.