[COMMON] Remove hostPath entries
[oom.git] / kubernetes / Makefile
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modification copyright (C) 2021 Nordix Foundation
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 PARENT_CHART := onap
17 COMMON_CHARTS_DIR := common
18 # FIXME OOM-765
19 ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
20 OUTPUT_DIR := $(ROOT_DIR)/dist
21 PACKAGE_DIR := $(OUTPUT_DIR)/packages
22 SECRET_DIR := $(OUTPUT_DIR)/secrets
23 HELM_BIN := helm
24
25 HELM_VER := $(shell $(HELM_BIN) version --template "{{.Version}}" 2>/dev/null)
26
27 # use this if you would like to cm-push onap charts to repo with other name
28 # WARNING: Helm v3+ only
29 # WARNING: Make sure to edit also Chart files
30 HELM_REPO := local
31
32 ifneq ($(SKIP_LINT),TRUE)
33         HELM_LINT_CMD := $(HELM_BIN) lint
34 else
35         HELM_LINT_CMD := echo "Skipping linting of"
36 endif
37
38 SUBMODS := robot
39 EXCLUDES := common config oneclick readiness test dist helm $(PARENT_CHART) dcae $(SUBMODS)
40 HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.))))
41
42 .PHONY: $(EXCLUDES) $(HELM_CHARTS) check-for-staging-images
43
44 all: print_helm_bin $(COMMON_CHARTS_DIR) $(SUBMODS) $(HELM_CHARTS) $(PARENT_CHART) helm-repo-update plugins
45
46 $(COMMON_CHARTS_DIR):
47         @echo "\n[$@]"
48         @make package-$@
49
50 $(HELM_CHARTS): $(COMMON_CHARTS_DIR)
51         @echo "\n[$@]"
52         @make package-$@
53
54 $(SUBMODS): $(COMMON_CHARTS_DIR)
55         @echo "\n[$@]"
56         @make submod-$@
57         @make package-$@
58
59 $(PARENT_CHART): $(HELM_CHARTS)
60         @echo "\n[$@]"
61         @make package-$@
62
63 submod-%:
64         @make $*/Chart.yaml
65
66 %/Chart.yaml:
67         $(error Submodule $* needs to be retrieved from gerrit.  See https://wiki.onap.org/display/DW/OOM+-+Development+workflow+after+code+transfer+to+tech+teams ); fi
68
69 print_helm_bin:
70         $(info Using Helm binary ${HELM_BIN} which is helm version ${HELM_VER})
71
72 make-%:
73         @if [ -f $*/Makefile ]; then make -C $*; fi
74
75 dep-%: make-%
76         @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) dep up $*; fi
77
78 lint-%: dep-%
79         @if [ -f $*/Chart.yaml ]; then $(HELM_LINT_CMD) $*; fi
80
81 package-%: lint-%
82         @mkdir -p $(PACKAGE_DIR)
83         @if [ -f $*/Chart.yaml ]; then PACKAGE_NAME=$$($(HELM_BIN) package -d $(PACKAGE_DIR) $* | cut -d":" -f2) && $(HELM_BIN) cm-push -f $$PACKAGE_NAME $(HELM_REPO); fi
84         @sleep 3
85
86 clean:
87         @rm -f */Chart.lock
88         @find . -type f -name '*.tgz' -delete
89         @rm -rf $(PACKAGE_DIR)/*
90
91 # publish helm plugins via distrubtion directory
92 plugins:
93         @mkdir -p $(PACKAGE_DIR)
94         @cp -R helm $(PACKAGE_DIR)/
95
96 check-for-staging-images:
97         $(ROOT_DIR)/../.ci/check-for-staging-images.sh
98
99 helm-repo-update: $(PARENT_CHART)
100         @$(HELM_BIN) repo update
101
102 %:
103         @: