[PLATFORM] Use helm-push plugin

Signed-off-by: Jakub Latusek <j.latusek@samsung.com>
Issue-ID: OOM-2562
Change-Id: Ic115d723be9ce6a963ddef8c401eeacc6a38698e
diff --git a/kubernetes/platform/Makefile b/kubernetes/platform/Makefile
index 7a55c2e..d3fa8b7 100644
--- a/kubernetes/platform/Makefile
+++ b/kubernetes/platform/Makefile
@@ -19,6 +19,7 @@
 
 EXCLUDES := dist resources templates charts
 HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.))))
+HELM_VER := $(shell helm version --template "{{.Version}}")
 
 .PHONY: $(EXCLUDES) $(HELM_CHARTS)
 
@@ -39,7 +40,11 @@
 
 package-%: lint-%
 	@mkdir -p $(PACKAGE_DIR)
+ifeq "$(findstring v3,$(HELM_VER))" "v3"
+	@if [ -f $*/Chart.yaml ]; then PACKAGE_NAME=$$(helm package -d $(PACKAGE_DIR) $* | cut -d":" -f2) && helm push -f $$PACKAGE_NAME local; fi
+else
 	@if [ -f $*/Chart.yaml ]; then helm package -d $(PACKAGE_DIR) $*; fi
+endif
 	@helm repo index $(PACKAGE_DIR)
 
 clean:
diff --git a/kubernetes/platform/components/Makefile b/kubernetes/platform/components/Makefile
index 27e17db..cf69fa6 100644
--- a/kubernetes/platform/components/Makefile
+++ b/kubernetes/platform/components/Makefile
@@ -20,6 +20,7 @@
 
 EXCLUDES :=
 HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.))))
+HELM_VER := $(shell helm version --template "{{.Version}}")
 
 .PHONY: $(EXCLUDES) $(HELM_CHARTS)
 
@@ -40,7 +41,11 @@
 
 package-%: lint-%
 	@mkdir -p $(PACKAGE_DIR)
+ifeq "$(findstring v3,$(HELM_VER))" "v3"
+	@if [ -f $*/Chart.yaml ]; then PACKAGE_NAME=$$(helm package -d $(PACKAGE_DIR) $* | cut -d":" -f2) && helm push -f $$PACKAGE_NAME local; fi
+else
 	@if [ -f $*/Chart.yaml ]; then helm package -d $(PACKAGE_DIR) $*; fi
+endif
 	@helm repo index $(PACKAGE_DIR)
 
 clean: