internal/controller/issuerconfig: Publisher -> KubeConfigInfoPublisher

The new symbol more specifically describes what the controller does.

Signed-off-by: Andrew Keesler <akeesler@vmware.com>
This commit is contained in:
Andrew Keesler 2020-09-23 07:58:01 -04:00
parent a55e9de4fc
commit 3e45bfc97d
No known key found for this signature in database
GPG Key ID: 27CE0444346F9413
4 changed files with 11 additions and 9 deletions

View File

@ -1,5 +1,5 @@
// Copyright 2020 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Package discovery contains controller(s) for reconciling CredentialIssuerConfig's.
// Package issuerconfig contains controller(s) for reconciling CredentialIssuerConfig's.
package issuerconfig

View File

@ -25,7 +25,7 @@ const (
clusterInfoConfigMapKey = "kubeconfig"
)
type publisherController struct {
type kubeConigInfoPublisherController struct {
credentialIssuerConfigNamespaceName string
credentialIssuerConfigResourceName string
serverOverride *string
@ -34,8 +34,10 @@ type publisherController struct {
credentialIssuerConfigInformer configv1alpha1informers.CredentialIssuerConfigInformer
}
// TODO rename this NewKubeConfigInfoPublisherController, along with the private type and the source/test files.
func NewPublisherController(
// NewKubeConfigInfoPublisherController returns a controller that syncs the
// configv1alpha1.CredentialIssuerConfig.Status.KubeConfigInfo field with the cluster-info ConfigMap
// in the kube-public namespace.
func NewKubeConfigInfoPublisherController(
credentialIssuerConfigNamespaceName string,
credentialIssuerConfigResourceName string,
serverOverride *string,
@ -47,7 +49,7 @@ func NewPublisherController(
return controllerlib.New(
controllerlib.Config{
Name: "publisher-controller",
Syncer: &publisherController{
Syncer: &kubeConigInfoPublisherController{
credentialIssuerConfigResourceName: credentialIssuerConfigResourceName,
credentialIssuerConfigNamespaceName: credentialIssuerConfigNamespaceName,
serverOverride: serverOverride,
@ -69,7 +71,7 @@ func NewPublisherController(
)
}
func (c *publisherController) Sync(ctx controllerlib.Context) error {
func (c *kubeConigInfoPublisherController) Sync(ctx controllerlib.Context) error {
configMap, err := c.configMapInformer.
Lister().
ConfigMaps(ClusterInfoNamespace).

View File

@ -43,7 +43,7 @@ func TestInformerFilters(t *testing.T) {
observableWithInformerOption = testutil.NewObservableWithInformerOption()
configMapInformer := kubeinformers.NewSharedInformerFactory(nil, 0).Core().V1().ConfigMaps()
credentialIssuerConfigInformer := pinnipedinformers.NewSharedInformerFactory(nil, 0).Config().V1alpha1().CredentialIssuerConfigs()
_ = NewPublisherController(
_ = NewKubeConfigInfoPublisherController(
installedInNamespace,
credentialIssuerConfigResourceName,
nil,
@ -206,7 +206,7 @@ func TestSync(t *testing.T) {
// nested Before's can keep adding things to the informer caches.
var startInformersAndController = func() {
// Set this at the last second to allow for injection of server override.
subject = NewPublisherController(
subject = NewKubeConfigInfoPublisherController(
installedInNamespace,
credentialIssuerConfigResourceName,
serverOverride,

View File

@ -93,7 +93,7 @@ func PrepareControllers(c *Config) (func(ctx context.Context), error) {
controllerManager := controllerlib.
NewManager().
WithController(
issuerconfig.NewPublisherController(
issuerconfig.NewKubeConfigInfoPublisherController(
c.ServerInstallationNamespace,
c.NamesConfig.CredentialIssuerConfig,
c.DiscoveryURLOverride,