Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions build/run-functional-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mkdir -p $TEST_RESULT_DIR

function init_hub() {
echo "init_hub 1st parameter: "$1 >&2
local _CMDINITRESULT=`clusteradm init $1 --image-registry=quay.io/open-cluster-management --tag=v0.5.0`
local _CMDINITRESULT=`clusteradm init $1 --image-registry=quay.io/open-cluster-management --tag=latest`
if [ $? != 0 ]
then
ERROR_REPORT=$ERROR_REPORT+"clusteradm init failed\n"
Expand All @@ -29,7 +29,7 @@ function join_hub() {
echo "join_hub 4nd parameter: "$4 >&2
local _CMDJOIN=`echo "$1" | cut -d ':' -f2-4 | cut -d '<' -f1`
_CMDJOIN="$_CMDJOIN $2 $3 $4"
local _CMDJOINRESULT=`$_CMDJOIN --wait`
local _CMDJOINRESULT=`$_CMDJOIN --wait --force-internal-endpoint-lookup`
if [ $? != 0 ]
then
ERROR_REPORT=$ERROR_REPORT+"clusteradm join failed\n"
Expand Down
7 changes: 3 additions & 4 deletions pkg/cmd/join/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ func NewCmd(clusteradmFlags *genericclioptionsclusteradm.ClusteradmFlags, stream
cmd.Flags().StringVar(&o.registry, "image-registry", "quay.io/open-cluster-management", "The name of the image registry serving OCM images.")
cmd.Flags().StringVar(&o.version, "version", "latest",
"The installing version of OCM components.")
cmd.Flags().BoolVar(&o.skipHubInClusterEndpointLookup, "skip-internal-endpoint-lookup", false,
"If true, the installed klusterlet agent will be starting registration using the external endpoint "+
"from --hub-apiserver instead of looking for the internal endpoint from the public cluster-info in the hub "+
"cluster.")
cmd.Flags().BoolVar(&o.forceHubInClusterEndpointLookup, "force-internal-endpoint-lookup", false,
"If true, the installed klusterlet agent will be starting the cluster registration process by "+
"looking for the internal endpoint from the public cluster-info in the hub cluster instead of from --hub-apiserver.")
cmd.Flags().BoolVar(&o.wait, "wait", false, "If true, running the cluster registration in foreground.")
return cmd
}
17 changes: 8 additions & 9 deletions pkg/cmd/join/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,21 +340,20 @@ func (o *Options) createKubeConfig(externalClientUnSecure *kubernetes.Clientset,
return "", err
}

hubAPIServerInternal, err := helpers.GetAPIServer(externalClientUnSecure)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we check if o.hubAPIServer is not set, read hubAPIServerInternal?

if err != nil {
if errors.IsNotFound(err) {
hubAPIServerInternal = o.hubAPIServer
} else {
return "", err
hubApiserver := o.hubAPIServer
if o.forceHubInClusterEndpointLookup || len(hubApiserver) == 0 {
hubApiserver, err = helpers.GetAPIServer(externalClientUnSecure)
if err != nil {
if !errors.IsNotFound(err) {
return "", err
}
}
}

bootstrapConfig := bootstrapExternalConfigUnSecure.DeepCopy()
bootstrapConfig.Clusters[0].Cluster.InsecureSkipTLSVerify = false
bootstrapConfig.Clusters[0].Cluster.CertificateAuthorityData = ca
if !o.skipHubInClusterEndpointLookup {
bootstrapConfig.Clusters[0].Cluster.Server = hubAPIServerInternal
}
bootstrapConfig.Clusters[0].Cluster.Server = hubApiserver
bootstrapConfigBytes, err := yaml.Marshal(bootstrapConfig)
if err != nil {
return "", err
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/join/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ type Options struct {
//Runs the cluster joining in foreground
wait bool

// The installing registration agent will be starting registration using
// the external endpoint from --hub-apiserver instead of looking for the
// internal endpoint from the public cluster-info.
skipHubInClusterEndpointLookup bool
// By default, The installing registration agent will be starting registration using
// the external endpoint from --hub-apiserver instead of looking for the internal
// endpoint from the public cluster-info.
forceHubInClusterEndpointLookup bool
}

//Values: The values used in the template
Expand Down