Skip to content

Commit f933e31

Browse files
committed
name all the runone functions
1 parent 9aa89d0 commit f933e31

File tree

4 files changed

+42
-42
lines changed

4 files changed

+42
-42
lines changed

pkg/cmd/mom/apply_configuration_command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
func NewApplyConfigurationCommand(streams genericiooptions.IOStreams) *cobra.Command {
14-
return libraryapplyconfiguration.NewApplyConfigurationCommand(RunApplyConfiguration, streams)
14+
return libraryapplyconfiguration.NewApplyConfigurationCommand(RunApplyConfiguration, RunOutputResources, streams)
1515
}
1616

1717
func RunApplyConfiguration(ctx context.Context, input libraryapplyconfiguration.ApplyConfigurationInput) (libraryapplyconfiguration.AllDesiredMutationsGetter, error) {

pkg/cmd/mom/output_resources_command.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ func NewOutputResourcesCommand(streams genericiooptions.IOStreams) *cobra.Comman
1515
func RunOutputResources(ctx context.Context) (*libraryoutputresources.OutputResources, error) {
1616
return &libraryoutputresources.OutputResources{
1717
ConfigurationResources: libraryoutputresources.ResourceList{
18-
ExactResources: []libraryoutputresources.ExactResource{
18+
ExactResources: []libraryoutputresources.ExactResourceID{
1919
exactResource("config.openshift.io", "ingresses", "", "cluster"),
2020
},
2121
},
2222
ManagementResources: libraryoutputresources.ResourceList{
23-
ExactResources: []libraryoutputresources.ExactResource{
23+
ExactResources: []libraryoutputresources.ExactResourceID{
2424
exactResource("config.openshift.io", "clusteroperators", "", "authentication"),
2525
exactResource("openshift.openshift.io", "authentications", "", "cluster"),
2626
},
2727
},
2828
UserWorkloadResources: libraryoutputresources.ResourceList{
29-
ExactResources: []libraryoutputresources.ExactResource{
29+
ExactResources: []libraryoutputresources.ExactResourceID{
3030
exactResource("", "secrets", "openshift-authentication", "v4-0-config-system-session"),
3131
exactResource("", "secrets", "openshift-authentication", "v4-0-config-system-ocp-branding-template"),
3232
exactResource("", "serviceaccounts", "openshift-authentication", "oauth-openshift"),
@@ -38,15 +38,15 @@ func RunOutputResources(ctx context.Context) (*libraryoutputresources.OutputReso
3838
exactResource("rbac.authorization.k8s.io", "rolebindings", "openshift-config-managed", "system:openshift:oauth-servercert-trust"),
3939
exactResource("rbac.authorization.k8s.io", "roles", "openshift-config-managed", "system:openshift:oauth-servercert-trust"),
4040
},
41-
GeneratedNameResources: []libraryoutputresources.GeneratedNameResource{
41+
GeneratedNameResources: []libraryoutputresources.GeneratedResourceID{
4242
generatedResource("certificates.k8s.io", "certificatesigningrequests", "", "system:openshift:openshift-authenticator-"),
4343
},
4444
},
4545
}, nil
4646
}
4747

48-
func exactResource(group, resource, namespace, name string) libraryoutputresources.ExactResource {
49-
return libraryoutputresources.ExactResource{
48+
func exactResource(group, resource, namespace, name string) libraryoutputresources.ExactResourceID {
49+
return libraryoutputresources.ExactResourceID{
5050
OutputResourceTypeIdentifier: libraryoutputresources.OutputResourceTypeIdentifier{
5151
Group: group,
5252
Resource: resource,
@@ -56,8 +56,8 @@ func exactResource(group, resource, namespace, name string) libraryoutputresourc
5656
}
5757
}
5858

59-
func generatedResource(group, resource, namespace, name string) libraryoutputresources.GeneratedNameResource {
60-
return libraryoutputresources.GeneratedNameResource{
59+
func generatedResource(group, resource, namespace, name string) libraryoutputresources.GeneratedResourceID {
60+
return libraryoutputresources.GeneratedResourceID{
6161
OutputResourceTypeIdentifier: libraryoutputresources.OutputResourceTypeIdentifier{
6262
Group: group,
6363
Resource: resource,

pkg/operator/replacement_starter.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,29 +280,29 @@ func CreateOperatorStarter(ctx context.Context, authOperatorInput *authenticatio
280280
authOperatorInput.eventRecorder,
281281
)
282282
ret.ControllerRunFns = append(ret.ControllerRunFns, libraryapplyconfiguration.AdaptRunFn(resourceSyncer.Run))
283-
ret.ControllerRunOnceFns = append(ret.ControllerRunOnceFns, libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, resourceSyncer.Sync))
283+
ret.ControllerNamedRunOnceFns = append(ret.ControllerNamedRunOnceFns, libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-resourceSyncer", resourceSyncer.Sync))
284284

285285
configOverridesController := unsupportedconfigoverridescontroller.NewUnsupportedConfigOverridesController("openshift-authentication", authOperatorInput.authenticationOperatorClient, authOperatorInput.eventRecorder)
286286
ret.ControllerRunFns = append(ret.ControllerRunFns, libraryapplyconfiguration.AdaptRunFn(configOverridesController.Run))
287-
ret.ControllerRunOnceFns = append(ret.ControllerRunOnceFns, libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, configOverridesController.Sync))
287+
ret.ControllerNamedRunOnceFns = append(ret.ControllerNamedRunOnceFns, libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-configOverridesController", configOverridesController.Sync))
288288

289289
logLevelController := loglevel.NewClusterOperatorLoggingController(authOperatorInput.authenticationOperatorClient, authOperatorInput.eventRecorder)
290290
ret.ControllerRunFns = append(ret.ControllerRunFns, libraryapplyconfiguration.AdaptRunFn(logLevelController.Run))
291-
ret.ControllerRunOnceFns = append(ret.ControllerRunOnceFns, libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, logLevelController.Sync))
291+
ret.ControllerNamedRunOnceFns = append(ret.ControllerNamedRunOnceFns, libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-logLevelController", logLevelController.Sync))
292292

293293
oauthRunOnceFns, oauthRunFns, err := prepareOauthOperator(ctx, authOperatorInput, informerFactories, resourceSyncer, versionRecorder)
294294
if err != nil {
295295
return nil, fmt.Errorf("unable to prepare oauth server: %w", err)
296296
}
297297
ret.ControllerRunFns = append(ret.ControllerRunFns, oauthRunFns...)
298-
ret.ControllerRunOnceFns = append(ret.ControllerRunOnceFns, oauthRunOnceFns...)
298+
ret.ControllerNamedRunOnceFns = append(ret.ControllerNamedRunOnceFns, oauthRunOnceFns...)
299299

300300
oauthAPIServerRunOnceFns, oauthAPIServerRunFns, err := prepareOauthAPIServerOperator(ctx, authOperatorInput, informerFactories, resourceSyncer, versionRecorder)
301301
if err != nil {
302302
return nil, fmt.Errorf("unable to prepare oauth server: %w", err)
303303
}
304304
ret.ControllerRunFns = append(ret.ControllerRunFns, oauthAPIServerRunFns...)
305-
ret.ControllerRunOnceFns = append(ret.ControllerRunOnceFns, oauthAPIServerRunOnceFns...)
305+
ret.ControllerNamedRunOnceFns = append(ret.ControllerNamedRunOnceFns, oauthAPIServerRunOnceFns...)
306306

307307
return ret, nil
308308
}

pkg/operator/starter.go

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func prepareOauthOperator(
9999
informerFactories authenticationOperatorInformerFactories,
100100
resourceSyncController *resourcesynccontroller.ResourceSyncController,
101101
versionRecorder status.VersionGetter,
102-
) ([]libraryapplyconfiguration.RunOnceFunc, []libraryapplyconfiguration.RunFunc, error) {
102+
) ([]libraryapplyconfiguration.NamedRunOnce, []libraryapplyconfiguration.RunFunc, error) {
103103

104104
clusterVersion, err := authOperatorInput.configClient.ConfigV1().ClusterVersions().Get(ctx, "version", metav1.GetOptions{})
105105
if err != nil {
@@ -318,26 +318,26 @@ func prepareOauthOperator(
318318
authOperatorInput.eventRecorder,
319319
)
320320

321-
runOnceFns := []libraryapplyconfiguration.RunOnceFunc{
322-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, configObserver.Sync),
323-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, deploymentController.Sync),
324-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, managementStateController.Sync),
325-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, metadataController.Sync),
326-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, oauthClientsController.Sync),
327-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, payloadConfigController.Sync),
328-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, routerCertsController.Sync),
329-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, serviceCAController.Sync),
330-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, staticResourceController.Sync),
331-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, wellKnownReadyController.Sync),
332-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, authRouteCheckController.Sync),
333-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, authServiceCheckController.Sync),
334-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, authServiceEndpointCheckController.Sync),
335-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, workersAvailableController.Sync),
336-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, proxyConfigController.Sync),
337-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, customRouteController.Sync),
338-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, trustDistributionController.Sync),
339-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, staleConditions.Sync),
340-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, ingressStateController.Sync),
321+
runOnceFns := []libraryapplyconfiguration.NamedRunOnce{
322+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-configObserver", configObserver.Sync),
323+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-deploymentController", deploymentController.Sync),
324+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-managementStateController", managementStateController.Sync),
325+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-metadataController", metadataController.Sync),
326+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-oauthClientsController", oauthClientsController.Sync),
327+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-payloadConfigController", payloadConfigController.Sync),
328+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-routerCertsController", routerCertsController.Sync),
329+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-serviceCAController", serviceCAController.Sync),
330+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-staticResourceController", staticResourceController.Sync),
331+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-wellKnownReadyController", wellKnownReadyController.Sync),
332+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-authRouteCheckController", authRouteCheckController.Sync),
333+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-authServiceCheckController", authServiceCheckController.Sync),
334+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-authServiceEndpointCheckController", authServiceEndpointCheckController.Sync),
335+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-workersAvailableController", workersAvailableController.Sync),
336+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-proxyConfigController", proxyConfigController.Sync),
337+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-customRouteController", customRouteController.Sync),
338+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-trustDistributionController", trustDistributionController.Sync),
339+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-staleConditions", staleConditions.Sync),
340+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-ingressStateController", ingressStateController.Sync),
341341
}
342342

