Skip to content

Commit 45a8396

Browse files
authored
Fixes on node and control plane config controllers (#333)
* fix error message when we cannot retrieve the cluster configuration * fail if result is not a configmap
1 parent 6eb114f commit 45a8396

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/k8s/pkg/k8sd/controllers/control_plane_configuration.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (c *ControlPlaneConfigurationController) Run(ctx context.Context, getCluste
5555

5656
config, err := getClusterConfig(ctx)
5757
if err != nil {
58-
log.Println(fmt.Errorf("failed to reconcile control plane configuration: %w", err))
58+
log.Println(fmt.Errorf("failed to retrieve cluster config: %w", err))
5959
continue
6060
}
6161

src/k8s/pkg/utils/k8s/configmap.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ func (c *Client) WatchConfigMap(ctx context.Context, namespace string, name stri
2222
return nil
2323
case evt := <-w.ResultChan():
2424
if evt.Object != nil {
25-
configMap := evt.Object.(*v1.ConfigMap)
25+
configMap, ok := evt.Object.(*v1.ConfigMap)
26+
if !ok {
27+
return fmt.Errorf("expected a ConfigMap but received %#v", evt.Object)
28+
}
2629

2730
if err := reconcile(configMap); err != nil {
2831
log.Println(fmt.Errorf("failed to reconcile configmap, namespace: %s name: %s: %w", namespace, name, err))

0 commit comments

Comments
 (0)