@@ -43,7 +43,7 @@ import (
43
43
appset "github.com/argoproj/applicationset/api/v1alpha1"
44
44
argocdv1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
45
45
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"
47
47
"github.com/juju/ansiterm"
48
48
"github.com/manifoldco/promptui"
49
49
"github.com/rkrmr33/checklist"
74
74
CommonConfig * runtime.CommonConfig
75
75
SuggestedSharedConfigRepo string
76
76
DisableTelemetry bool
77
+
78
+ featuresToInstall []runtime.InstallFeature
77
79
}
78
80
79
81
gvr struct {
@@ -150,6 +152,7 @@ func runtimeUninstallCommandPreRunHandler(cmd *cobra.Command, args []string, opt
150
152
if ! opts .Managed {
151
153
opts .kubeContext , err = getKubeContextName (cmd .Flag ("context" ), cmd .Flag ("kubeconfig" ))
152
154
}
155
+
153
156
handleCliStep (reporter .UninstallStepPreCheckGetKubeContext , "Getting kube context name" , err , true , false )
154
157
if err != nil {
155
158
return err
@@ -165,6 +168,7 @@ func runtimeUninstallCommandPreRunHandler(cmd *cobra.Command, args []string, opt
165
168
opts .skipAutopilotUninstall = true // will not touch the cluster and repo
166
169
}
167
170
}
171
+
168
172
handleCliStep (reporter .UninstallStepPreCheckEnsureRuntimeOnKubeContext , "Ensuring runtime is on the kube context" , err , true , false )
169
173
if err != nil {
170
174
return err
@@ -181,6 +185,7 @@ func runtimeUninstallCommandPreRunHandler(cmd *cobra.Command, args []string, opt
181
185
if ! opts .Managed {
182
186
err = ensureGitRuntimeToken (cmd , nil , opts .CloneOpts )
183
187
}
188
+
184
189
handleCliStep (reporter .UninstallStepPreCheckEnsureGitToken , "Getting git token" , err , true , false )
185
190
if err != nil {
186
191
return err
@@ -201,16 +206,20 @@ func runtimeUpgradeCommandPreRunHandler(cmd *cobra.Command, args []string, opts
201
206
return err
202
207
}
203
208
204
- isManaged , err := isRuntimeManaged (ctx , opts .RuntimeName )
209
+ rt , err := getRuntime (ctx , opts .RuntimeName )
205
210
handleCliStep (reporter .UpgradeStepPreCheckIsManagedRuntime , "Checking if runtime is hosted" , err , true , false )
206
211
if err != nil {
207
212
return err
208
213
}
209
214
210
- if isManaged {
215
+ if rt . Managed {
211
216
return fmt .Errorf ("manual upgrades are not allowed for hosted runtimes and are managed by Codefresh operational team" )
212
217
}
213
218
219
+ if rt .AccessMode == platmodel .AccessModeTunnel {
220
+ opts .featuresToInstall = append (opts .featuresToInstall , runtime .InstallFeatureIngressless )
221
+ }
222
+
214
223
err = ensureRepo (cmd , opts .RuntimeName , opts .CloneOpts , true )
215
224
handleCliStep (reporter .UpgradeStepPreCheckEnsureRuntimeRepo , "Getting runtime repo" , err , true , false )
216
225
if err != nil {
@@ -258,7 +267,7 @@ func removeGitIntegrations(ctx context.Context, opts *RuntimeUninstallOptions) e
258
267
return nil
259
268
}
260
269
261
- func getComponentChecklistState (c model .Component ) (checklist.ListItemState , checklist.ListItemInfo ) {
270
+ func getComponentChecklistState (c platmodel .Component ) (checklist.ListItemState , checklist.ListItemInfo ) {
262
271
state := checklist .Waiting
263
272
name := strings .TrimPrefix (c .Metadata .Name , fmt .Sprintf ("%s-" , c .Metadata .Runtime ))
264
273
version := "N/A"
@@ -280,16 +289,16 @@ func getComponentChecklistState(c model.Component) (checklist.ListItemState, che
280
289
if len (c .Self .Errors ) > 0 {
281
290
// use the first sync error due to lack of space
282
291
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 {
285
294
errs = se .Message
286
295
state = checklist .Error
287
296
}
288
297
}
289
298
}
290
299
}
291
300
292
- if healthStatus == string (model .HealthStatusHealthy ) && syncStatus == string (model .SyncStatusSynced ) {
301
+ if healthStatus == string (platmodel .HealthStatusHealthy ) && syncStatus == string (platmodel .SyncStatusSynced ) {
293
302
state = checklist .Ready
294
303
}
295
304
@@ -488,7 +497,7 @@ func runRuntimeUninstall(ctx context.Context, opts *RuntimeUninstallOptions) err
488
497
// check whether the runtime exists
489
498
var err error
490
499
if ! opts .SkipChecks {
491
- _ , err = cfConfig . NewClient (). V2 (). Runtime (). Get (ctx , opts .RuntimeName )
500
+ _ , err = getRuntime (ctx , opts .RuntimeName )
492
501
}
493
502
handleCliStep (reporter .UninstallStepCheckRuntimeExists , "Checking if runtime exists" , err , false , true )
494
503
if err != nil {
@@ -730,7 +739,9 @@ func NewRuntimeUpgradeCommand() *cobra.Command {
730
739
var (
731
740
versionStr string
732
741
finalParameters map [string ]string
733
- opts RuntimeUpgradeOptions
742
+ opts = & RuntimeUpgradeOptions {
743
+ featuresToInstall : make ([]runtime.InstallFeature , 0 ),
744
+ }
734
745
)
735
746
736
747
cmd := & cobra.Command {
@@ -756,7 +767,7 @@ func NewRuntimeUpgradeCommand() *cobra.Command {
756
767
757
768
createAnalyticsReporter (ctx , reporter .UpgradeFlow , opts .DisableTelemetry )
758
769
759
- err := runtimeUpgradeCommandPreRunHandler (cmd , args , & opts )
770
+ err := runtimeUpgradeCommandPreRunHandler (cmd , args , opts )
760
771
handleCliStep (reporter .UpgradePhasePreCheckFinish , "Finished pre run checks" , err , true , false )
761
772
if err != nil {
762
773
if errors .Is (err , promptui .ErrInterrupt ) {
@@ -798,7 +809,7 @@ func NewRuntimeUpgradeCommand() *cobra.Command {
798
809
CodefreshBaseURL : cfConfig .GetCurrentContext ().URL ,
799
810
}
800
811
801
- err = runRuntimeUpgrade (ctx , & opts )
812
+ err = runRuntimeUpgrade (ctx , opts )
802
813
handleCliStep (reporter .UpgradePhaseFinish , "Runtime upgrade phase finished" , err , false , false )
803
814
return err
804
815
},
@@ -817,7 +828,8 @@ func runRuntimeUpgrade(ctx context.Context, opts *RuntimeUpgradeOptions) error {
817
828
handleCliStep (reporter .UpgradePhaseStart , "Runtime upgrade phase started" , nil , false , true )
818
829
819
830
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 )
821
833
handleCliStep (reporter .UpgradeStepDownloadRuntimeDefinition , "Downloading runtime definition" , err , true , false )
822
834
if err != nil {
823
835
return fmt .Errorf ("failed to download runtime definition: %w" , err )
0 commit comments