Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] MCO-1457: Reintroduce MCS CA rotation #4735

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions cmd/machine-config-controller/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
features "github.com/openshift/api/features"
"github.com/openshift/machine-config-operator/cmd/common"
"github.com/openshift/machine-config-operator/internal/clients"
certrotationcontroller "github.com/openshift/machine-config-operator/pkg/controller/certrotation"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
containerruntimeconfig "github.com/openshift/machine-config-operator/pkg/controller/container-runtime-config"
"github.com/openshift/machine-config-operator/pkg/controller/drain"
Expand Down Expand Up @@ -83,6 +84,18 @@ func runStartCmd(_ *cobra.Command, _ []string) {
ctrlctx.FeatureGateAccess,
)

certrotationcontroller, err := certrotationcontroller.New(
ctrlctx.ClientBuilder.KubeClientOrDie("cert-rotation-controller"),
ctrlctx.ClientBuilder.ConfigClientOrDie("cert-rotation-controller"),
ctrlctx.ClientBuilder.MachineClientOrDie("cert-rotation-controller"),
ctrlctx.KubeMAOSharedInformer.Core().V1().Secrets(),
ctrlctx.KubeNamespacedInformerFactory.Core().V1().Secrets(),
ctrlctx.KubeNamespacedInformerFactory.Core().V1().ConfigMaps(),
)
if err != nil {
klog.Fatalf("unable to start cert rotation controller: %v", err)
}

// Start the shared factory informers that you need to use in your controller
ctrlctx.InformerFactory.Start(ctrlctx.Stop)
ctrlctx.KubeInformerFactory.Start(ctrlctx.Stop)
Expand Down Expand Up @@ -150,6 +163,7 @@ func runStartCmd(_ *cobra.Command, _ []string) {
go c.Run(2, ctrlctx.Stop)
}
go draincontroller.Run(5, ctrlctx.Stop)
go certrotationcontroller.Run(ctx, 1)

// wait here in this function until the context gets cancelled (which tells us when we are being shut down)
<-ctx.Done()
Expand Down
2 changes: 1 addition & 1 deletion manifests/machineconfigcontroller/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ rules:
resources: ["daemonsets"]
verbs: ["get"]
- apiGroups: ["machine.openshift.io"]
resources: ["machinesets"]
resources: ["machinesets","machines"]
verbs: ["get", "list", "watch", "patch"]
- apiGroups: ["operator.openshift.io"]
resources: ["machineconfigurations/status"]
Expand Down
2 changes: 2 additions & 0 deletions manifests/userdata_secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Secret
metadata:
name: {{.Role}}-user-data-managed
namespace: openshift-machine-api
labels:
"machineconfiguration.openshift.io/managed-ca-bundle-derived-from-configmap": ""
type: Opaque
data:
disableTemplating: "dHJ1ZQo="
Expand Down
Loading