Skip to content

Commit

Permalink
Import project
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof Slonka committed Sep 17, 2019
1 parent c0a584e commit b74ba3c
Show file tree
Hide file tree
Showing 144 changed files with 9,232 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.kt]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Intellij Idea project files
.idea
*.iml
*.ipr
*.iws

# gradle config
.gradle

# project binaries
build
out
classes

# sonar
sonar-project.properties
.sonar

# mac os x
.DS_Store

# netbeans
.nb-gradle

/config
!/config/detekt/
!/config/detekt/*

deployment.yml
127 changes: 127 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'pl.allegro.tech.build', name: 'axion-release-plugin', version: '1.10.2'
}
}

plugins {
id 'pl.allegro.tech.build.axion-release' version '1.10.2'
id 'org.jetbrains.kotlin.jvm' version '1.3.0'
id 'org.jetbrains.kotlin.plugin.spring' version '1.3.0'
id 'org.jetbrains.kotlin.plugin.allopen' version '1.3.0'
id "org.jlleitschuh.gradle.ktlint" version "6.3.1"
id "org.jlleitschuh.gradle.ktlint-idea" version "6.3.1"
id "io.gitlab.arturbosch.detekt" version "1.0.0-RC11"
}

scmVersion {
tag {
prefix = project.rootProject.name
}
versionCreator 'versionWithBranch'
}

allprojects {

project.group = 'pl.allegro.tech.servicemesh'
project.version = scmVersion.version

repositories {
jcenter()
mavenCentral()
}

apply plugin: 'kotlin'
apply plugin: 'pl.allegro.tech.build.axion-release'
apply plugin: 'kotlin-spring'

project.ext.versions = [
kotlin : '1.3.0',
java_controlplane : '0.1.16',
spring_boot : '2.1.5.RELEASE',
grpc : '1.21.0',
jaxb : '2.3.0',
javaxactivation : '1.1.1',
micrometer : '1.1.2',
dropwizard : '4.0.5',
ecwid_consul : '1.4.1',
awaitility : '3.1.3',
embedded_consul : '2.0.0',
junit : '5.3.2',
assertj : '3.11.1',
jackson : '2.9.0',
toxiproxy : '2.1.3',
testcontainers : '1.10.6',
reactor : '3.2.5.RELEASE',
consul_recipes : '0.8.3',
mockito : '2.23.0',
cglib : '3.2.9',
logback : '1.2.3',
slf4j : '1.7.25'
]
}

subprojects {

apply plugin: 'maven-publish'
apply plugin: 'pl.allegro.tech.build.axion-release'
apply plugin: 'org.jlleitschuh.gradle.ktlint'
apply plugin: 'io.gitlab.arturbosch.detekt'

sourceCompatibility = 1.8
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}

publishing {
publications {
maven(MavenPublication) {
from project.components.java
}
}
}

configurations {
compile.exclude group: 'commons-logging', module: 'commons-logging'
compile.exclude group: 'org.slf4j', module: 'slf4j-log4j12'
compile.exclude group: 'org.slf4j', module: 'slf4j-jcl'
compile.exclude group: 'log4j', module: 'log4j'
}

compileKotlin {
kotlinOptions {
jvmTarget = '1.8'
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit
testCompile group: 'org.assertj', name: 'assertj-core', version: versions.assertj
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: versions.junit
}

detekt {
toolVersion = "1.0.0-RC11"
input = files("src/main/kotlin", "src/test/kotlin")
filters = ".*/resources/.*,.*/build/.*"
config = files("$rootDir/config/detekt/default-detekt-config.yml", "$rootDir/config/detekt/detekt-config.yml")
}
}

wrapper {
gradleVersion = '5.2.1'
}
56 changes: 56 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Architecture

## High level

This is high level view of Service Mesh system with Envoy Control

![high level architecture](assets/images/high_level_architecture.png)

In each data center, Envoy Control polls the services location from a discovery service system. Then, the state
is propagated to Envoy instances running alongside service instances.

When _service-a_ wants to communicate with _service-b_ it sends a request to it, but the request is intercepted
by Envoy, which will redirect the request to proper instance. Envoy can also add tracing headers, add encryption,
circuit breaking and much more.

## Envoy control

Envoy Control is responsible for feeding Envoys with configuration of
[CDS](https://www.envoyproxy.io/docs/envoy/latest/configuration/upstream/cluster_manager/cds),
[EDS](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/service_discovery#arch-overview-service-discovery-types-eds),
and [RDS](https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/rds.html) data based on custom metadata.
Right now CDS and EDS data comes from Consul service discovery,
but there is nothing special about our integration with Consul and users can integrate as many sources as they want.

![envoy control modules drawing](assets/images/envoy-control-modules-drawing.png)

## Sources

Source is a stream of `cluster` and `endpoints` states.

There can be many sources, all they have to do is:

* implement `LocalServiceChanges`
* be exposed as a bean - if you're using Envoy Control Runner then all of them will be combined in `GlobalServiceChanges`,
if not - you have to combine them yourself

### Consul
Implements a stream of service instance changes coming from Consul discovery service.

## Modules

### Envoy Control
The core module that provides integration with Envoy and API to integrate Discovery Service system.

### Envoy Control Runner
Example of the code that builds Control Plane and runs it. It uses [Spring Framework](https://spring.io/) to connect
elements and serve HTTP endpoint and HTTP client for [Cross DC Synchronization](features/multi_dc_support.md) feature.

#### Why Spring?
We've chosen Spring for Envoy Control Runner because it provides an easy way to create HTTP server and client.
On top of that, it also provides Dependency Injection and property management.
You can easily replace it with your framework of choice - Envoy Control module as well as source modules are framework-agnostic.

### Extensibility
If you want to extend Envoy Control you can either depend on Envoy Control module and create your own Runner or you can
depend on the Envoy Control Runner itself and provide only minimal modifications.
29 changes: 29 additions & 0 deletions docs/assets/extra.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// source: https://github.com/squidfunk/mkdocs-material/issues/767
document.addEventListener("DOMContentLoaded", function() {
load_navpane();
});

function load_navpane() {
var width = window.innerWidth;
if (width <= 1200) {
return;
}

var nav = document.getElementsByClassName("md-nav");
for(var i = 0; i < nav.length; i++) {
if (typeof nav.item(i).style === "undefined") {
continue;
}

if (nav.item(i).getAttribute("data-md-level") && nav.item(i).getAttribute("data-md-component")) {
nav.item(i).style.display = 'block';
nav.item(i).style.overflow = 'visible';
}
}

var nav = document.getElementsByClassName("md-nav__toggle");
for(var i = 0; i < nav.length; i++) {
nav.item(i).checked = true;
}
}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/high_level_architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b74ba3c

Please sign in to comment.