diff --git a/testpmd-container-app/cnfapp/Dockerfile b/testpmd-container-app/cnfapp/Dockerfile index f5cd2713..50433f63 100644 --- a/testpmd-container-app/cnfapp/Dockerfile +++ b/testpmd-container-app/cnfapp/Dockerfile @@ -46,9 +46,12 @@ RUN chown example-cnf /var/log/testpmd COPY --chmod=550 --from=build2 /utils/webserver /usr/local/bin/webserver COPY --chmod=550 --from=build /usr/local/bin/dpdk-testpmd /usr/local/bin/example-cnf/testpmd COPY --chmod=550 scripts/testpmd-wrapper /usr/local/bin/example-cnf/testpmd-wrapper +COPY --chmod=550 scripts/infinite.sh /usr/local/bin/example-cnf/run/infinite.sh # Move to the custom user USER example-cnf # Prepare entrypoint -ENTRYPOINT ["/usr/local/bin/example-cnf/testpmd-wrapper"] +#ENTRYPOINT ["/usr/local/bin/example-cnf/testpmd-wrapper"] +## Make the container to live forever without executing testpmd-wrapper, we'll run it manually +ENTRYPOINT ["/usr/local/bin/example-cnf/run/infinite.sh"] diff --git a/testpmd-container-app/cnfapp/scripts/infinite.sh b/testpmd-container-app/cnfapp/scripts/infinite.sh new file mode 100755 index 00000000..bf1fede7 --- /dev/null +++ b/testpmd-container-app/cnfapp/scripts/infinite.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sleep 999999999999 & diff --git a/testpmd-container-app/cnfapp/scripts/testpmd-wrapper b/testpmd-container-app/cnfapp/scripts/testpmd-wrapper index 27ab832d..25dd15a0 100644 --- a/testpmd-container-app/cnfapp/scripts/testpmd-wrapper +++ b/testpmd-container-app/cnfapp/scripts/testpmd-wrapper @@ -89,6 +89,15 @@ CMD="${CMD} 2>&1 | tee /var/log/testpmd/app.log" echo "${CMD}" > $RUN chmod +x $RUN +RUN_INT="/usr/local/bin/example-cnf/testpmd-interactive" +CMD_INT="/usr/local/bin/example-cnf/testpmd" +CMD_INT="${CMD_INT} -l $LCORES --in-memory $PCI --socket-mem ${SOCKET_MEM} -n ${MEMORY_CHANNELS} --proc-type auto --file-prefix pg" +CMD_INT="${CMD_INT} --" +CMD_INT="${CMD_INT} --disable-rss --nb-cores=${FORWARDING_CORES} --rxq=${RXQ} --txq=${TXQ} --rxd=${RXD} --txd=${TXD}" +CMD_INT="${CMD_INT} --i ${ETH_PEER} --forward-mode=mac --stats-period ${STATS_PERIOD}" +echo "${CMD_INT}" > $RUN_INT +chmod +x $RUN_INT + function sig_term() { echo $(date +"%F %T,%3N") > /var/log/testpmd/sigterm-received.log # kill testpmd application @@ -97,8 +106,9 @@ function sig_term() { } trap sig_term SIGTERM -if [[ $RUN_APP == "1" ]]; then - sudo /usr/local/bin/example-cnf/run/testpmd-run -else - sleep infinity -fi +# do not launch testpmd-run script, we just need its content to launch the same but in interactive mode +#if [[ $RUN_APP == "1" ]]; then +# sudo /usr/local/bin/example-cnf/run/testpmd-run +#else +# sleep infinity +#fi diff --git a/testpmd-operator/roles/testpmd/templates/deployment.yml b/testpmd-operator/roles/testpmd/templates/deployment.yml index 6b63323a..deeddae8 100644 --- a/testpmd-operator/roles/testpmd/templates/deployment.yml +++ b/testpmd-operator/roles/testpmd/templates/deployment.yml @@ -63,6 +63,7 @@ spec: containerPort: 8095 image: "{{ image_testpmd }}" imagePullPolicy: "{{ image_pull_policy }}" + command: ['tail', '-f', '/dev/null'] securityContext: runAsNonRoot: true runAsUser: 56560 @@ -130,31 +131,6 @@ spec: - name: {{ key }} value: "{{ value }}" {% endfor %} - lifecycle: - postStart: - exec: - command: ["/bin/sh", "-c", "echo Hello from the postStart handler"] - preStop: - exec: - command: ["/bin/sh", "-c", "echo Hello from the preStop handler"] - livenessProbe: - httpGet: - path: /healthz - port: 8095 - initialDelaySeconds: 15 - periodSeconds: 10 - readinessProbe: - httpGet: - path: /readyz - port: 8095 - initialDelaySeconds: 5 - periodSeconds: 10 - startupProbe: - httpGet: - path: /startz - port: 8095 - initialDelaySeconds: 30 - periodSeconds: 10 terminationMessagePolicy: FallbackToLogsOnError volumes: - name: hugepage diff --git a/trex-container-app/server/Dockerfile b/trex-container-app/server/Dockerfile index 97cf09a0..07238a84 100644 --- a/trex-container-app/server/Dockerfile +++ b/trex-container-app/server/Dockerfile @@ -84,3 +84,8 @@ COPY --chmod=550 --from=build /utils/webserver /usr/local/bin/webserver # Move to the custom user USER example-cnf + +# Prepare entrypoint +#ENTRYPOINT ["trex-wrapper"] +## Make the container to live forever without executing testpmd-wrapper, we'll run it manually +ENTRYPOINT ["infinite.sh"] diff --git a/trex-container-app/server/scripts/infinite.sh b/trex-container-app/server/scripts/infinite.sh new file mode 100755 index 00000000..bf1fede7 --- /dev/null +++ b/trex-container-app/server/scripts/infinite.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sleep 999999999999 & diff --git a/trex-operator/roles/server/defaults/main.yml b/trex-operator/roles/server/defaults/main.yml index 0423e0a7..c95d8523 100644 --- a/trex-operator/roles/server/defaults/main.yml +++ b/trex-operator/roles/server/defaults/main.yml @@ -6,7 +6,6 @@ image_server: "quay.io/rh-nfv-int/trex-container-server@sha256:190d69aef293d1719 image_app: "quay.io/rh-nfv-int/trex-container-app@sha256:da8c5aae7f2f7459d9d7b842880040cfde0ce301a9edc83e88ae9f27dc448829" # v0.2.6 image_pull_policy: IfNotPresent privileged: false -command: ["trex-wrapper"] environments: {} network_resources: {} enable_lb: true diff --git a/trex-operator/roles/server/templates/deployment.yml b/trex-operator/roles/server/templates/deployment.yml index 943ecdbd..4e1fb05a 100644 --- a/trex-operator/roles/server/templates/deployment.yml +++ b/trex-operator/roles/server/templates/deployment.yml @@ -71,7 +71,7 @@ spec: containers: {% if trex_server|bool %} - name: trex-server - command: {{ command }} + command: ['tail', '-f', '/dev/null'] image: "{{ image_server }}" imagePullPolicy: "{{ image_pull_policy }}" ports: @@ -130,31 +130,6 @@ spec: - name: {{ key }} value: "{{ value }}" {% endfor %} - lifecycle: - postStart: - exec: - command: ["/bin/sh", "-c", "echo Hello from the postStart handler"] - preStop: - exec: - command: ["/bin/sh", "-c", "echo Hello from the preStop handler"] - livenessProbe: - httpGet: - path: /healthz - port: 8096 - initialDelaySeconds: 15 - periodSeconds: 10 - readinessProbe: - httpGet: - path: /readyz - port: 8096 - initialDelaySeconds: 5 - periodSeconds: 10 - startupProbe: - httpGet: - path: /startz - port: 8096 - initialDelaySeconds: 30 - periodSeconds: 10 terminationMessagePolicy: FallbackToLogsOnError {% endif %} {% if trex_app|bool %}