7272 RuntimeName string
7373 RuntimeToken string
7474 RuntimeStoreIV string
75+ HostName string
7576 IngressHost string
7677 IngressClass string
7778 IngressController string
@@ -222,6 +223,7 @@ func NewRuntimeInstallCommand() *cobra.Command {
222223 cmd .Flags ().BoolVar (& installationOpts .SkipClusterChecks , "skip-cluster-checks" , false , "Skips the cluster's checks" )
223224 cmd .Flags ().DurationVar (& store .Get ().WaitTimeout , "wait-timeout" , store .Get ().WaitTimeout , "How long to wait for the runtime components to be ready" )
224225 cmd .Flags ().StringVar (& gitIntegrationCreationOpts .APIURL , "provider-api-url" , "" , "Git provider API url" )
226+ cmd .Flags ().BoolVar (& store .Get ().SkipIngress , "skip-ingress" , false , "Skips the creation of ingress resources" )
225227 cmd .Flags ().BoolVar (& store .Get ().BypassIngressClassCheck , "bypass-ingress-class-check" , false , "Disables the ingress class check during pre-installation" )
226228
227229 installationOpts .InsCloneOpts = apu .AddCloneFlags (cmd , & apu.CloneFlagsOptions {
@@ -406,7 +408,7 @@ func ensureIngressHost(cmd *cobra.Command, opts *RuntimeInstallOptions) error {
406408}
407409
408410func ensureIngressClass (ctx context.Context , opts * RuntimeInstallOptions ) error {
409- if store .Get ().BypassIngressClassCheck {
411+ if store .Get ().BypassIngressClassCheck || store . Get (). SkipIngress {
410412 return nil
411413 }
412414
@@ -507,22 +509,12 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
507509
508510 handleCliStep (reporter .InstallPhaseStart , "Runtime installation phase started" , nil , true )
509511
510- rt , err := runtime .Download (opts .Version , opts .RuntimeName )
511- handleCliStep (reporter .InstallStepDownloadRuntimeDefinition , "Downloading runtime definition" , err , true )
512+ rt , server , err := runtimeInstallPreparations (opts )
512513 if err != nil {
513- return fmt .Errorf ("failed to download runtime definition: %w" , err )
514- }
515-
516- runtimeVersion := "v99.99.99"
517- if rt .Spec .Version != nil { // in dev mode
518- runtimeVersion = rt .Spec .Version .String ()
514+ return err
519515 }
520516
521- server , err := util .CurrentServer ()
522- handleCliStep (reporter .InstallStepGetServerAddress , "Getting current server address" , err , true )
523- if err != nil {
524- return fmt .Errorf ("failed to get current server address: %w" , err )
525- }
517+ runtimeVersion := rt .Spec .Version .String ()
526518
527519 componentNames := getComponents (rt , opts )
528520
@@ -585,6 +577,68 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
585577 return util .DecorateErrorWithDocsLink (fmt .Errorf ("failed to create codefresh-cm: %w" , err ))
586578 }
587579
580+ err = createRuntimeComponents (ctx , opts , rt )
581+ if err != nil {
582+ return err
583+ }
584+
585+ err = createGitSources (ctx , opts )
586+ if err != nil {
587+ return err
588+ }
589+
590+ timeoutErr := intervalCheckIsRuntimePersisted (ctx , opts .RuntimeName )
591+ handleCliStep (reporter .InstallStepCompleteRuntimeInstallation , "Completing runtime installation" , timeoutErr , true )
592+ if timeoutErr != nil {
593+ return util .DecorateErrorWithDocsLink (fmt .Errorf ("failed to complete installation: %w" , timeoutErr ))
594+ }
595+
596+ err = createGitIntegration (ctx , opts )
597+ if err != nil {
598+ return err
599+ }
600+
601+ installationSuccessMsg := fmt .Sprintf ("Runtime '%s' installed successfully" , opts .RuntimeName )
602+ skipIngressInfoMsg := fmt .Sprintf (
603+ `To complete the installation:
604+ 1. Configure your cluster's routing service with path to '/%s' and '%s'
605+ 2. Create and register Git integration using the commands:
606+ cf integration git add default --runtime %s --api-url %s
607+ cf integration git register default --runtime %s --token <AUTHENTICATION_TOKEN>` ,
608+ store .Get ().AppProxyIngressPath ,
609+ store .Get ().GithubExampleEventSourceEndpointPath ,
610+ opts .RuntimeName ,
611+ opts .GitIntegrationCreationOpts .APIURL ,
612+ opts .RuntimeName )
613+
614+ summaryArr = append (summaryArr , summaryLog {installationSuccessMsg , Info })
615+ if store .Get ().SkipIngress {
616+ summaryArr = append (summaryArr , summaryLog {skipIngressInfoMsg , Info })
617+ }
618+
619+ log .G (ctx ).Infof (installationSuccessMsg )
620+
621+ return nil
622+ }
623+
624+ func runtimeInstallPreparations (opts * RuntimeInstallOptions ) (* runtime.Runtime , string , error ) {
625+ rt , err := runtime .Download (opts .Version , opts .RuntimeName )
626+ handleCliStep (reporter .InstallStepDownloadRuntimeDefinition , "Downloading runtime definition" , err , true )
627+ if err != nil {
628+ return nil , "" , fmt .Errorf ("failed to download runtime definition: %w" , err )
629+ }
630+
631+ server , err := util .CurrentServer ()
632+ handleCliStep (reporter .InstallStepGetServerAddress , "Getting current server address" , err , true )
633+ if err != nil {
634+ return nil , "" , fmt .Errorf ("failed to get current server address: %w" , err )
635+ }
636+
637+ return rt , server , nil
638+ }
639+
640+ func createRuntimeComponents (ctx context.Context , opts * RuntimeInstallOptions , rt * runtime.Runtime ) error {
641+ var err error
588642 for _ , component := range rt .Spec .Components {
589643 infoStr := fmt .Sprintf ("Creating component '%s'" , component .Name )
590644 log .G (ctx ).Infof (infoStr )
@@ -606,13 +660,18 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
606660 return util .DecorateErrorWithDocsLink (fmt .Errorf ("failed to install components: %s" , err ))
607661 }
608662
663+ return nil
664+ }
665+
666+ func createGitSources (ctx context.Context , opts * RuntimeInstallOptions ) error {
609667 gitSrcMessage := fmt .Sprintf ("Creating git source `%s`" , store .Get ().GitSourceName )
610- err = RunGitSourceCreate (ctx , & GitSourceCreateOptions {
668+ err : = RunGitSourceCreate (ctx , & GitSourceCreateOptions {
611669 InsCloneOpts : opts .InsCloneOpts ,
612670 GsCloneOpts : opts .GsCloneOpts ,
613671 GsName : store .Get ().GitSourceName ,
614672 RuntimeName : opts .RuntimeName ,
615673 CreateDemoResources : opts .InstallDemoResources ,
674+ HostName : opts .HostName ,
616675 IngressHost : opts .IngressHost ,
617676 IngressClass : opts .IngressClass ,
618677 })
@@ -642,28 +701,30 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
642701 return util .DecorateErrorWithDocsLink (fmt .Errorf ("failed to create `%s`: %w" , store .Get ().MarketplaceGitSourceName , err ))
643702 }
644703
645- timeoutErr := intervalCheckIsRuntimePersisted (ctx , opts .RuntimeName )
646- handleCliStep (reporter .InstallStepCompleteRuntimeInstallation , "Completing runtime installation" , timeoutErr , true )
647- if timeoutErr != nil {
648- return util .DecorateErrorWithDocsLink (fmt .Errorf ("failed to complete installation: %w" , timeoutErr ))
649- }
704+ return nil
705+ }
706+
707+ func createGitIntegration (ctx context.Context , opts * RuntimeInstallOptions ) error {
708+ var gitIntgErr error
709+ var appendToLog bool
650710
651- gitIntgErr := addDefaultGitIntegration (ctx , opts .RuntimeName , opts .GitIntegrationCreationOpts )
652- handleCliStep (reporter .InstallStepCreateDefaultGitIntegration , "Creating a default git integration" , gitIntgErr , true )
711+ if ! store .Get ().SkipIngress {
712+ gitIntgErr = addDefaultGitIntegration (ctx , opts .RuntimeName , opts .GitIntegrationCreationOpts )
713+ appendToLog = true
714+ }
715+ handleCliStep (reporter .InstallStepCreateDefaultGitIntegration , "Creating a default git integration" , gitIntgErr , appendToLog )
653716 if gitIntgErr != nil {
654717 return util .DecorateErrorWithDocsLink (fmt .Errorf ("failed to create default git integration: %w" , gitIntgErr ))
655718 }
656719
657- gitIntgErr = registerUserToGitIntegration (ctx , opts .RuntimeName , opts .GitIntegrationRegistrationOpts )
658- handleCliStep (reporter .InstallStepRegisterToDefaultGitIntegration , "Registering user to the default git integration" , gitIntgErr , true )
720+ if ! store .Get ().SkipIngress {
721+ gitIntgErr = registerUserToGitIntegration (ctx , opts .RuntimeName , opts .GitIntegrationRegistrationOpts )
722+ }
723+ handleCliStep (reporter .InstallStepRegisterToDefaultGitIntegration , "Registering user to the default git integration" , gitIntgErr , appendToLog )
659724 if gitIntgErr != nil {
660725 return util .DecorateErrorWithDocsLink (fmt .Errorf ("failed to register user to the default git integration: %w" , gitIntgErr ))
661726 }
662727
663- installationSuccessMsg := fmt .Sprintf ("Runtime '%s' installed successfully" , opts .RuntimeName )
664- summaryArr = append (summaryArr , summaryLog {installationSuccessMsg , Info })
665- log .G (ctx ).Infof (installationSuccessMsg )
666-
667728 return nil
668729}
669730
@@ -702,7 +763,7 @@ func registerUserToGitIntegration(ctx context.Context, runtime string, opts *apm
702763
703764func installComponents (ctx context.Context , opts * RuntimeInstallOptions , rt * runtime.Runtime ) error {
704765 var err error
705- if opts .IngressHost != "" {
766+ if opts .IngressHost != "" && ! store . Get (). SkipIngress {
706767 if err = createWorkflowsIngress (ctx , opts , rt ); err != nil {
707768 return fmt .Errorf ("failed to patch Argo-Workflows ingress: %w" , err )
708769 }
@@ -1285,6 +1346,7 @@ func createWorkflowsIngress(ctx context.Context, opts *RuntimeInstallOptions, rt
12851346 Name : rt .Name + store .Get ().WorkflowsIngressName ,
12861347 Namespace : rt .Namespace ,
12871348 IngressClassName : opts .IngressClass ,
1349+ Host : opts .HostName ,
12881350 Annotations : map [string ]string {
12891351 "ingress.kubernetes.io/protocol" : "https" ,
12901352 "ingress.kubernetes.io/rewrite-target" : "/$2" ,
@@ -1367,11 +1429,12 @@ func configureAppProxy(ctx context.Context, opts *RuntimeInstallOptions, rt *run
13671429 },
13681430 })
13691431
1370- if opts .IngressHost != "" {
1432+ if opts .IngressHost != "" && ! store . Get (). SkipIngress {
13711433 ingress := ingressutil .CreateIngress (& ingressutil.CreateIngressOptions {
13721434 Name : rt .Name + store .Get ().AppProxyIngressName ,
13731435 Namespace : rt .Namespace ,
13741436 IngressClassName : opts .IngressClass ,
1437+ Host : opts .HostName ,
13751438 Paths : []ingressutil.IngressPath {
13761439 {
13771440 Path : fmt .Sprintf ("/%s" , store .Get ().AppProxyIngressPath ),
0 commit comments