@@ -43,7 +43,7 @@ import (
4343 appset "github.com/argoproj/applicationset/api/v1alpha1"
4444 argocdv1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
4545 argocdv1alpha1cs "github.com/argoproj/argo-cd/v2/pkg/client/clientset/versioned"
46- "github.com/codefresh-io/go-sdk/pkg/codefresh/model"
46+ platmodel "github.com/codefresh-io/go-sdk/pkg/codefresh/model"
4747 "github.com/juju/ansiterm"
4848 "github.com/manifoldco/promptui"
4949 "github.com/rkrmr33/checklist"
7474 CommonConfig * runtime.CommonConfig
7575 SuggestedSharedConfigRepo string
7676 DisableTelemetry bool
77+
78+ featuresToInstall []runtime.InstallFeature
7779 }
7880
7981 gvr struct {
@@ -150,6 +152,7 @@ func runtimeUninstallCommandPreRunHandler(cmd *cobra.Command, args []string, opt
150152 if ! opts .Managed {
151153 opts .kubeContext , err = getKubeContextName (cmd .Flag ("context" ), cmd .Flag ("kubeconfig" ))
152154 }
155+
153156 handleCliStep (reporter .UninstallStepPreCheckGetKubeContext , "Getting kube context name" , err , true , false )
154157 if err != nil {
155158 return err
@@ -165,6 +168,7 @@ func runtimeUninstallCommandPreRunHandler(cmd *cobra.Command, args []string, opt
165168 opts .skipAutopilotUninstall = true // will not touch the cluster and repo
166169 }
167170 }
171+
168172 handleCliStep (reporter .UninstallStepPreCheckEnsureRuntimeOnKubeContext , "Ensuring runtime is on the kube context" , err , true , false )
169173 if err != nil {
170174 return err
@@ -181,6 +185,7 @@ func runtimeUninstallCommandPreRunHandler(cmd *cobra.Command, args []string, opt
181185 if ! opts .Managed {
182186 err = ensureGitRuntimeToken (cmd , nil , opts .CloneOpts )
183187 }
188+
184189 handleCliStep (reporter .UninstallStepPreCheckEnsureGitToken , "Getting git token" , err , true , false )
185190 if err != nil {
186191 return err
@@ -201,16 +206,20 @@ func runtimeUpgradeCommandPreRunHandler(cmd *cobra.Command, args []string, opts
201206 return err
202207 }
203208
204- isManaged , err := isRuntimeManaged (ctx , opts .RuntimeName )
209+ rt , err := getRuntime (ctx , opts .RuntimeName )
205210 handleCliStep (reporter .UpgradeStepPreCheckIsManagedRuntime , "Checking if runtime is hosted" , err , true , false )
206211 if err != nil {
207212 return err
208213 }
209214
210- if isManaged {
215+ if rt . Managed {
211216 return fmt .Errorf ("manual upgrades are not allowed for hosted runtimes and are managed by Codefresh operational team" )
212217 }
213218
219+ if rt .AccessMode == platmodel .AccessModeTunnel {
220+ opts .featuresToInstall = append (opts .featuresToInstall , runtime .InstallFeatureIngressless )
221+ }
222+
214223 err = ensureRepo (cmd , opts .RuntimeName , opts .CloneOpts , true )
215224 handleCliStep (reporter .UpgradeStepPreCheckEnsureRuntimeRepo , "Getting runtime repo" , err , true , false )
216225 if err != nil {
@@ -258,7 +267,7 @@ func removeGitIntegrations(ctx context.Context, opts *RuntimeUninstallOptions) e
258267 return nil
259268}
260269
261- func getComponentChecklistState (c model .Component ) (checklist.ListItemState , checklist.ListItemInfo ) {
270+ func getComponentChecklistState (c platmodel .Component ) (checklist.ListItemState , checklist.ListItemInfo ) {
262271 state := checklist .Waiting
263272 name := strings .TrimPrefix (c .Metadata .Name , fmt .Sprintf ("%s-" , c .Metadata .Runtime ))
264273 version := "N/A"
@@ -280,16 +289,16 @@ func getComponentChecklistState(c model.Component) (checklist.ListItemState, che
280289 if len (c .Self .Errors ) > 0 {
281290 // use the first sync error due to lack of space
282291 for _ , err := range c .Self .Errors {
283- se , ok := err .(model .SyncError )
284- if ok && se .Level == model .ErrorLevelsError {
292+ se , ok := err .(platmodel .SyncError )
293+ if ok && se .Level == platmodel .ErrorLevelsError {
285294 errs = se .Message
286295 state = checklist .Error
287296 }
288297 }
289298 }
290299 }
291300
292- if healthStatus == string (model .HealthStatusHealthy ) && syncStatus == string (model .SyncStatusSynced ) {
301+ if healthStatus == string (platmodel .HealthStatusHealthy ) && syncStatus == string (platmodel .SyncStatusSynced ) {
293302 state = checklist .Ready
294303 }
295304
@@ -488,7 +497,7 @@ func runRuntimeUninstall(ctx context.Context, opts *RuntimeUninstallOptions) err
488497 // check whether the runtime exists
489498 var err error
490499 if ! opts .SkipChecks {
491- _ , err = cfConfig . NewClient (). V2 (). Runtime (). Get (ctx , opts .RuntimeName )
500+ _ , err = getRuntime (ctx , opts .RuntimeName )
492501 }
493502 handleCliStep (reporter .UninstallStepCheckRuntimeExists , "Checking if runtime exists" , err , false , true )
494503 if err != nil {
@@ -730,7 +739,9 @@ func NewRuntimeUpgradeCommand() *cobra.Command {
730739 var (
731740 versionStr string
732741 finalParameters map [string ]string
733- opts RuntimeUpgradeOptions
742+ opts = & RuntimeUpgradeOptions {
743+ featuresToInstall : make ([]runtime.InstallFeature , 0 ),
744+ }
734745 )
735746
736747 cmd := & cobra.Command {
@@ -756,7 +767,7 @@ func NewRuntimeUpgradeCommand() *cobra.Command {
756767
757768 createAnalyticsReporter (ctx , reporter .UpgradeFlow , opts .DisableTelemetry )
758769
759- err := runtimeUpgradeCommandPreRunHandler (cmd , args , & opts )
770+ err := runtimeUpgradeCommandPreRunHandler (cmd , args , opts )
760771 handleCliStep (reporter .UpgradePhasePreCheckFinish , "Finished pre run checks" , err , true , false )
761772 if err != nil {
762773 if errors .Is (err , promptui .ErrInterrupt ) {
@@ -798,7 +809,7 @@ func NewRuntimeUpgradeCommand() *cobra.Command {
798809 CodefreshBaseURL : cfConfig .GetCurrentContext ().URL ,
799810 }
800811
801- err = runRuntimeUpgrade (ctx , & opts )
812+ err = runRuntimeUpgrade (ctx , opts )
802813 handleCliStep (reporter .UpgradePhaseFinish , "Runtime upgrade phase finished" , err , false , false )
803814 return err
804815 },
@@ -817,7 +828,8 @@ func runRuntimeUpgrade(ctx context.Context, opts *RuntimeUpgradeOptions) error {
817828 handleCliStep (reporter .UpgradePhaseStart , "Runtime upgrade phase started" , nil , false , true )
818829
819830 log .G (ctx ).Info ("Downloading runtime definition" )
820- newRt , err := runtime .Download (opts .Version , opts .RuntimeName )
831+
832+ newRt , err := runtime .Download (opts .Version , opts .RuntimeName , opts .featuresToInstall )
821833 handleCliStep (reporter .UpgradeStepDownloadRuntimeDefinition , "Downloading runtime definition" , err , true , false )
822834 if err != nil {
823835 return fmt .Errorf ("failed to download runtime definition: %w" , err )
0 commit comments