forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
apps.go
55 lines (44 loc) · 1.69 KB
/
apps.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package controller
import (
"k8s.io/client-go/kubernetes"
deployercontroller "github.com/openshift/origin/pkg/apps/controller/deployer"
deployconfigcontroller "github.com/openshift/origin/pkg/apps/controller/deploymentconfig"
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy"
"github.com/openshift/origin/pkg/cmd/util/variable"
)
func RunDeployerController(ctx *ControllerContext) (bool, error) {
clientConfig, err := ctx.ClientBuilder.Config(bootstrappolicy.InfraDeployerControllerServiceAccountName)
if err != nil {
return true, err
}
kubeClient, err := kubernetes.NewForConfig(clientConfig)
if err != nil {
return true, err
}
imageTemplate := variable.NewDefaultImageTemplate()
imageTemplate.Format = ctx.OpenshiftControllerConfig.Deployer.ImageTemplateFormat.Format
imageTemplate.Latest = ctx.OpenshiftControllerConfig.Deployer.ImageTemplateFormat.Latest
go deployercontroller.NewDeployerController(
ctx.KubernetesInformers.Core().V1().ReplicationControllers(),
ctx.KubernetesInformers.Core().V1().Pods(),
kubeClient,
bootstrappolicy.DeployerServiceAccountName,
imageTemplate.ExpandOrDie("deployer"),
nil,
).Run(5, ctx.Stop)
return true, nil
}
func RunDeploymentConfigController(ctx *ControllerContext) (bool, error) {
saName := bootstrappolicy.InfraDeploymentConfigControllerServiceAccountName
kubeClient, err := ctx.ClientBuilder.Client(saName)
if err != nil {
return true, err
}
go deployconfigcontroller.NewDeploymentConfigController(
ctx.AppsInformers.Apps().V1().DeploymentConfigs(),
ctx.KubernetesInformers.Core().V1().ReplicationControllers(),
ctx.ClientBuilder.OpenshiftAppsClientOrDie(saName),
kubeClient,
).Run(5, ctx.Stop)
return true, nil
}