Skip to content

Commit f3a1a34

Browse files
Xunzhuoseeflood
andauthored
feat: add cmds to deploy layotto (#731)
Co-authored-by: seeflood <[email protected]>
1 parent e19e539 commit f3a1a34

File tree

6 files changed

+71
-0
lines changed

6 files changed

+71
-0
lines changed

Makefile

+32
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ include make/golang.mk
7575
include make/image.mk
7676
include make/wasm.mk
7777
include make/ci.mk
78+
include make/deploy.mk
7879
include make/proto.mk
7980

8081
# ==============================================================================
@@ -165,6 +166,34 @@ wasm.image:
165166
wasm.image.push:
166167
@$(MAKE) go.wasm.image.push
167168

169+
# ==============================================================================
170+
## deploy: Deploy Layotto to Kubernetes
171+
# ==============================================================================
172+
.PHONY: deploy
173+
deploy:
174+
@$(MAKE) deploy.k8s
175+
176+
# ==============================================================================
177+
## deploy.standalone: Deploy Layotto to Kubernetes in Standalone Mode
178+
# ==============================================================================
179+
.PHONY: deploy.standalone
180+
deploy.standalone:
181+
@$(MAKE) deploy.k8s.standalone
182+
183+
# ==============================================================================
184+
## undeploy: Remove Layotto in Kubernetes
185+
# ==============================================================================
186+
.PHONY: undeploy
187+
undeploy:
188+
@$(MAKE) undeploy.k8s
189+
190+
# ==============================================================================
191+
## undeploy.standalone: Remove Layotto in Kubernetes in Standalone Mode
192+
# ==============================================================================
193+
.PHONY: undeploy.standalone
194+
undeploy.standalone:
195+
@$(MAKE) undeploy.k8s.standalone
196+
168197
# ==============================================================================
169198
## check: Run all go checks of code sources.
170199
# ==============================================================================
@@ -291,6 +320,9 @@ ARGS:
291320
This option is available when using: make build.multiarch/image.multiarch/push.multiarch
292321
Example: make image.multiarch IMAGES="layotto" PLATFORMS="linux_amd64 linux_arm64"
293322
Supported Platforms: linux_amd64 linux_arm64 darwin_amd64 darwin_arm64
323+
NAMESPACE The namepace to deploy. Default is `default`.
324+
This option is available when using: make deploy/deploy.standalone/undeploy/undeploy.standalone
325+
Example: make deploy NAMESPACE="layotto"
294326
endef
295327
export USAGE_OPTIONS
296328

make/common.mk

+6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ endif
5151
ifeq ($(origin SUPERVISOR_DIR),undefined)
5252
SUPERVISOR_DIR := $(ROOT_DIR)/etc/supervisor
5353
endif
54+
ifeq ($(origin DEPLOY_DIR),undefined)
55+
DEPLOY_DIR := $(ROOT_DIR)/deploy
56+
endif
57+
ifeq ($(origin K8S_DIR),undefined)
58+
K8S_DIR := $(DEPLOY_DIR)/k8s
59+
endif
5460

5561
# set the version number. you should not need to do this
5662
# for the majority of scenarios.

make/deploy.mk

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2021 Layotto Authors
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
# This file contains commands to deploy/undeploy layotto into Kubernetes
15+
# Default namespace is `default`
16+
17+
NAMESPACE := default
18+
19+
.PHONY: deploy.k8s
20+
deploy.k8s: deploy.k8s.standalone
21+
22+
.PHONY: deploy.k8s.standalone
23+
deploy.k8s.standalone:
24+
@echo "===========> Deploy Layotto to Kubernetes in namespace ${NAMESPACE} in standalone mode"
25+
@kubectl apply -f $(K8S_DIR)/standalone/default_quickstart.yaml -n ${NAMESPACE}
26+
27+
.PHONY: undeploy.k8s
28+
undeploy.k8s: undeploy.k8s.standalone
29+
30+
.PHONY: undeploy.k8s.standalone
31+
undeploy.k8s.standalone:
32+
@echo "===========> Clean Layotto to Kubernetes in namespace ${NAMESPACE} in standalone mode"
33+
@kubectl delete -f $(K8S_DIR)/standalone/default_quickstart.yaml -n ${NAMESPACE}

0 commit comments

Comments
 (0)