343343
runFns := []libraryapplyconfiguration.RunFunc{
@@ -370,7 +370,7 @@ func prepareOauthOperator(
370370
informerFactories.operatorConfigInformer,
371371
authOperatorInput.eventRecorder,
372372
)
373-
runOnceFns = append(runOnceFns, libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, terminationController.Sync))
373+
runOnceFns = append(runOnceFns, libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-terminationController", terminationController.Sync))
374374
runFns = append(runFns, libraryapplyconfiguration.AdaptRunFn(terminationController.Run))
375375
}
376376

@@ -383,7 +383,7 @@ func prepareOauthAPIServerOperator(
383383
informerFactories authenticationOperatorInformerFactories,
384384
resourceSyncController *resourcesynccontroller.ResourceSyncController,
385385
versionRecorder status.VersionGetter,
386-
) ([]libraryapplyconfiguration.RunOnceFunc, []libraryapplyconfiguration.RunFunc, error) {
386+
) ([]libraryapplyconfiguration.NamedRunOnce, []libraryapplyconfiguration.RunFunc, error) {
387387
eventRecorder := authOperatorInput.eventRecorder.ForComponent("oauth-apiserver")
388388

389389
// add syncing for etcd certs for oauthapi-server
@@ -651,11 +651,11 @@ func prepareOauthAPIServerOperator(
651651
eventRecorder,
652652
)
653653

654-
runOnceFns := []libraryapplyconfiguration.RunOnceFunc{
655-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, configObserver.Sync),
656-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, authenticatorCertRequester.Sync),
657-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, webhookAuthController.Sync),
658-
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, webhookCertsApprover.Sync),
654+
runOnceFns := []libraryapplyconfiguration.NamedRunOnce{
655+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-other-configObserver", configObserver.Sync),
656+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-authenticatorCertRequester", authenticatorCertRequester.Sync),
657+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-webhookAuthController", webhookAuthController.Sync),
658+
libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, "TODO-webhookCertsApprover", webhookCertsApprover.Sync),
659659
// TODO missing :(
660660
//libraryapplyconfiguration.AdaptSyncFn(authOperatorInput.eventRecorder, apiServerControllers.Sync),
661661
}

0 commit comments

Comments
 (0)