Skip to content

Commit

Permalink
fix(dedicated): attempts to correctly parse the cluster ingress dns n…
Browse files Browse the repository at this point in the history
…ame (#1806)

This is so that "apps." prefix is always included and required by KFM when it is running under
certain configuration

Related to bf2fc6cc711aee1a0c2a/kas-installer#266 (comment)
  • Loading branch information
machi1990 authored Feb 9, 2023
1 parent 17cbcbc commit 87f171d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg/cmd/dedicated/register/registercluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package register
import (
"context"
"fmt"
"strings"

"github.com/redhat-developer/app-services-cli/internal/build"
"github.com/redhat-developer/app-services-cli/pkg/core/config"
"strings"

"github.com/AlecAivazis/survey/v2"
clustersmgmtv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1"
Expand Down Expand Up @@ -181,13 +182,19 @@ func runClusterSelectionInteractivePrompt(opts *options) error {
return nil
}

// parses the
// parseDNSURL attempts to parse the cluster ingress dns name from the console url.
func parseDNSURL(opts *options) (string, error) {
clusterIngressDNSName := opts.selectedCluster.Console().URL()
if len(clusterIngressDNSName) == 0 {
return "", fmt.Errorf("DNS url is empty")
}
return strings.SplitAfter(clusterIngressDNSName, ".apps.")[1], nil

splits := strings.SplitAfterN(clusterIngressDNSName, "console-openshift-console.", 2)
if len(splits) == 2 {
return splits[1], nil
}

return "", fmt.Errorf("could not construct cluster_ingress_dns_name")
}

func getOrCreateMachinePoolList(opts *options) error {
Expand Down

0 comments on commit 87f171d

Please sign in to comment.