From 7a302bb842b42e74c9bfd1b81cca1b8af754be9e Mon Sep 17 00:00:00 2001 From: Zhe Date: Mon, 18 May 2020 14:41:06 -0400 Subject: [PATCH] Allow containers to speciify command and arguement list Signed-off-by: Zhe Change-Id: Id8ad6cd78ec5eb73469988de333a892163b83ce6 --- ci/xapp_onboarder/container-tag.yaml | 2 +- xapp_onboarder/tests/constants.py | 3 ++- .../xapp_onboarder/helm_controller/xapp_schema.py | 31 ++++++++++++++++++---- .../resources/xapp-std/templates/deployment.yaml | 19 ++++++++++++- 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/ci/xapp_onboarder/container-tag.yaml b/ci/xapp_onboarder/container-tag.yaml index 29842d4..722be47 100644 --- a/ci/xapp_onboarder/container-tag.yaml +++ b/ci/xapp_onboarder/container-tag.yaml @@ -1 +1 @@ -tag: 1.0.2 +tag: 1.0.3 diff --git a/xapp_onboarder/tests/constants.py b/xapp_onboarder/tests/constants.py index 094595c..9c961bf 100644 --- a/xapp_onboarder/tests/constants.py +++ b/xapp_onboarder/tests/constants.py @@ -46,7 +46,8 @@ config_file = { "name": "o-ran-sc/ric-app-mc", "tag": "1.0.2" }, - "command": "/playpen/bin/container_start.sh" + "command": ["/bin/sh"], + "args": ["-c", "/playpen/bin/container_start.sh"] } ], "livenessProbe": { diff --git a/xapp_onboarder/xapp_onboarder/helm_controller/xapp_schema.py b/xapp_onboarder/xapp_onboarder/helm_controller/xapp_schema.py index e43f867..0588dfc 100644 --- a/xapp_onboarder/xapp_onboarder/helm_controller/xapp_schema.py +++ b/xapp_onboarder/xapp_onboarder/helm_controller/xapp_schema.py @@ -108,11 +108,32 @@ schema = { }, "command": { "$id": "#/properties/containers/items/properties/command", - "type": "string", - "title": "Command To Run The xApp Container", - "default": "command", - "examples": [ - "command" + "type": "array", + "items": [ + { + "$id": "#/properties/containers/items/properties/command/item", + "type": "string", + "title": "The Command Item", + "default": "/bin/sh", + "examples": [ + "/bin/sh" + ] + } + ] + }, + "args": { + "$id": "#/properties/containers/items/properties/args", + "type": "array", + "items": [ + { + "$id": "#/properties/containers/items/properties/args/item", + "type": "string", + "title": "The Command Arguement Item", + "default": "-c", + "examples": [ + "-c" + ] + } ] } } diff --git a/xapp_onboarder/xapp_onboarder/resources/xapp-std/templates/deployment.yaml b/xapp_onboarder/xapp_onboarder/resources/xapp-std/templates/deployment.yaml index defb6b4..9d4de1e 100644 --- a/xapp_onboarder/xapp_onboarder/resources/xapp-std/templates/deployment.yaml +++ b/xapp_onboarder/xapp_onboarder/resources/xapp-std/templates/deployment.yaml @@ -56,7 +56,24 @@ spec: - name: {{ $container.name }} image: "{{ $container.image.registry }}/{{ $container.image.name }}:{{ $container.image.tag }}" {{- if $container.command }} - command: [{{ $container.command }}] + command: [ + {{- range $command := $container.command -}} + {{- $command | quote -}} + {{- if ne $command (last $container.command) }} + {{- print ", " -}} + {{- end -}} + {{- end -}} + {{- print "]" -}} + {{- end}} + {{- if $container.args }} + args: [ + {{- range $arg := $container.args -}} + {{- $arg | quote -}} + {{- if ne $arg (last $container.args) }} + {{- print ", " -}} + {{- end -}} + {{- end -}} + {{- print "]" -}} {{- end}} imagePullPolicy: {{ $.Values.image_pull_policy }} {{- if $portlist }} -- 2.16.6