-
Notifications
You must be signed in to change notification settings - Fork 29
/
cert_manager_controller_deployment.go
91 lines (84 loc) · 4.68 KB
/
cert_manager_controller_deployment.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package deployment
import (
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
configinformers "github.com/openshift/client-go/config/informers/externalversions"
"github.com/openshift/library-go/pkg/controller/factory"
"github.com/openshift/library-go/pkg/operator/events"
"github.com/openshift/library-go/pkg/operator/resource/resourceapply"
"github.com/openshift/library-go/pkg/operator/staticresourcecontroller"
"github.com/openshift/library-go/pkg/operator/status"
"github.com/openshift/library-go/pkg/operator/v1helpers"
"github.com/openshift/cert-manager-operator/pkg/operator/assets"
certmanoperatorinformers "github.com/openshift/cert-manager-operator/pkg/operator/informers/externalversions"
)
const (
certManagerControllerStaticResourcesControllerName = operatorName + "-controller-static-resources-"
certManagerControllerDeploymentControllerName = operatorName + "-controller-deployment"
certManagerControllerDeploymentFile = "cert-manager-deployment/controller/cert-manager-deployment.yaml"
)
var (
certManagerControllerAssetFiles = []string{
"cert-manager-deployment/cert-manager-namespace.yaml",
"cert-manager-deployment/cert-manager/cert-manager-controller-approve-cert-manager-io-cr.yaml",
"cert-manager-deployment/cert-manager/cert-manager-controller-approve-cert-manager-io-crb.yaml",
"cert-manager-deployment/controller/cert-manager-controller-certificates-cr.yaml",
"cert-manager-deployment/controller/cert-manager-controller-certificates-crb.yaml",
"cert-manager-deployment/cert-manager/cert-manager-controller-certificatesigningrequests-cr.yaml",
"cert-manager-deployment/cert-manager/cert-manager-controller-certificatesigningrequests-crb.yaml",
"cert-manager-deployment/controller/cert-manager-controller-challenges-cr.yaml",
"cert-manager-deployment/controller/cert-manager-controller-challenges-crb.yaml",
"cert-manager-deployment/controller/cert-manager-controller-clusterissuers-cr.yaml",
"cert-manager-deployment/controller/cert-manager-controller-clusterissuers-crb.yaml",
"cert-manager-deployment/controller/cert-manager-controller-ingress-shim-cr.yaml",
"cert-manager-deployment/controller/cert-manager-controller-ingress-shim-crb.yaml",
"cert-manager-deployment/controller/cert-manager-controller-issuers-cr.yaml",
"cert-manager-deployment/controller/cert-manager-controller-issuers-crb.yaml",
"cert-manager-deployment/controller/cert-manager-controller-orders-cr.yaml",
"cert-manager-deployment/controller/cert-manager-controller-orders-crb.yaml",
"cert-manager-deployment/controller/cert-manager-edit-cr.yaml",
"cert-manager-deployment/controller/cert-manager-leaderelection-rb.yaml",
"cert-manager-deployment/controller/cert-manager-leaderelection-role.yaml",
"cert-manager-deployment/controller/cert-manager-sa.yaml",
"cert-manager-deployment/controller/cert-manager-svc.yaml",
"cert-manager-deployment/controller/cert-manager-view-cr.yaml",
"cert-manager-deployment/cert-manager/cert-manager-controller-approve-cert-manager-io-cr.yaml",
"cert-manager-deployment/cert-manager/cert-manager-controller-approve-cert-manager-io-crb.yaml",
"cert-manager-deployment/cert-manager/cert-manager-controller-certificatesigningrequests-cr.yaml",
"cert-manager-deployment/cert-manager/cert-manager-controller-certificatesigningrequests-crb.yaml",
}
)
func NewCertManagerControllerStaticResourcesController(operatorClient v1helpers.OperatorClient,
kubeClientContainer *resourceapply.ClientHolder,
kubeInformersForNamespaces v1helpers.KubeInformersForNamespaces,
eventsRecorder events.Recorder) factory.Controller {
return staticresourcecontroller.NewStaticResourceController(
certManagerControllerStaticResourcesControllerName,
assets.Asset,
certManagerControllerAssetFiles,
kubeClientContainer,
operatorClient,
eventsRecorder,
).AddKubeInformers(kubeInformersForNamespaces)
}
func NewCertManagerControllerDeploymentController(operatorClient v1helpers.OperatorClientWithFinalizers,
certManagerOperatorInformers certmanoperatorinformers.SharedInformerFactory,
infraInformers configinformers.SharedInformerFactory,
kubeClient kubernetes.Interface,
kubeInformersForTargetNamespace informers.SharedInformerFactory,
eventsRecorder events.Recorder, targetVersion string, versionRecorder status.VersionGetter, trustedCAConfigmapName, cloudCredentialsSecretName string) factory.Controller {
return newGenericDeploymentController(
certManagerControllerDeploymentControllerName,
targetVersion,
certManagerControllerDeploymentFile,
operatorClient,
certManagerOperatorInformers,
infraInformers,
kubeClient,
kubeInformersForTargetNamespace,
eventsRecorder,
versionRecorder,
trustedCAConfigmapName,
cloudCredentialsSecretName,
)
}