This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-showcase.git


The following commit(s) were added to refs/heads/main by this push:
     new ee6f1fc  Add prerequisite check (#126)
ee6f1fc is described below

commit ee6f1fc9d6e0fa8811e24f0008da19956c893b2f
Author: kezhenxu94 <[email protected]>
AuthorDate: Mon Apr 24 16:37:32 2023 +0800

    Add prerequisite check (#126)
---
 deploy/platform/kubernetes/Makefile  | 12 ++++++-----
 deploy/platform/kubernetes/check.mak | 41 ++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/deploy/platform/kubernetes/Makefile 
b/deploy/platform/kubernetes/Makefile
index 88a8d0a..48f415c 100644
--- a/deploy/platform/kubernetes/Makefile
+++ b/deploy/platform/kubernetes/Makefile
@@ -19,6 +19,11 @@
 include ../../../Makefile.in
 include Makefile.in
 
+features := $(subst $(comma), ,$(FEATURE_FLAGS))
+features := $(foreach f,$(features),feature-$(f))
+
+include check.mak
+
 HELM_OPTIONS := $(HELM_OPTIONS) --set skywalking.fullnameOverride=$(RELEASE)
 HELM_OPTIONS := $(HELM_OPTIONS) --set 
skywalking.oap.image.repository=$(SW_OAP_IMAGE) --set 
skywalking.oap.image.tag=$(SW_OAP_IMAGE_TAG)
 HELM_OPTIONS := $(HELM_OPTIONS) --set 
skywalking.ui.image.repository=$(SW_UI_IMAGE) --set 
skywalking.ui.image.tag=$(SW_UI_IMAGE_TAG)
@@ -34,10 +39,6 @@ HELM_OPTIONS := $(HELM_OPTIONS) --set 
features.javaAgentInjector.agentImage=$(SW
 HELM_OPTIONS := $(HELM_OPTIONS) --set features.rover.image=$(SW_ROVER_IMAGE)
 HELM_OPTIONS := $(HELM_OPTIONS) --set 
features.promql.grafana.image=$(GRAFANA_IMAGE)
 
-
-features := $(subst $(comma), ,$(FEATURE_FLAGS))
-features := $(foreach f,$(features),feature-$(f))
-
 ifeq ($(DEBUG),true)
        HELM_OPTIONS := $(HELM_OPTIONS) --dry-run
 endif
@@ -155,9 +156,10 @@ feature-mesh-with-agent:
 deploy: $(features)
        helm dep up .
        helm -n $(NAMESPACE) upgrade --install $(RELEASE) . --create-namespace 
--timeout=20m $(HELM_OPTIONS)
-
+ifneq ($(DEBUG),true)
        $(info rollout restart to allow the new sidecar to be injected.)
        kubectl -n $(SAMPLE_SERVICES_NAMESPACE) get deployments -o name | xargs 
kubectl -n $(SAMPLE_SERVICES_NAMESPACE) rollout restart
+endif
 
 .PHONY: undeploy
 undeploy:
diff --git a/deploy/platform/kubernetes/check.mak 
b/deploy/platform/kubernetes/check.mak
new file mode 100644
index 0000000..58d679c
--- /dev/null
+++ b/deploy/platform/kubernetes/check.mak
@@ -0,0 +1,41 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Check prerequisites
+
+ifeq ($(filter feature-elasticsearch,$(features)),feature-elasticsearch)
+ifeq ($(filter feature-postgresql,$(features)),feature-postgresql)
+ERROR := only one of `elasticsearch` and `postgresql` can be enabled
+endif
+endif
+
+ifneq ($(filter feature-elasticsearch,$(features)),feature-elasticsearch)
+ifneq ($(filter feature-postgresql,$(features)),feature-postgresql)
+ERROR := either `elasticsearch` or `postgresql` must be enabled
+endif
+endif
+
+ifneq ($(filter feature-elasticsearch,$(features)),feature-elasticsearch)
+ifeq ($(filter 
feature-elasticsearch-monitor,$(features)),feature-elasticsearch-monitor)
+ERROR := although `elasticsearch-monitor` does not require `elasticsearch` as 
storage, but in showcase we use the ElasticSearch used by SkyWalking itself to 
be monitored, so please enable `elasticsearch` as well.
+endif
+endif
+
+ifdef ERROR
+$(error $(ERROR))
+endif

Reply via email to