Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
EMCO commits for 21.03
Browse files Browse the repository at this point in the history
Combined commits for 21.03
  • Loading branch information
SunHui2980 authored and Ritu Sood committed Mar 31, 2021
1 parent 0748d15 commit 9cc06e8
Show file tree
Hide file tree
Showing 313 changed files with 23,981 additions and 5,001 deletions.
27 changes: 23 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ ifndef EMCODOCKERREPO
$(error EMCODOCKERREPO env variable needs to be set)
endif

ifndef BRANCH
export BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
endif

docker-reg:
@echo "Setting up docker Registry with base image"
export BUILD_BASE_IMAGE_NAME := $(shell cat $(CONFIG) | grep 'BUILD_BASE_IMAGE_NAME' | cut -d'=' -f2)
Expand Down Expand Up @@ -61,9 +65,9 @@ compile-container: pre-compile
$(MAKE) -C ./src/tools/emcoctl all
@echo " Done."

compile:
compile: check-env docker-reg
@echo "Building microservices within Docker build container"
@docker run --rm --user `id -u`:`id -g` --env GO111MODULE --env XDG_CACHE_HOME=/tmp/.cache -v `pwd`:/repo ${EMCODOCKERREPO}${BUILD_BASE_IMAGE_NAME}${BUILD_BASE_IMAGE_VERSION} /bin/sh -c "cd /repo; make compile-container"
docker run --rm --user `id -u`:`id -g` --env GO111MODULE --env XDG_CACHE_HOME=/tmp/.cache --env BRANCH=${BRANCH} -v `pwd`:/repo ${EMCODOCKERREPO}${BUILD_BASE_IMAGE_NAME}${BUILD_BASE_IMAGE_VERSION} /bin/sh -c "cd /repo; make compile-container"
@echo " Done."

build: compile
Expand All @@ -88,9 +92,24 @@ build: compile
@docker build --build-arg EMCODOCKERREPO=${EMCODOCKERREPO} --build-arg SERVICE_BASE_IMAGE_NAME=${SERVICE_BASE_IMAGE_NAME} --build-arg SERVICE_BASE_IMAGE_VERSION=${SERVICE_BASE_IMAGE_VERSION} --rm -t emco-monitor -f ./build/docker/Dockerfile.monitor ./bin/monitor
@echo " Done."

deploy: build
deploy: check-env docker-reg build
@echo "Creating helm charts. Pushing microservices to registry & copying docker-compose files if BUILD_CAUSE set to DEV_TEST"
./scripts/deploy_emco.sh
@docker run --env USER=${USER} --env EMCODOCKERREPO=${EMCODOCKERREPO} --env BUILD_CAUSE=${BUILD_CAUSE} --env BRANCH=${BRANCH} --rm --user `id -u`:`id -g` --env GO111MODULE --env XDG_CACHE_HOME=/tmp/.cache -v `pwd`:/repo ${EMCODOCKERREPO}${BUILD_BASE_IMAGE_NAME}${BUILD_BASE_IMAGE_VERSION} /bin/sh -c "cd /repo/scripts ; sh deploy_emco_openness.sh"
./scripts/push_to_registry.sh
@echo " Done."

test:
@echo "Running tests"
$(MAKE) -C ./src/clm test
$(MAKE) -C ./src/dcm test
$(MAKE) -C ./src/dtc test
$(MAKE) -C ./src/genericactioncontroller test
$(MAKE) -C ./src/monitor test
$(MAKE) -C ./src/ncm test
$(MAKE) -C ./src/orchestrator test
$(MAKE) -C ./src/ovnaction test
$(MAKE) -C ./src/rsync test
$(MAKE) -C ./src/tools/emcoctl test
@echo " Done."

tidy:
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export HTTPS_PROXY=${https_proxy}
### Update the base container images, if needed

The external dependencies for EMCO are captured partly in the environment
variables above and partly in a configuration file `config/config.txt`.
variables above and partly in a configuration file `config/config.txt`.

