Repository: kubernetes/kubernetes
File: pkg/controller/replication/replication_controller.go (Go)

Code before:
	replicaset.ReplicaSetController
}

// NewReplicationManager configures a replication manager with the specified event recorder
func NewReplicationManager(ctx context.Context, podInformer coreinformers.PodInformer, rcInformer coreinformers.ReplicationControllerInformer, kubeClient clientset.Interface, burstReplicas int) *ReplicationManager {
	logger := klog.FromContext(ctx)
	eventBroadcaster := record.NewBroadcaster(record.WithContext(ctx))
	return &ReplicationManager{
		*replicaset.NewBaseController(logger, informerAdapter{rcInformer}, podInformer, clientsetAdapter{kubeClient}, burstReplicas,
			v1.SchemeGroupVersion.WithKind("ReplicationController"),
			"replication_controller",
			"replicationmanager",
			podControlAdapter{controller.RealPodControl{
				KubeClient: kubeClient,
				Recorder:   eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "replication-controller"}),
			}},
			eventBroadcaster,
			replicaset.ReplicaSetControllerFeatures{
				// ReplicationController API does not support the .status.terminatingReplicas field. However,
				// ReplicaSets do support this field, which is then propagated to Deployments for higher-level features.
				EnableStatusTerminatingReplicas: false,
			},
			consistencyutil.NewNoopConsistencyStore(),
		),
	}
}


Review comment (suggestion):
I'm on the fence about whether it's worth making the metrics and resource type parameterizable to be able to wire this up for the shimmed replication controller controller ...  maybe just add a TODO comment here that the resource / metric used need to be parameterized before changing this from a Noop

Code after:
	replicaset.ReplicaSetController
}

// NewReplicationManager configures a replication manager with the specified event recorder
func NewReplicationManager(ctx context.Context, podInformer coreinformers.PodInformer, rcInformer coreinformers.ReplicationControllerInformer, kubeClient clientset.Interface, burstReplicas int) *ReplicationManager {
	logger := klog.FromContext(ctx)
	eventBroadcaster := record.NewBroadcaster(record.WithContext(ctx))
	return &ReplicationManager{
		*replicaset.NewBaseController(logger, informerAdapter{rcInformer}, podInformer, clientsetAdapter{kubeClient}, burstReplicas,
			v1.SchemeGroupVersion.WithKind("ReplicationController"),
			"replication_controller",
			"replicationmanager",
			podControlAdapter{controller.RealPodControl{
				KubeClient: kubeClient,
				Recorder:   eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "replication-controller"}),
			}},
			eventBroadcaster,
			replicaset.ReplicaSetControllerFeatures{
				// ReplicationController API does not support the .status.terminatingReplicas field. However,
				// ReplicaSets do support this field, which is then propagated to Deployments for higher-level features.
				EnableStatusTerminatingReplicas: false,
			},
			// TODO: Replication controller does not currently support stale controller consistency.
			// In order to support stale controller consistency, we would need to parameterize the metrics
			// and resource types passed to the consistency store.
			consistencyutil.NewNoopConsistencyStore(),
		),
	}
}