Skip to content

Commit

Permalink
fix microcluster port propagation (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
bschimke95 authored Jul 3, 2024
1 parent fc59680 commit 923dd1f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bootstrap/controllers/ck8sconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ func (r *CK8sConfigReconciler) joinControlplane(ctx context.Context, scope *Scop
// injects into config.Version values from top level object
r.reconcileTopLevelObjectSettings(scope.Cluster, machine, scope.Config)

workloadCluster, err := r.managementCluster.GetWorkloadCluster(ctx, util.ObjectKey(scope.Cluster), scope.Config.Spec.ControlPlaneConfig.GetMicroclusterPort())
microclusterPort := scope.Config.Spec.ControlPlaneConfig.GetMicroclusterPort()
workloadCluster, err := r.managementCluster.GetWorkloadCluster(ctx, util.ObjectKey(scope.Cluster), microclusterPort)
if err != nil {
return fmt.Errorf("failed to create remote cluster client: %w", err)
}
Expand Down Expand Up @@ -254,6 +255,7 @@ func (r *CK8sConfigReconciler) joinControlplane(ctx context.Context, scope *Scop
ExtraFiles: cloudinit.FilesFromAPI(files),
ConfigFileContents: string(joinConfig),
MicroclusterAddress: scope.Config.Spec.ControlPlaneConfig.MicroclusterAddress,
MicroclusterPort: microclusterPort,
AirGapped: scope.Config.Spec.AirGapped,
},
JoinToken: joinToken,
Expand Down Expand Up @@ -293,7 +295,8 @@ func (r *CK8sConfigReconciler) joinWorker(ctx context.Context, scope *Scope) err
return fmt.Errorf("auth token not yet generated")
}

workloadCluster, err := r.managementCluster.GetWorkloadCluster(ctx, util.ObjectKey(scope.Cluster), scope.Config.Spec.ControlPlaneConfig.GetMicroclusterPort())
microclusterPort := scope.Config.Spec.ControlPlaneConfig.GetMicroclusterPort()
workloadCluster, err := r.managementCluster.GetWorkloadCluster(ctx, util.ObjectKey(scope.Cluster), microclusterPort)
if err != nil {
return fmt.Errorf("failed to create remote cluster client: %w", err)
}
Expand Down Expand Up @@ -324,6 +327,7 @@ func (r *CK8sConfigReconciler) joinWorker(ctx context.Context, scope *Scope) err
ExtraFiles: cloudinit.FilesFromAPI(files),
ConfigFileContents: string(joinConfig),
MicroclusterAddress: scope.Config.Spec.ControlPlaneConfig.MicroclusterAddress,
MicroclusterPort: microclusterPort,
AirGapped: scope.Config.Spec.AirGapped,
},
JoinToken: joinToken,
Expand Down Expand Up @@ -478,6 +482,7 @@ func (r *CK8sConfigReconciler) handleClusterNotInitialized(ctx context.Context,
ExtraFiles: cloudinit.FilesFromAPI(files),
ConfigFileContents: string(initConfig),
MicroclusterAddress: scope.Config.Spec.ControlPlaneConfig.MicroclusterAddress,
MicroclusterPort: microclusterPort,
AirGapped: scope.Config.Spec.AirGapped,
},
Token: *token,
Expand Down

0 comments on commit 923dd1f

Please sign in to comment.