Add builder manager support (#308)

This change orchestrates function builds.

Environments (in v2) define a builder image, just like they do a runtime image. The builder image contains a build script that's invoked with source and deployment paths (as env vars).

The buildermgr watches for environments with build images defined, and creates build deployments and services.

Functions can define source and deployment. Buildermgr watches for functions with source code (and build status == pending) and invokes the environment's builder when appropriate. It captures logs from the build and sets the build status (success/failure) and build lots into the PackageStatus.
This commit is contained in:
Ta-Ching Chen
2017-09-25 07:53:09 -07:00
committed by Soam Vasani
parent a720377f3c
commit e587eca08f
40 changed files with 1827 additions and 176 deletions
+1
View File
@@ -47,6 +47,7 @@ The following table lists the configurable parameters of the Fission chart and t
| `controllerPort` | Fission Controller Service Port | `31313` |
| `routerPort` | Fission Router Service Port | `31314` |
| `functionNamespace` | Namespace for Fission functions | `fission-function` |
| `builderNamespace` | Namespace for Fission environment builders | `fission-builder` |
| `openshift` | RBAC for openshift | `false` |
@@ -81,6 +81,15 @@ metadata:
name: fission-function
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.builderNamespace }}
labels:
name: fission-builder
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
---
apiVersion: v1
kind: ServiceAccount
@@ -153,6 +162,27 @@ roleRef:
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fission-builder
namespace: {{ .Values.builderNamespace }}
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: fission-builder-tpr
subjects:
- kind: ServiceAccount
name: fission-builder
namespace: {{ .Values.builderNamespace }}
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
{{ end }}
---
@@ -240,6 +270,51 @@ spec:
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
- name: RUNTIME_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
serviceAccount: fission-svc
---
apiVersion: v1
kind: Service
metadata:
name: buildermgr
labels:
svc: buildermgr
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8889
selector:
svc: buildermgr
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: buildermgr
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
svc: buildermgr
spec:
containers:
- name: buildermgr
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--builderMgrPort", "8889", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
serviceAccount: fission-svc
---
+4
View File
@@ -34,6 +34,10 @@ natsStreamingPort: 31316
## the release namespace)
functionNamespace: fission-function
## Namespace in which to run fission builders (this is different from
## the release namespace)
builderNamespace: fission-builder
## Set up openshift RBAC rule
openshift: false
@@ -81,6 +81,15 @@ metadata:
name: fission-function
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.builderNamespace }}
labels:
name: fission-builder
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
---
apiVersion: v1
kind: ServiceAccount
@@ -153,6 +162,27 @@ roleRef:
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fission-builder
namespace: {{ .Values.builderNamespace }}
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: fission-builder-tpr
subjects:
- kind: ServiceAccount
name: fission-builder
namespace: {{ .Values.builderNamespace }}
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
{{ end }}
---
@@ -242,6 +272,49 @@ spec:
value: "{{ .Values.pullPolicy }}"
serviceAccount: fission-svc
---
apiVersion: v1
kind: Service
metadata:
name: buildermgr
labels:
svc: buildermgr
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8889
selector:
svc: buildermgr
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: buildermgr
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: 1
template:
metadata:
labels:
svc: buildermgr
spec:
containers:
- name: buildermgr
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.pullPolicy }}
command: ["/fission-bundle"]
args: ["--builderMgrPort", "8889", "--storageSvcUrl", "http://storagesvc.{{ .Release.Namespace }}", "--envbuilder-namespace", "{{ .Values.builderNamespace }}"]
env:
- name: FETCHER_IMAGE
value: "{{ .Values.fetcherImage }}:{{ .Values.fetcherImageTag }}"
- name: FETCHER_IMAGE_PULL_POLICY
value: "{{ .Values.pullPolicy }}"
serviceAccount: fission-svc
---
apiVersion: extensions/v1beta1
kind: Deployment
+4
View File
@@ -31,6 +31,10 @@ routerPort: 31314
## the release namespace)
functionNamespace: fission-function
## Namespace in which to run fission builders (this is different from
## the release namespace)
builderNamespace: fission-builder
## Set up openshift RBAC rule
openshift: false