Initial Version of Helm Chart for OpenDaylight
[integration/packaging.git] / helm / opendaylight / templates / configmap.yaml
1 {{/*
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2021 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 */}}
12
13 apiVersion: v1
14 kind: ConfigMap
15 metadata:
16   name: {{ include "opendaylight.fullname" . }}
17 data:
18   startodl.sh: |
19     #!/bin/bash
20     mountpath="{{ .Values.persistence.mountPath }}"
21     BASEDIR="{{ .Values.config.odl_basedir }}"
22     odl_prefix="/opt/opendaylight"
23
24     if [[ ! -d "$mountpath/snapshots" ]];then
25       mkdir -p $mountpath/snapshots
26     fi
27
28     if [[ ! -d "$mountpath/data" ]];then
29       mkdir -p $mountpath/data
30     fi
31
32     if [[ ! -d "$mountpath/segmented-journal" ]];then
33       mkdir -p $mountpath/segmented-journal
34     fi
35
36     if [[ ! -d "$mountpath/daexim" ]];then
37       mkdir -p $mountpath/daexim
38     fi
39
40     if [[ ! -L "$odl_prefix/snapshots" ]];then
41       rm -rf $odl_prefix/snapshots && ln -s $mountpath/snapshots $odl_prefix/snapshots
42     fi
43
44     if [[ ! -L "$odl_prefix/data" ]];then
45       rm -rf $odl_prefix/data && ln -s $mountpath/data $odl_prefix/data
46     fi
47
48     if [[ ! -L "$odl_prefix/segmented-journal" ]];then
49       rm -rf $odl_prefix/segmented-journal && ln -s $mountpath/segmented-journal $odl_prefix/segmented-journal
50     fi
51
52     if [[ ! -L "$odl_prefix/daexim" ]];then
53       rm -rf $odl_prefix/daexim && ln -s $mountpath/daexim $odl_prefix/daexim
54     fi
55
56     sed -i "s/\(featuresBoot= \|featuresBoot = \)/featuresBoot = ${FEATURES},/g" ${BASEDIR}/etc/org.apache.karaf.features.cfg
57     cat ${BASEDIR}/etc/org.apache.karaf.features.cfg
58     ${BASEDIR}/bin/karaf run