The configuration file specifies two important parameters:
* `BUILD_BASE_IMAGE`: The name and version of the base image used for
Expand Down Expand Up @@ -79,16 +79,16 @@ use them to deploy your workload in a set of remote Kubernetes clusters).

This is done in two stages:

* Build the EMCO components:
* Build the EMCO components:
```make all```
This spawns a build container that generates the needed EMCO binaries and
container images.
* Deploy EMCO components locally:
* Deploy EMCO components locally:
```docker-compose up```
using `deployments/docker/docker-compose.yml`. This spawns a set of
containers, each running one EMCO component.

See [this tutorial](docs/user/Tutorial_Local_Install.md) for further details.
See [this tutorial](docs/user/Tutorial_Local_Install.md) for further details.

### Deploy EMCO in a Kubernetes cluster
Alternatively, you can build EMCO locally and deploy EMCO components in a
Expand All @@ -101,9 +101,12 @@ Do the following steps:
```export BUILD_CAUSE=DEV_TEST```
This triggers the following steps to push the locally generated EMCO images
to the `EMCODOCKERREPO` container registry with appropriate tags.
* BUILD_CAUSE can be set to RELEASE during releases and that will push the EMCO service images to container registry
```export BUILD_CAUSE=RELEASE```
```export EMCOSRV_RELEASE_TAG=openness-<release number>tag```
* Set up the Helm charts: Be sure to reference those image names and tags in
your Helm charts.
* Build and deploy EMCO:
* Build and deploy EMCO:
```make deploy```

See [this tutorial](docs/user/Tutorial_Helm.md) for further details.
See [this tutorial](docs/user/Tutorial_Helm.md) for further details.
47 changes: 43 additions & 4 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
```
SPDX-License-Identifier: Apache-2.0
Copyright (c) 2019-2020 Intel Corporation
Copyright (c) 2019-2021 Intel Corporation
```
# Release Notes
This document provides high level features, issues and limitation for the Edge Multi-Cluster Orchestration (EMCO) project.
This document provides high level features, fixes, and known issues and limitations for the Edge Multi-Cluster Orchestration (EMCO) project.

# Release History

1. EMCO - 21.03
1. EMCO - 20.12

# Features for Release
1. <b>EMCO - 20.12 </b>

1. **EMCO - 21.03**
- Support for Helm v3 charts in composite applications.
- Service Discovery for Deployment Intent Groups. See [Service Discovery Design](docs/developer/service-discovery-design.md).
- `Put` support added to the `emcoctl` tool.
- Simple EMCO deployment Helm charts have been replaced with fuller function Helm charts with sub-charts per EMCO microservice.
- The Cluster Manager ( `clm` ) has been extended to support the invocation of registered plugin controllers when clusters are created or deleted.
- Ability for `rsync` microservice to read (get) Kubernetes resources has been added.
- Additional query parameters added to the Deployment Intent Group status query to allow for querying the list of apps, the clusters by app and resources by app. See the status query section of [Resource Lifecycle](docs/user/Resource_Lifecycle.md).


1. **EMCO - 20.12**
- This is the first release of the Edge Multi-Cluster Orchestration (EMCO) project. EMCO supports the automated deployment of geo-distributed applications to multiple clusters via an intent driven API.
- EMCO is composed of a number of central microservices:
- Cluster Manager (clm) : onboard clusters into EMCO
Expand All @@ -26,7 +40,27 @@ This document provides high level features, issues and limitation for the Edge M
- EMCO provides a CLI tool (emcoctl) which may be used to interact with the EMCO REST APIs.
- Authorization and Authentication may be provided for EMCO by utilizing Istio. See [Emco Integrity Access Management](docs/user/Emco_Integrity_Access_Management.md) for more details.

# Fixes for Release

1. **EMCO - 21.03**

- Emcoctl get with token has been fixed.
- Fixes in many microservices to align the data, REST API return codes with the EMCO OpenAPI documentation.
- REST PUT support added for many of the EMCO APIs.
- Additional unit test coverage in many packages has been added.
- Format of the cluster network intent status query response has been simplified to remove inapplicable and redundant `apps` and `clusters` lists.

