Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix microcluster port propagation #21

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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