-
Notifications
You must be signed in to change notification settings - Fork 157
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
Bug 1820255: Fix race for localhost-recovery-client-token snapshotting #815
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ import ( | |
"github.com/openshift/library-go/pkg/controller/controllercmd" | ||
"github.com/openshift/library-go/pkg/operator/certrotation" | ||
"github.com/openshift/library-go/pkg/operator/encryption" | ||
"github.com/openshift/library-go/pkg/operator/encryption/controllers" | ||
"github.com/openshift/library-go/pkg/operator/encryption/controllers/migrators" | ||
encryptiondeployer "github.com/openshift/library-go/pkg/operator/encryption/deployer" | ||
"github.com/openshift/library-go/pkg/operator/genericoperatorclient" | ||
|
@@ -41,6 +42,18 @@ import ( | |
"k8s.io/client-go/kubernetes" | ||
) | ||
|
||
type encryptionProvider []schema.GroupResource | ||
|
||
var _ controllers.Provider = encryptionProvider{} | ||
|
||
func (p encryptionProvider) EncryptedGRs() []schema.GroupResource { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @p0lyn0mial I missed this in library-go, but I think we should try to keep interfaces more verbose rather than cryptic, iow. this should've been There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, thx :) |
||
return p | ||
} | ||
|
||
func (p encryptionProvider) ShouldRunEncryptionControllers() (bool, error) { | ||
return true, nil | ||
} | ||
|
||
func RunOperator(ctx context.Context, controllerContext *controllercmd.ControllerContext) error { | ||
// This kube client use protobuf, do not use it for CR | ||
kubeClient, err := kubernetes.NewForConfig(controllerContext.ProtoKubeConfig) | ||
|
@@ -178,8 +191,12 @@ func RunOperator(ctx context.Context, controllerContext *controllercmd.Controlle | |
migrationInformer := migrationv1alpha1informer.NewSharedInformerFactory(migrationClient, time.Minute*30) | ||
migrator := migrators.NewKubeStorageVersionMigrator(migrationClient, migrationInformer.Migration().V1alpha1(), kubeClient.Discovery()) | ||
|
||
encryptionControllers, err := encryption.NewControllers( | ||
encryptionControllers := encryption.NewControllers( | ||
operatorclient.TargetNamespace, | ||
encryptionProvider{ | ||
schema.GroupResource{Group: "", Resource: "secrets"}, | ||
schema.GroupResource{Group: "", Resource: "configmaps"}, | ||
}, | ||
deployer, | ||
migrator, | ||
operatorClient, | ||
|
@@ -188,12 +205,7 @@ func RunOperator(ctx context.Context, controllerContext *controllercmd.Controlle | |
kubeInformersForNamespaces, | ||
kubeClient.CoreV1(), | ||
controllerContext.EventRecorder, | ||
schema.GroupResource{Group: "", Resource: "secrets"}, | ||
schema.GroupResource{Group: "", Resource: "configmaps"}, | ||
) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
featureUpgradeableController := featureupgradablecontroller.NewFeatureUpgradeableController( | ||
operatorClient, | ||
|
@@ -249,7 +261,7 @@ func RunOperator(ctx context.Context, controllerContext *controllercmd.Controlle | |
go configObserver.Run(ctx, 1) | ||
go clusterOperatorStatus.Run(ctx, 1) | ||
go certRotationController.Run(ctx, 1) | ||
go encryptionControllers.Run(ctx.Done()) | ||
go encryptionControllers.Run(ctx, 1) | ||
go featureUpgradeableController.Run(ctx, 1) | ||
go certRotationTimeUpgradeableController.Run(ctx, 1) | ||
go terminationObserver.Run(ctx, 1) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@p0lyn0mial I suppose this could have been in library-go next to the interface as
SimpleProvider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thx :)