Skip to content

Commit 6d9caed

Browse files
committed
Revert "OCPBUGS-44832: Revert MCS CA rotation"
This re-applies the work in #4669
1 parent f362e75 commit 6d9caed

File tree

12 files changed

+854
-25
lines changed

12 files changed

+854
-25
lines changed

cmd/machine-config-controller/start.go

+14
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
features "github.com/openshift/api/features"
1111
"github.com/openshift/machine-config-operator/cmd/common"
1212
"github.com/openshift/machine-config-operator/internal/clients"
13+
certrotationcontroller "github.com/openshift/machine-config-operator/pkg/controller/certrotation"
1314
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
1415
containerruntimeconfig "github.com/openshift/machine-config-operator/pkg/controller/container-runtime-config"
1516
"github.com/openshift/machine-config-operator/pkg/controller/drain"
@@ -83,6 +84,18 @@ func runStartCmd(_ *cobra.Command, _ []string) {
8384
ctrlctx.FeatureGateAccess,
8485
)
8586

87+
certrotationcontroller, err := certrotationcontroller.New(
88+
ctrlctx.ClientBuilder.KubeClientOrDie("cert-rotation-controller"),
89+
ctrlctx.ClientBuilder.ConfigClientOrDie("cert-rotation-controller"),
90+
ctrlctx.ClientBuilder.MachineClientOrDie("cert-rotation-controller"),
91+
ctrlctx.KubeMAOSharedInformer.Core().V1().Secrets(),
92+
ctrlctx.KubeNamespacedInformerFactory.Core().V1().Secrets(),
93+
ctrlctx.KubeNamespacedInformerFactory.Core().V1().ConfigMaps(),
94+
)
95+
if err != nil {
96+
klog.Fatalf("unable to start cert rotation controller: %v", err)
97+
}
98+
8699
// Start the shared factory informers that you need to use in your controller
87100
ctrlctx.InformerFactory.Start(ctrlctx.Stop)
88101
ctrlctx.KubeInformerFactory.Start(ctrlctx.Stop)
@@ -150,6 +163,7 @@ func runStartCmd(_ *cobra.Command, _ []string) {
150163
go c.Run(2, ctrlctx.Stop)
151164
}
152165
go draincontroller.Run(5, ctrlctx.Stop)
166+
go certrotationcontroller.Run(ctx, 1)
153167

154168
// wait here in this function until the context gets cancelled (which tells us when we are being shut down)
155169
<-ctx.Done()

manifests/machineconfigcontroller/clusterrole.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ rules:
3737
resources: ["daemonsets"]
3838
verbs: ["get"]
3939
- apiGroups: ["machine.openshift.io"]
40-
resources: ["machinesets"]
40+
resources: ["machinesets","machines"]
4141
verbs: ["get", "list", "watch", "patch"]
4242
- apiGroups: ["operator.openshift.io"]
4343
resources: ["machineconfigurations/status"]

manifests/userdata_secret.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ kind: Secret
33
metadata:
44
name: {{.Role}}-user-data-managed
55
namespace: openshift-machine-api
6+
labels:
7+
"machineconfiguration.openshift.io/managed-ca-bundle-derived-from-configmap": ""
68
type: Opaque
79
data:
810
disableTemplating: "dHJ1ZQo="

0 commit comments

Comments
 (0)