# Known Issues and Limitations

- **EMCO 21.03**
- If the `monitor` pod is restarted on an edge cluster, the `rsync` connection will fail because it continues to listen on the previous (now removed) connection.
- Username / password authentication is enabled by default for EMCO mongo and etcd services. If persistence is also enabled, then the same passwords should be used across install cycles.
Installation via the `emco-openness-helm-install.sh` script disables persistence by default. Installation using the default Helm charts and values ( `deployments/helm/emcoOpenNESS` ) has persistence enabled by default.
- Refer to [Helm Tutorial](docs/user/Tutorial_Helm.md) and the [Helm Chart README](deployments/helm/emcoOpenNESS/README.md) for more information.
- REST PUT (update) is not yet supported for `Cluster` resources and `Deployment Intent Group` resources or sub-resources (i.e. intents) managed by the `orchestrator` microservice.
- A REST GET of a composite application app or app profile without specifying an appropriate Accept header causes the `orchestrator` microservice to panic.
- REST GETs of various intent resources of the Traffic Controller microservice `dtc` return incorrect HTTP return codes (something other than 404) when the parent resources in the URI do not exist.

- **EMCO 20.12**
- EMCO provides a simple Helm chart to deploy EMCO microservices under `deployments/helm/emcoCI`. This Helm chart supports limited scoped user authentication to the EMCO Mongo and etcd databases. The comprehensive Helm charts under `deployments/helm/emcoOpenNESS` are still a work in progress and will include the authentication and full integration with EMCO microservices in a future release.
- Many of the EMCO microservice REST APIs do not support the PUT API for providing modifications to resources after initial creation.
Expand All @@ -38,4 +72,9 @@ This document provides high level features, issues and limitation for the Edge M
- Emcoctl get with token doesn't work. That is because of a bug in the code. Solution to the issue is to remove line 25 from the EMCO/src/emcoctl/cmd/get.go and rebuild emcoctl code.

# Software Compatibility
EMCO has been tested with Kubernetes v1.18.9 and v1.19.

- **EMCO 21.03**
- EMCO has been tested with Kubernetes v1.16.8, v1.18.9, v1.19 and v1.20.0

- **EMCO 20.12**
- EMCO has been tested with Kubernetes v1.18.9 and v1.19.
8 changes: 7 additions & 1 deletion build/docker/Dockerfile.build-base
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ ENV HTTPS_PROXY=${HTTPS_PROXY}

