Skip to content

Commit 2a1f05f

Browse files
authored
feat(v2): upgrades without manager (#1755)
* feat(v2): upgrades without manager * f * f * f * conditionally migrate
1 parent 0b9399b commit 2a1f05f

21 files changed

+640
-2667
lines changed

kinds/apis/v1beta1/installation_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ const (
5151

5252
const (
5353
ConditionTypeV2MigrationInProgress = "V2MigrationInProgress"
54-
ConditionTypeDisableReconcile = "DisableReconcile"
5554
)
5655

5756
// ConfigSecretEntryName holds the entry name we are looking for in the secret

operator/controllers/installation_controller.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,6 @@ func (r *InstallationReconciler) Reconcile(ctx context.Context, req ctrl.Request
590590
return ctrl.Result{}, nil
591591
}
592592

593-
if k8sutil.CheckConditionStatus(in.Status, v1beta1.ConditionTypeDisableReconcile) == metav1.ConditionTrue {
594-
log.Info("Installation reconciliation is disabled, reconciliation ended")
595-
return ctrl.Result{}, nil
596-
}
597-
598593
// if this installation points to a cluster configuration living on
599594
// a secret we need to fetch this configuration before moving on.
600595
// at this stage we bail out with an error if we can't fetch or

operator/pkg/cli/migrate_v2.go

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,17 @@ package cli
22

33
import (
44
"fmt"
5-
"io"
65
"log"
76

87
ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
98
"github.com/replicatedhq/embedded-cluster/operator/pkg/cli/migratev2"
109
"github.com/replicatedhq/embedded-cluster/operator/pkg/k8sutil"
11-
"github.com/replicatedhq/embedded-cluster/pkg/helm"
12-
"github.com/replicatedhq/embedded-cluster/pkg/manager"
13-
"github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig"
1410
"github.com/spf13/cobra"
1511
)
1612

1713
// MigrateV2Cmd returns a cobra command for migrating the installation from v1 to v2.
1814
func MigrateV2Cmd() *cobra.Command {
19-
var installationFile, migrationSecret, appSlug, appVersionLabel string
15+
var installationFile string
2016

2117
var installation *ecv1beta1.Installation
2218

@@ -31,12 +27,6 @@ func MigrateV2Cmd() *cobra.Command {
3127
}
3228
installation = in
3329

34-
// set the runtime config from the installation spec
35-
// NOTE: this is run in a pod so the data dir is not available
36-
runtimeconfig.Set(installation.Spec.RuntimeConfig)
37-
38-
manager.SetServiceName(appSlug)
39-
4030
return nil
4131
},
4232
RunE: func(cmd *cobra.Command, args []string) error {
@@ -47,16 +37,7 @@ func MigrateV2Cmd() *cobra.Command {
4737
return fmt.Errorf("failed to create kubernetes client: %w", err)
4838
}
4939

50-
helmCLI, err := helm.NewHelm(helm.HelmOptions{
51-
Writer: io.Discard,
52-
LogFn: log.Printf,
53-
RESTClientGetterFactory: k8sutil.RESTClientGetterFactory,
54-
})
55-
if err != nil {
56-
return fmt.Errorf("failed to create helm client: %w", err)
57-
}
58-
59-
err = migratev2.Run(ctx, log.Printf, cli, helmCLI, installation, migrationSecret, appSlug, appVersionLabel)
40+
err = migratev2.Run(ctx, log.Printf, cli, installation)
6041
if err != nil {
6142
return fmt.Errorf("failed to run v2 migration: %w", err)
6243
}
@@ -70,25 +51,6 @@ func MigrateV2Cmd() *cobra.Command {
7051
if err != nil {
7152
panic(err)
7253
}
73-
cmd.Flags().StringVar(&migrationSecret, "migrate-v2-secret", "", "The secret name from which to read the license")
74-
err = cmd.MarkFlagRequired("migrate-v2-secret")
75-
if err != nil {
76-
panic(err)
77-
}
78-
cmd.Flags().StringVar(&appSlug, "app-slug", "", "The application slug")
79-
err = cmd.MarkFlagRequired("app-slug")
80-
if err != nil {
81-
panic(err)
82-
}
83-
cmd.Flags().StringVar(&appVersionLabel, "app-version-label", "", "The application version label")
84-
err = cmd.MarkFlagRequired("app-version-label")
85-
if err != nil {
86-
panic(err)
87-
}
88-
89-
cmd.AddCommand(
90-
MigrateV2InstallManagerCmd(),
91-
)
9254

9355
return cmd
9456
}

operator/pkg/cli/migrate_v2_installmanager.go

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)