78503ace8890f110df0713037adbbd501ecf7c94
[pti/rtp.git] / meta-stx / recipes-core / stx-monitor-armada-app / monitor-helm_1.0.bb
1 #
2 ## Copyright (C) 2019 Wind River Systems, Inc.
3 #
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15
16 SUMMARY = "Monitor Helm charts"
17 DESCRIPTION = "Monitor Helm charts"
18
19 LICENSE = "Apache-2.0"
20 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
21
22 DEPENDS += " \
23     helm-native \
24     monitor-helm-elastic \
25 "
26
27 PROTOCOL = "https"
28 BRANCH = "r/stx.3.0"
29 SRCREV_helm-charts = "92b6289ae93816717a8453cfe62bad51cbdb8ad0"
30 SRCREV_monitor-armada-app = "e5ee6b3a07b74479b93fe90eff0662cf81890f73"
31
32 SRC_URI = " \
33     git://github.com/helm/charts;protocol=${PROTOCOL};name=helm-charts \
34     git://opendev.org/starlingx/monitor-armada-app.git;protocol=${PROTOCOL};branch=${BRANCH};name=monitor-armada-app;destsuffix=monitor-armada-app \
35 "
36
37 S = "${WORKDIR}/git"
38
39 inherit allarch
40
41 patch_folder = "${WORKDIR}/monitor-armada-app/monitor-helm/files"
42 helm_folder = "${nonarch_libdir}/helm"
43 helmchart_version = "0.1.0"
44
45 do_patch () {
46         cd ${S}
47         git am ${patch_folder}/0001-Add-Makefile-for-helm-charts.patch
48         git am ${patch_folder}/0002-kibana-workaround-checksum-for-configmap.yaml.patch
49         git am ${patch_folder}/0003-helm-chart-changes-for-stx-monitor.patch
50         git am ${patch_folder}/0004-ipv6-helm-chart-changes.patch
51         git am ${patch_folder}/0005-decouple-config.patch
52         git am ${patch_folder}/0006-add-system-info.patch
53         git am ${patch_folder}/0007-three-masters.patch
54         git am ${patch_folder}/0008-Update-stx-monitor-for-kubernetes-API-1.16.patch
55         git am ${patch_folder}/0009-add-curator-as-of-2019-10-10.patch
56         git am ${patch_folder}/0010-Update-kube-state-metrics-1.8.0-to-commit-09daf19.patch
57         git am ${patch_folder}/0011-update-init-container-env-to-include-node-name.patch
58         git am ${patch_folder}/0012-Add-imagePullSecrets.patch
59         git am ${patch_folder}/0013-removed-unused-images.patch
60 }
61
62 do_configure () {
63         :
64 }
65
66 do_compile () {
67         # initialize helm and build the toolkit
68         # helm init --client-only does not work if there is no networking
69         # The following commands do essentially the same as: helm init
70         export HOME="${B}/${USER}"
71         export helm_home="${B}/${USER}/.helm"
72         rm -rf ${helm_home}
73
74         mkdir -p ${helm_home}
75         mkdir ${helm_home}/repository
76         mkdir ${helm_home}/repository/cache
77         mkdir ${helm_home}/repository/local
78         mkdir ${helm_home}/plugins
79         mkdir ${helm_home}/starters
80         mkdir ${helm_home}/cache
81         mkdir ${helm_home}/cache/archive
82
83         # Stage a repository file that only has a local repo
84         install -m 0644 ${patch_folder}/repositories.yaml ${helm_home}/repository/repositories.yaml
85
86         # Stage a local repo index that can be updated by the build
87         install -m 0644 ${patch_folder}/index.yaml ${helm_home}/repository/local/index.yaml
88
89         # Host a server for the charts
90         helm serve --repo-path . &
91         helm repo rm local
92         helm repo add local http://localhost:8879/charts
93
94         # Create the tgz files
95         cd stable
96         make filebeat
97         make metricbeat
98         make kube-state-metrics
99         make kibana
100         make nginx-ingress
101         make logstash
102         make elasticsearch-curator
103
104         # terminate helm server
105         pid=`/bin/pidof helm`
106         kill ${pid}
107         rm -rf ${helm_home}
108 }
109
110 do_install () {
111         install -d -m 755 ${D}${helm_folder}
112         install -p -D -m 755 ${S}/stable/*.tgz ${D}${helm_folder}
113 }
114
115 FILES_${PN} = "${helm_folder}"
116
117 RDEPENDS_${PN} = " \
118     helm \
119     monitor-helm-elastic \
120 "