From a41f65d91a68624bb2c3fe9528a691c1dbfe7432 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ferenc=20T=C3=B3th?= Date: Wed, 20 Nov 2019 16:57:02 +0100 Subject: [PATCH] Move init.sh from configmap to docker image MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Ferenc Tóth Change-Id: Ia26e8ced2b2393715a865c119d8fe9eb3e58ba83 --- SPECS/infra-charts.spec | 2 +- infra-charts/templates/sriovdp-ds.yaml | 13 ++++----- infra-charts/templates/sriovdp-initcm.yaml | 47 ------------------------------ 3 files changed, 6 insertions(+), 56 deletions(-) delete mode 100644 infra-charts/templates/sriovdp-initcm.yaml diff --git a/SPECS/infra-charts.spec b/SPECS/infra-charts.spec index 29216f9..95d601c 100644 --- a/SPECS/infra-charts.spec +++ b/SPECS/infra-charts.spec @@ -15,7 +15,7 @@ %define COMPONENT infra-charts %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 1.0.0 -%define RPM_MINOR_VERSION 45 +%define RPM_MINOR_VERSION 46 Name: %{RPM_NAME} Version: %{RPM_MAJOR_VERSION} diff --git a/infra-charts/templates/sriovdp-ds.yaml b/infra-charts/templates/sriovdp-ds.yaml index ca0e889..f581eca 100644 --- a/infra-charts/templates/sriovdp-ds.yaml +++ b/infra-charts/templates/sriovdp-ds.yaml @@ -59,16 +59,16 @@ spec: mountPath: /etc/pcidp/ readOnly: true initContainers: - - name: init-sriov + - name: init image: {{ .Values.sriovdp.image_name }} - command: ['sh', '-c', 'source /init/init.sh'] + command: ["/usr/local/bin/init.sh"] volumeMounts: + - name: time-mount + mountPath: /etc/localtime + readOnly: true - name: sriovdp-config mountPath: /etc/pcidp/ readOnly: true - - name: sriovdp-init - mountPath: /init/ - readOnly: true volumes: - name: time-mount hostPath: @@ -82,8 +82,5 @@ spec: - name: sriovdp-config hostPath: path: /etc/pcidp/ - - name: sriovdp-init - configMap: - name: sriovdp-initcm terminationGracePeriodSeconds: 1 {{ end }} diff --git a/infra-charts/templates/sriovdp-initcm.yaml b/infra-charts/templates/sriovdp-initcm.yaml deleted file mode 100644 index e8d9aa9..0000000 --- a/infra-charts/templates/sriovdp-initcm.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{/* -Copyright 2019 Nokia - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/}} -{{ if .Values.sriovdp.required }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: sriovdp-initcm - namespace: kube-system - labels: - app: sriovdp-app -data: - init.sh: |- - while true; do - date - rootdevs=`jq -r .resourceList[].rootDevices[] /dev/null` - if [[ -n "$rootdevs" ]]; then - cat /etc/pcidp/config.json | jq -r .resourceList[].rootDevices[] | while read pci; do - vf=`cat /sys/bus/pci/devices/0000:$pci/sriov_numvfs` - echo "$pci: $vf VFs" - if [[ -z "$vf" || "$vf" == "0" ]]; then - echo "No VFs found -> SR-IOV DP cannot be started -> sleep 10" - sleep 10 - break - fi - done - echo "Every SR-IOV designated PF has VF configured -> SR-IOV DP can be started -> rc=0" - exit 0 - else - echo "No SR-IOV designated PF found -> SR-IOV DP cannot be started -> sleep 10" - sleep 10 - fi - done -{{ end }} -- 2.16.6