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

CR-15313-invalid-tunnel-url #632

Merged
merged 4 commits into from
Nov 6, 2022
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
2 changes: 1 addition & 1 deletion CODEOWNERS
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=v0.1.0
VERSION=v0.1.1

OUT_DIR=dist
YEAR?=$(shell date +"%Y")
Expand Down
36 changes: 19 additions & 17 deletions cmd/commands/runtime_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,6 @@ func NewRuntimeInstallCommand() *cobra.Command {
return fmt.Errorf("invalid access-mode %s, must be one of: ingress|tunnel", accessMode)
}

if installationOpts.AccessMode == platmodel.AccessModeTunnel {
installationOpts.featuresToInstall = append(installationOpts.featuresToInstall, runtime.InstallFeatureIngressless)
accountId, err := cfConfig.GetCurrentContext().GetAccountId(ctx)
if err != nil {
return fmt.Errorf("failed creating ingressHost for tunnel: %w", err)
}

installationOpts.TunnelSubdomain = fmt.Sprintf("%s-%s", accountId, installationOpts.RuntimeName)
installationOpts.IngressHost = fmt.Sprintf("https://%s.%s", installationOpts.TunnelSubdomain, installationOpts.TunnelDomain)
}

err := runtimeInstallCommandPreRunHandler(cmd, installationOpts)
handleCliStep(reporter.InstallPhasePreCheckFinish, "Finished pre installation checks", err, true, false)
if err != nil {
Expand All @@ -222,21 +211,22 @@ func NewRuntimeInstallCommand() *cobra.Command {
return util.DecorateErrorWithDocsLink(fmt.Errorf("pre installation error: %w", err), store.Get().RequirementsLink)
}

if installationOpts.runtimeDef == "" {
installationOpts.runtimeDef = runtime.GetRuntimeDefURL(installationOpts.versionStr)
}

finalParameters = map[string]string{
"Codefresh context": cfConfig.CurrentContext,
"Kube context": installationOpts.kubeContext,
"Runtime name": installationOpts.RuntimeName,
"Repository URL": installationOpts.InsCloneOpts.Repo,
"Ingress host": installationOpts.IngressHost,
"Ingress class": installationOpts.IngressClass,
"Internal ingress host": installationOpts.InternalIngressHost,
"Installing demo resources": strconv.FormatBool(installationOpts.InstallDemoResources),
}

if installationOpts.AccessMode == platmodel.AccessModeTunnel {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

display the correct summary

finalParameters["Tunnel URL"] = installationOpts.IngressHost
} else {
finalParameters["Ingress host"] = installationOpts.IngressHost
finalParameters["Internal ingress host"] = installationOpts.InternalIngressHost
}

if err := getApprovalFromUser(ctx, finalParameters, "runtime install"); err != nil {
return err
}
Expand Down Expand Up @@ -339,6 +329,14 @@ func runtimeInstallCommandPreRunHandler(cmd *cobra.Command, opts *RuntimeInstall
if opts.AccessMode == platmodel.AccessModeTunnel {
handleCliStep(reporter.InstallStepPreCheckEnsureIngressClass, "-skipped (ingressless)-", err, true, false)
handleCliStep(reporter.InstallStepPreCheckEnsureIngressHost, "-skipped (ingressless)-", err, true, false)
opts.featuresToInstall = append(opts.featuresToInstall, runtime.InstallFeatureIngressless)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

create tunnel ingressHost after runtimeName was supplied by user

accountId, err := cfConfig.GetCurrentContext().GetAccountId(ctx)
if err != nil {
return fmt.Errorf("failed creating ingressHost for tunnel: %w", err)
}

opts.TunnelSubdomain = fmt.Sprintf("%s-%s", accountId, opts.RuntimeName)
opts.IngressHost = fmt.Sprintf("https://%s.%s", opts.TunnelSubdomain, opts.TunnelDomain)
} else {
err = ensureRoutingControllerSupported(ctx, opts)
handleCliStep(reporter.InstallStepPreCheckEnsureIngressClass, "Getting ingress class", err, true, false)
Expand Down Expand Up @@ -387,6 +385,10 @@ func runtimeInstallCommandPreRunHandler(cmd *cobra.Command, opts *RuntimeInstall
log.G(ctx).Infof("using repo '%s' as shared config repo for this account", sharedConfigRepo)
}

if opts.runtimeDef == "" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just feels better located in here

opts.runtimeDef = runtime.GetRuntimeDefURL(opts.versionStr)
}

opts.Insecure = true // installs argo-cd in insecure mode, we need this so that the eventsource can talk to the argocd-server with http
opts.CommonConfig = &runtime.CommonConfig{CodefreshBaseURL: cfConfig.GetCurrentContext().URL}

Expand Down
4 changes: 2 additions & 2 deletions docs/releases/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cf version

```bash
# download and extract the binary
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.0/cf-linux-amd64.tar.gz | tar zx
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.1/cf-linux-amd64.tar.gz | tar zx

# move the binary to your $PATH
mv ./cf-linux-amd64 /usr/local/bin/cf
Expand All @@ -36,7 +36,7 @@ cf version

```bash
# download and extract the binary
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.0/cf-darwin-amd64.tar.gz | tar zx
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.1/cf-darwin-amd64.tar.gz | tar zx

# move the binary to your $PATH
mv ./cf-darwin-amd64 /usr/local/bin/cf
Expand Down