[SDC] Use helm-push plugin

Signed-off-by: Jakub Latusek <j.latusek@samsung.com>
Issue-ID: OOM-2562
Change-Id: Ib39a3846020292cc4087947356d9d8e6247905d7
diff --git a/kubernetes/sdc/Makefile b/kubernetes/sdc/Makefile
index f2670c5..3dab31f 100644
--- a/kubernetes/sdc/Makefile
+++ b/kubernetes/sdc/Makefile
@@ -20,6 +20,8 @@
 EXCLUDES := dist resources templates charts docker
 HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.))))
 
+HELM_VER := $(shell helm version --template "{{.Version}}")
+
 .PHONY: $(EXCLUDES) $(HELM_CHARTS)
 
 all: $(HELM_CHARTS)
@@ -39,7 +41,12 @@
 
 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/sdc/components/Makefile b/kubernetes/sdc/components/Makefile
index 8d3bf2b..0d5b9e0 100644
--- a/kubernetes/sdc/components/Makefile
+++ b/kubernetes/sdc/components/Makefile
@@ -19,6 +19,7 @@
 
 EXCLUDES :=
 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: