diff --git a/internal/controller/issuerconfig/doc.go b/internal/controller/issuerconfig/doc.go index 4ad1093a..dbc395c7 100644 --- a/internal/controller/issuerconfig/doc.go +++ b/internal/controller/issuerconfig/doc.go @@ -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 diff --git a/internal/controller/issuerconfig/publisher.go b/internal/controller/issuerconfig/kube_config_info_publisher.go similarity index 91% rename from internal/controller/issuerconfig/publisher.go rename to internal/controller/issuerconfig/kube_config_info_publisher.go index b4e6c56b..516c0a8f 100644 --- a/internal/controller/issuerconfig/publisher.go +++ b/internal/controller/issuerconfig/kube_config_info_publisher.go @@ -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). diff --git a/internal/controller/issuerconfig/publisher_test.go b/internal/controller/issuerconfig/kube_config_info_publisher_test.go similarity index 99% rename from internal/controller/issuerconfig/publisher_test.go rename to internal/controller/issuerconfig/kube_config_info_publisher_test.go index 267feae2..1ceade66 100644 --- a/internal/controller/issuerconfig/publisher_test.go +++ b/internal/controller/issuerconfig/kube_config_info_publisher_test.go @@ -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, diff --git a/internal/controllermanager/prepare_controllers.go b/internal/controllermanager/prepare_controllers.go index 2d3de65f..4444c904 100644 --- a/internal/controllermanager/prepare_controllers.go +++ b/internal/controllermanager/prepare_controllers.go @@ -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,