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

feat(v2): upgrades without manager #1755

Merged
merged 5 commits into from
Jan 28, 2025
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
1 change: 0 additions & 1 deletion kinds/apis/v1beta1/installation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const (

const (
ConditionTypeV2MigrationInProgress = "V2MigrationInProgress"
ConditionTypeDisableReconcile = "DisableReconcile"
)

// ConfigSecretEntryName holds the entry name we are looking for in the secret
Expand Down
5 changes: 0 additions & 5 deletions operator/controllers/installation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,6 @@ func (r *InstallationReconciler) Reconcile(ctx context.Context, req ctrl.Request
return ctrl.Result{}, nil
}

if k8sutil.CheckConditionStatus(in.Status, v1beta1.ConditionTypeDisableReconcile) == metav1.ConditionTrue {
log.Info("Installation reconciliation is disabled, reconciliation ended")
return ctrl.Result{}, nil
}

// if this installation points to a cluster configuration living on
// a secret we need to fetch this configuration before moving on.
// at this stage we bail out with an error if we can't fetch or
Expand Down
42 changes: 2 additions & 40 deletions operator/pkg/cli/migrate_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@ package cli

import (
"fmt"
"io"
"log"

ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
"github.com/replicatedhq/embedded-cluster/operator/pkg/cli/migratev2"
"github.com/replicatedhq/embedded-cluster/operator/pkg/k8sutil"
"github.com/replicatedhq/embedded-cluster/pkg/helm"
"github.com/replicatedhq/embedded-cluster/pkg/manager"
"github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig"
"github.com/spf13/cobra"
)

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

var installation *ecv1beta1.Installation

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

// set the runtime config from the installation spec
// NOTE: this is run in a pod so the data dir is not available
runtimeconfig.Set(installation.Spec.RuntimeConfig)

manager.SetServiceName(appSlug)

return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
Expand All @@ -47,16 +37,7 @@ func MigrateV2Cmd() *cobra.Command {
return fmt.Errorf("failed to create kubernetes client: %w", err)
}

helmCLI, err := helm.NewHelm(helm.HelmOptions{
Writer: io.Discard,
LogFn: log.Printf,
RESTClientGetterFactory: k8sutil.RESTClientGetterFactory,
})
if err != nil {
return fmt.Errorf("failed to create helm client: %w", err)
}

err = migratev2.Run(ctx, log.Printf, cli, helmCLI, installation, migrationSecret, appSlug, appVersionLabel)
err = migratev2.Run(ctx, log.Printf, cli, installation)
if err != nil {
return fmt.Errorf("failed to run v2 migration: %w", err)
}
Expand All @@ -70,25 +51,6 @@ func MigrateV2Cmd() *cobra.Command {
if err != nil {
panic(err)
}
cmd.Flags().StringVar(&migrationSecret, "migrate-v2-secret", "", "The secret name from which to read the license")
err = cmd.MarkFlagRequired("migrate-v2-secret")
if err != nil {
panic(err)
}
cmd.Flags().StringVar(&appSlug, "app-slug", "", "The application slug")
err = cmd.MarkFlagRequired("app-slug")
if err != nil {
panic(err)
}
cmd.Flags().StringVar(&appVersionLabel, "app-version-label", "", "The application version label")
err = cmd.MarkFlagRequired("app-version-label")
if err != nil {
panic(err)
}

cmd.AddCommand(
MigrateV2InstallManagerCmd(),
)

return cmd
}
87 changes: 0 additions & 87 deletions operator/pkg/cli/migrate_v2_installmanager.go

This file was deleted.

Loading
Loading