Skip to content

Commit 78188af

Browse files
committed
split controller into two pods
1 parent c27d505 commit 78188af

2 files changed

Lines changed: 45 additions & 10 deletions

File tree

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
apiVersion: extensions/v1beta1
22
kind: Deployment
33
metadata:
4-
name: infrabox-controller
4+
name: infrabox-pipeline-controller
55
namespace: {{ template "system_namespace" . }}
66
labels:
7-
app: infrabox-controller
7+
app: infrabox-pipeline-controller
88
spec:
99
replicas: 1
1010
template:
1111
metadata:
1212
labels:
13-
app: infrabox-controller
13+
app: infrabox-pipeline-controller
1414
spec:
1515
terminationGracePeriodSeconds: 0
1616
serviceAccountName: infrabox
@@ -24,7 +24,36 @@ spec:
2424
-
2525
name: WATCH_NAMESPACE
2626
value: {{ template "worker_namespace" . }}
27-
resources:
28-
requests:
29-
memory: "256Mi"
30-
cpu: "200m"
27+
-
28+
name: WATCH_KIND
29+
value: IBPipelineInvocation
30+
---
31+
apiVersion: extensions/v1beta1
32+
kind: Deployment
33+
metadata:
34+
name: infrabox-function-controller
35+
namespace: {{ template "system_namespace" . }}
36+
labels:
37+
app: infrabox-function-controller
38+
spec:
39+
replicas: 1
40+
template:
41+
metadata:
42+
labels:
43+
app: infrabox-function-controller
44+
spec:
45+
terminationGracePeriodSeconds: 0
46+
serviceAccountName: infrabox
47+
{{ include "imagePullSecret" . | indent 8 }}
48+
containers:
49+
-
50+
name: controller
51+
image: {{ include "image_repository" . }}/controller:{{ include "image_tag" . }}
52+
imagePullPolicy: Always
53+
env:
54+
-
55+
name: WATCH_NAMESPACE
56+
value: {{ template "worker_namespace" . }}
57+
-
58+
name: WATCH_KIND
59+
value: IBFunctionInvocation

src/controller/cmd/controller/main.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"context"
55
"runtime"
6+
"os"
67

78
stub "github.com/sap/infrabox/src/controller/pkg/stub"
89
sdk "github.com/operator-framework/operator-sdk/pkg/sdk"
@@ -26,10 +27,15 @@ func main() {
2627
if err != nil {
2728
logrus.Fatalf("Failed to get watch namespace: %v", err)
2829
}
30+
31+
kind = os.Getenv("WATCH_KIND")
32+
33+
if len(kind) == 0 {
34+
logrus.Fatalf("WATCH_KIND not set")
35+
}
36+
2937
resyncPeriod := 5
30-
//sdk.Watch(resource, "Workflow", namespace, resyncPeriod)
31-
sdk.Watch(resource, "IBPipelineInvocation", namespace, resyncPeriod)
32-
sdk.Watch(resource, "IBFunctionInvocation", namespace, resyncPeriod)
38+
sdk.Watch(resource, kind, namespace, resyncPeriod)
3339
sdk.Handle(stub.NewHandler())
3440
sdk.Run(context.TODO())
3541
}

0 commit comments

Comments
 (0)