Skip to content
This repository was archived by the owner on Nov 16, 2020. It is now read-only.

Commit 0b2f053

Browse files
authored
Minimal dispatch server based on knative (#617)
Can simply build and execute functions * remove separate services/managers, go to a single dispatch server. - may still keep identity manager * remove all obsolete charts * remove old function manager (non-knative code)
1 parent 8f0e77f commit 0b2f053

File tree

362 files changed

+3266
-22531
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

362 files changed

+3266
-22531
lines changed

Gopkg.lock

+35-448
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

-9
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ ignored = [
3434
non-go = true
3535
unused-packages = true
3636

37-
[[prune.project]]
38-
name = "k8s.io/code-generator"
39-
unused-packages = false
40-
non-go = false
41-
4237
[[prune.project]]
4338
name = "github.com/knative/serving"
4439
unused-packages = false
@@ -114,7 +109,3 @@ ignored = [
114109
[[constraint]]
115110
name = "github.com/opentracing/opentracing-go"
116111
version = "1.0.2"
117-
118-
[[constraint]]
119-
name = "github.com/kubeless/kubeless"
120-
version = "1.0.0-alpha.2"

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ $(SERVICES):
135135
.PHONY: generate
136136
generate: ## run go generate
137137
scripts/generate-models.sh swagger/models.json
138+
scripts/generate.sh functions Functions functions.yaml
138139
scripts/generate.sh api-manager APIManager api-manager.yaml
139140
scripts/generate.sh application-manager ApplicationManager application-manager.yaml
140141
scripts/generate.sh event-manager EventManager event-manager.yaml
141-
scripts/generate.sh function-manager FunctionManager function-manager.yaml
142142
scripts/generate.sh identity-manager IdentityManager identity-manager.yaml
143143
scripts/generate.sh image-manager ImageManager image-manager.yaml
144144
scripts/generate.sh secret-store SecretStore secret-store.yaml

README.md

+91-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
![Dispatch](docs/assets/images/logo-large.png "Dispatch Logo")
22

3+
> **NOTE:** This is the knative branch of Dispatch. Full dispatch functionality is still a ways off. The code here
4+
> represents a work in progress. Links to documentation are likely outdated.
5+
36
Dispatch is a framework for deploying and managing serverless style applications. The intent is a framework
47
which enables developers to build applications which are defined by functions which handle business logic and services
58
which provide all other functionality:
@@ -21,32 +24,96 @@ Checkout the detailed [documentation](https://vmware.github.io/dispatch) includi
2124

2225
The diagram below illustrates the different components which make up the Dispatch project:
2326

24-
![initial dispatch architecture diagram](docs/_specs/dispatch-v1-architecture.png "Initial Architecture")
27+
![initial dispatch architecture diagram](docs/_specs/dispatch-v2-architecture.png "Initial Architecture")
2528

2629
## Installation
2730

28-
Installing Dispatch is easy once you have a compatible Kubernetes installation. For instance, to deploy on minikube:
29-
30-
1. Fetch the IP address of minikube as this will be used the host for dispatch services.
31-
```
32-
export DISPATCH_HOST=$(minikube ip)
33-
```
34-
35-
2. Configure the installation:
36-
```
37-
$ cat << EOF > config.yaml
38-
apiGateway:
39-
host: $DISPATCH_HOST
40-
dispatch:
41-
host: $DISPATCH_HOST
42-
debug: true
43-
skipAuth: true
44-
EOF
45-
```
46-
47-
3. Install Dispatch:
48-
```
49-
$ dispatch install --file config.yaml
50-
```
31+
Installing Dispatch depends on having a Kubernetes cluster with the Knative components installed (Build, Serving and soon Eventing). From here build and install dispatch as follows:
32+
33+
1. Set the following environment variables:
34+
```bash
35+
export DOCKER_URL=https://index.docker.io/v1/
36+
export DOCKER_REPOSITORY="username or repository"
37+
export DOCKER_USERNAME="username"
38+
export DOCKER_PASSWORD="password"
39+
export DISPATCH_NAMESPACE="dispatch-server"
40+
export RELEASE_NAME="dispatch-server"
41+
```
42+
43+
2. Build and publish a dispatch image:
44+
```bash
45+
PUSH_IMAGES=1 make images
46+
```
47+
48+
3. The previous command will output a configuration file `values.yaml`:
49+
```yaml
50+
image:
51+
host: username
52+
tag: v0.1.xx
53+
registry:
54+
insecure: false
55+
# Use https://index.docker.io/v1/ for dockerhub
56+
url: https://index.docker.io/v1/
57+
repository: repository
58+
username: ********
59+
password: ********
60+
```
61+
62+
4. Deploy via helm chart (if helm is not installed and initialized, do that first):
63+
```bash
64+
helm upgrade -i --debug --name ${RELEASE_NAME} ./dispatch --namespace ${DISPATCH_NAMESPACE}
65+
```
66+
67+
5. Build the CLI (substitute darwin for linux if needed):
68+
```bash
69+
make cli-darwin
70+
```
71+
72+
6. Create the Dispatch config:
73+
```bash
74+
cat << EOF > config.json
75+
{
76+
"current": "${RELEASE_NAME}",
77+
"contexts": {
78+
"${RELEASE_NAME}": {
79+
"host": "$(kubectl -n ${DISPATCH_NAMESPACE} get service ${RELEASE_NAME}-nginx-ingress-controller -o json | jq -r .status.loadBalancer.ingress[].ip)",
80+
"port": 443,
81+
"scheme": "https",
82+
"insecure": true
83+
}
84+
}
85+
}
86+
EOF
87+
```
88+
89+
7. Test out your install:
90+
```bash
91+
./dispatch-darwin --config ./config.json create function --image dispatchframework/python3-base:0.0.13-knative hello ./examples/python3/hello.py
92+
Created function: hello
93+
```
94+
Once status is READY
95+
```bash
96+
./dispatch-darwin --config ./config.json get function
97+
NAME | FUNCTIONIMAGE | STATUS | CREATED DATE
98+
----------------------------------------------------------------
99+
hello | ************* | READY | Thu Sep 13 12:41:07 PDT 2018
100+
```
101+
Exec the function
102+
```
103+
./dispatch-darwin --config ./config.json exec hello <<< '{"name": "user"}' | jq .
104+
{
105+
"context": {
106+
"logs": {
107+
"stdout": [
108+
"messages to stdout show up in logs"
109+
],
110+
"stderr": null
111+
}
112+
},
113+
"payload": {
114+
"myField": "Hello, user from Nowhere"
115+
}
116+
}
117+
```
51118
52119
For a more complete quickstart see the [developer documentation](#documentation)

charts/certificate/.helmignore

-21
This file was deleted.

charts/certificate/Chart.yaml

-5
This file was deleted.

charts/certificate/templates/NOTES.txt

Whitespace-only changes.

charts/certificate/templates/_helpers.tpl

-32
This file was deleted.

charts/certificate/templates/certificate.yaml

-47
This file was deleted.

charts/certificate/templates/clusterissuer.yaml

-51
This file was deleted.

charts/certificate/values.yaml

-24
This file was deleted.

charts/dispatch/charts/api-manager/.helmignore

-21
This file was deleted.

charts/dispatch/charts/api-manager/Chart.yaml

-4
This file was deleted.

charts/dispatch/charts/api-manager/templates/NOTES.txt

-17
This file was deleted.

0 commit comments

Comments
 (0)