# Install some run-time build tools in the container.
RUN apk update \
&& apk add --no-cache make
&& apk add --no-cache make
RUN apk add curl
RUN apk add --no-cache ca-certificates git
ARG HELM_VERSION="v3.5.2"
RUN curl -fssL -o helm-${HELM_VERSION}-linux-amd64.tar.gz https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz
RUN tar -zxvf helm-${HELM_VERSION}-linux-amd64.tar.gz
RUN mv linux-amd64/helm /usr/local/bin/helm
2 changes: 1 addition & 1 deletion config/config.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BUILD_BASE_IMAGE_NAME=emco-service-build-base
BUILD_BASE_IMAGE_VERSION=:1.1
BUILD_BASE_IMAGE_VERSION=:1.2
SERVICE_BASE_IMAGE_NAME=alpine
SERVICE_BASE_IMAGE_VERSION=:3.12
2 changes: 1 addition & 1 deletion deployments/helm/emco-helm-install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2020 Intel Corporation
#-------- DO NOT EDIT THIS FILE ---------#
#!/bin/sh
usage() {
echo "USAGE:" $0 "<optional: -s parameter=value> <optional: -k <path to kubeconfig file>> [install | uninstall]"
echo "NOTES: multiple instances of <-s parameter=value> may be provided"
Expand Down
120 changes: 120 additions & 0 deletions deployments/helm/emco-openness-helm-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/bin/sh
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2021 Intel Corporation
#-------- DO NOT EDIT THIS FILE ---------#
usage() {
echo "USAGE:" $0 "<optional: -s parameter=value> <optional: -k <path to kubeconfig file>> <optional: -p [enable | disable]> [install | uninstall]"
echo "NOTES: multiple instances of <-s parameter=value> may be provided"
echo "NOTES: -p [enable | disable] enable or disable mongo and etcd persistance, default is disable"
}

EMCO_DB_HELM_FILE="emco-db-0.1.0.tgz"
EMCO_SERVICES_HELM_FILE="emco-services-0.1.0.tgz"
EMCO_TOOLS_HELM_FILE="emco-tools-0.1.0.tgz"

# Default is to override etcd and mongo persistence to be disabled
PERSISTENCE="--set etcd.persistence.enabled=false --set mongo.persistence.enabled=false"

cleanup() {
echo "Uninstalling emco"
helm ${KUBCFG} uninstall --namespace=emco emco-db
helm ${KUBCFG} uninstall --namespace=emco emco-services
helm ${KUBCFG} uninstall --namespace=emco emco-tools

echo "Deleting namespace emco"
kubectl ${KUBCFG} delete ns emco
}

# convert databause authentication parameters in old format to new format
globalize_dbauth_values() {
HELMSETVALUES=`echo ${HELMSETVALUES} | sed -e '\
s/--set enableDbAuth=true/--set global.disableDbAuth=false/;\
s/--set enableDbAuth=false/--set global.disableDbAuth=true/;\
s/--set db.rootPassword/--set global.db.rootPassword/;\
s/--set db.emcoPassword/--set global.db.emcoPassword/;\
s/--set contextdb.rootPassword/--set global.contextdb.rootPassword/;\
s/--set contextdb.emcoPassword/--set global.contextdb.emcoPassword/;'`
}

install() {
echo "Creating namespace emco"
kubectl ${KUBCFG} create ns emco
echo "Installing EMCO DB. Please wait..."
helm ${KUBCFG} install --namespace=emco -f helm_value_overrides.yaml ${HELMSETVALUES} ${PERSISTENCE} --wait emco-db ${EMCO_DB_HELM_FILE}
if [ "$?" -ne "0" ]; then
cleanup
exit 1
fi
echo "Done"
echo "Installing EMCO Services. Please wait..."
helm ${KUBCFG} install --namespace=emco -f helm_value_overrides.yaml ${HELMSETVALUES} --wait emco-services ${EMCO_SERVICES_HELM_FILE}
if [ "$?" -ne "0" ]; then
cleanup
exit 1
fi
echo "Done"
echo "Installing EMCO Tools. Please wait..."
helm ${KUBCFG} install --namespace=emco -f helm_value_overrides.yaml ${HELMSETVALUES} --wait emco-tools ${EMCO_TOOLS_HELM_FILE}
if [ "$?" -ne "0" ]; then
cleanup
exit 1
fi
echo "Done"
}

uninstall() {
echo "Removing EMCO..."
cleanup
echo "Done"
}

KUBCFG=""
HELMSETVALUES=""
while getopts "hs:k:p:" opt; do
case $opt in
s)
HELMSETVALUES=${HELMSETVALUES}" --set $OPTARG"
;;
k)
KUBCFG="--kubeconfig="$OPTARG
;;
h)
usage
exit 0
;;
p)
if [ "$OPTARG" = "enable" ]; then
PERSISTENCE="--set etcd.persistence.enabled=true --set mongo.persistence.enabled=true"
elif [ "$OPTARG" = "disable" ]; then
PERSISTENCE="--set etcd.persistence.enabled=false --set mongo.persistence.enabled=false"
else
echo "Invalid persistence option: -p $OPTARG" >&2
usage
exit 1
fi
;;
\?)
echo "Invalid option: -$OPTARG" >&2
usage
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
usage
exit 1
;;
esac
done

shift $((OPTIND -1))

if [ "$1" = "install" ]; then
globalize_dbauth_values
install
elif [ "$1" = "uninstall" ]; then
uninstall
else
echo "Not a valid command: "$2
exit 2
fi
exit 0
Loading

0 comments on commit 9cc06e8

Please sign in to comment.