Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cmds to deploy layotto #731

Merged
merged 2 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ include make/golang.mk
include make/image.mk
include make/wasm.mk
include make/ci.mk
include make/deploy.mk
include make/proto.mk

# ==============================================================================
Expand Down Expand Up @@ -165,6 +166,34 @@ wasm.image:
wasm.image.push:
@$(MAKE) go.wasm.image.push

# ==============================================================================
## deploy: Deploy Layotto to Kubernetes
# ==============================================================================
.PHONY: deploy
deploy:
@$(MAKE) deploy.k8s

# ==============================================================================
## deploy.standalone: Deploy Layotto to Kubernetes in Standalone Mode
# ==============================================================================
.PHONY: deploy.standalone
deploy.standalone:
@$(MAKE) deploy.k8s.standalone

# ==============================================================================
## undeploy: Remove Layotto in Kubernetes
# ==============================================================================
.PHONY: undeploy
undeploy:
@$(MAKE) undeploy.k8s

# ==============================================================================
## undeploy.standalone: Remove Layotto in Kubernetes in Standalone Mode
# ==============================================================================
.PHONY: undeploy.standalone
undeploy.standalone:
@$(MAKE) undeploy.k8s.standalone

# ==============================================================================
## check: Run all go checks of code sources.
# ==============================================================================
Expand Down Expand Up @@ -291,6 +320,9 @@ ARGS:
This option is available when using: make build.multiarch/image.multiarch/push.multiarch
Example: make image.multiarch IMAGES="layotto" PLATFORMS="linux_amd64 linux_arm64"
Supported Platforms: linux_amd64 linux_arm64 darwin_amd64 darwin_arm64
NAMESPACE The namepace to deploy. Default is `default`.
This option is available when using: make deploy/deploy.standalone/undeploy/undeploy.standalone
Example: make deploy NAMESPACE="layotto"
endef
export USAGE_OPTIONS

Expand Down
6 changes: 6 additions & 0 deletions make/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ endif
ifeq ($(origin SUPERVISOR_DIR),undefined)
SUPERVISOR_DIR := $(ROOT_DIR)/etc/supervisor
endif
ifeq ($(origin DEPLOY_DIR),undefined)
DEPLOY_DIR := $(ROOT_DIR)/deploy
endif
ifeq ($(origin K8S_DIR),undefined)
K8S_DIR := $(DEPLOY_DIR)/k8s
endif

# set the version number. you should not need to do this
# for the majority of scenarios.
Expand Down
33 changes: 33 additions & 0 deletions make/deploy.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2021 Layotto Authors
# Licensed 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.

# This file contains commands to deploy/undeploy layotto into Kubernetes
# Default namespace is `default`

NAMESPACE := default

.PHONY: deploy.k8s
deploy.k8s: deploy.k8s.standalone

.PHONY: deploy.k8s.standalone
deploy.k8s.standalone:
@echo "===========> Deploy Layotto to Kubernetes in namespace ${NAMESPACE} in standalone mode"
@kubectl apply -f $(K8S_DIR)/standalone/default_quickstart.yaml -n ${NAMESPACE}

.PHONY: undeploy.k8s
undeploy.k8s: undeploy.k8s.standalone

.PHONY: undeploy.k8s.standalone
undeploy.k8s.standalone:
@echo "===========> Clean Layotto to Kubernetes in namespace ${NAMESPACE} in standalone mode"
@kubectl delete -f $(K8S_DIR)/standalone/default_quickstart.yaml -n ${NAMESPACE}