forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ingress.go
34 lines (28 loc) · 1019 Bytes
/
ingress.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
package controller
import (
coreclient "k8s.io/client-go/kubernetes/typed/core/v1"
routeclient "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1"
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy"
"github.com/openshift/origin/pkg/route/controller/ingress"
)
func RunIngressToRouteController(ctx *ControllerContext) (bool, error) {
clientConfig := ctx.ClientBuilder.ConfigOrDie(bootstrappolicy.InfraIngressToRouteControllerServiceAccountName)
coreClient, err := coreclient.NewForConfig(clientConfig)
if err != nil {
return false, err
}
routeClient, err := routeclient.NewForConfig(clientConfig)
if err != nil {
return false, err
}
controller := ingress.NewController(
coreClient,
routeClient,
ctx.KubernetesInformers.Extensions().V1beta1().Ingresses(),
ctx.KubernetesInformers.Core().V1().Secrets(),
ctx.KubernetesInformers.Core().V1().Services(),
ctx.InternalRouteInformers.Route().V1().Routes(),
)
go controller.Run(5, ctx.Stop)
return true, nil
}