Skip to content

Commit

Permalink
fix api port issue (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
jichenjc authored and k8s-ci-robot committed Sep 5, 2019
1 parent 54bb062 commit 005d712
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion controllers/openstackcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,17 @@ func (r *OpenStackClusterReconciler) reconcileCluster(logger logr.Logger, cluste
return reconcile.Result{}, errors.Errorf("failed to get control plane machine: %v", err)
}
if controlPlaneMachine != nil {
var apiPort int
if cluster.Spec.ClusterNetwork.APIServerPort == nil {
logger.Info("No API endpoint given, default to 6443")
apiPort = 6443
} else {
apiPort = int(*cluster.Spec.ClusterNetwork.APIServerPort)
}
openStackCluster.Status.APIEndpoints = []infrav1.APIEndpoint{
{
Host: controlPlaneMachine.Spec.FloatingIP,
Port: int(*cluster.Spec.ClusterNetwork.APIServerPort),
Port: apiPort,
},
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion examples/cluster/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
# * Disable the apiServerPort property
# single-node control-plane:
# * Enable the apiServerPort property
#apiServerPort: 6443
apiServerPort: <disable when multi-node control-plane>
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2
kind: OpenStackCluster
Expand Down

0 comments on commit 005d712

Please sign in to comment.