Skip to content

Commit

Permalink
Merge pull request #498 from jorgemoralespou/remove-delete-on-platfor…
Browse files Browse the repository at this point in the history
…m-deploy

Removing delete option on platform deploy command
  • Loading branch information
GrahamDumpleton authored Jul 3, 2024
2 parents 20cc56d + 8802b83 commit 42aa0f0
Showing 1 changed file with 30 additions and 49 deletions.
79 changes: 30 additions & 49 deletions client-programs/pkg/cmd/admin_platform_deploy_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ var (

type PlatformDeployOptions struct {
KubeconfigOptions
Delete bool
Config string
Domain string
DryRun bool
Expand All @@ -73,57 +72,45 @@ func (o *PlatformDeployOptions) Run() error {
return err
}

if o.Delete {
clusterConfig := cluster.NewClusterConfig(o.Kubeconfig, o.Context)

err := installer.Delete(fullConfig, clusterConfig, o.Verbose)

if err != nil {
return errors.Wrap(err, "educates could not be deleted")
}

fmt.Println("\nEducates has been deleted succesfully")
} else {
if o.DryRun {
if err = installer.DryRun(o.Version, o.PackageRepository, fullConfig, o.Verbose, false, o.skipImageResolution); err != nil {
return errors.Wrap(err, "educates could not be installed")
}
return nil
if o.DryRun {
if err = installer.DryRun(o.Version, o.PackageRepository, fullConfig, o.Verbose, false, o.skipImageResolution); err != nil {
return errors.Wrap(err, "educates could not be installed")
}
return nil
}

clusterConfig, err := cluster.NewClusterConfigIfAvailable(o.Kubeconfig, o.Context)
if err != nil {
return err
}
clusterConfig, err := cluster.NewClusterConfigIfAvailable(o.Kubeconfig, o.Context)
if err != nil {
return err
}

client, err := clusterConfig.GetClient()
if err != nil {
return err
}
client, err := clusterConfig.GetClient()
if err != nil {
return err
}

// This creates the educates-secrets namespace if it doesn't exist and creates the
// wildcard and CA secrets in there
if err = secrets.SyncLocalCachedSecretsToCluster(client); err != nil {
return err
}
// This creates the educates-secrets namespace if it doesn't exist and creates the
// wildcard and CA secrets in there
if err = secrets.SyncLocalCachedSecretsToCluster(client); err != nil {
return err
}

err = installer.Run(o.Version, o.PackageRepository, fullConfig, clusterConfig, o.Verbose, false, o.skipImageResolution, o.showChanges)
if err != nil {
return errors.Wrap(err, "educates could not be installed")
}
err = installer.Run(o.Version, o.PackageRepository, fullConfig, clusterConfig, o.Verbose, false, o.skipImageResolution, o.showChanges)
if err != nil {
return errors.Wrap(err, "educates could not be installed")
}

// This is for hugo livereload (educates serve-workshop). Reconfigures the loopback service
// We do create this loopback service for all providers except vcluster, as vcluster will map
// it's own service to the host's loopback service to use the host's single loopback service
if fullConfig.ClusterInfrastructure.Provider != "vcluster" {
if err = cluster.CreateLoopbackService(client, fullConfig.ClusterIngress.Domain); err != nil {
return err
}
// This is for hugo livereload (educates serve-workshop). Reconfigures the loopback service
// We do create this loopback service for all providers except vcluster, as vcluster will map
// it's own service to the host's loopback service to use the host's single loopback service
if fullConfig.ClusterInfrastructure.Provider != "vcluster" {
if err = cluster.CreateLoopbackService(client, fullConfig.ClusterIngress.Domain); err != nil {
return err
}

fmt.Println("\nEducates has been installed succesfully")
}

fmt.Println("\nEducates has been installed succesfully")

return nil
}

Expand All @@ -143,12 +130,6 @@ func (p *ProjectInfo) NewAdminPlatformDeployCmd() *cobra.Command {
Example: adminPlatformDeployExample,
}

c.Flags().BoolVar(
&o.Delete,
"delete",
false,
"Should educates be deleted",
)
c.Flags().StringVar(
&o.Config,
"config",
Expand Down

0 comments on commit 42aa0f0

Please sign in to comment.