-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates to platform deployment using CLI. (#423)
* Portal credentials/clients settings not passed through. * Rename CLI commands for deploying Educates platform. * Updating naming for makefile targets to install platform in local cluster. * Add distinct platform delete command. * Remove unnecessary options for delete. * Create means to get true default installation config.
- Loading branch information
1 parent
0043a7a
commit 805b406
Showing
17 changed files
with
157 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"k8s.io/kubectl/pkg/util/templates" | ||
) | ||
|
||
func (p *ProjectInfo) NewAdminPlatformCmdGroup() *cobra.Command { | ||
var c = &cobra.Command{ | ||
Use: "platform", | ||
Short: "Manage Educates installation", | ||
} | ||
|
||
// Use a command group as it allows us to dictate the order in which they | ||
// are displayed in the help message, as otherwise they are displayed in | ||
// sort order. | ||
|
||
commandGroups := templates.CommandGroups{ | ||
{ | ||
Message: "Available Commands:", | ||
Commands: []*cobra.Command{ | ||
p.NewAdminPlatformDeployCmd(), | ||
p.NewAdminPlatformDeleteCmd(), | ||
}, | ||
}, | ||
} | ||
|
||
commandGroups.Add(c) | ||
|
||
templates.ActsAsRootCommand(c, []string{"--help"}, commandGroups...) | ||
|
||
return c | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/pkg/errors" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/vmware-tanzu-labs/educates-training-platform/client-programs/pkg/cluster" | ||
"github.com/vmware-tanzu-labs/educates-training-platform/client-programs/pkg/config" | ||
"github.com/vmware-tanzu-labs/educates-training-platform/client-programs/pkg/installer" | ||
) | ||
|
||
type PlatformDeleteOptions struct { | ||
KubeconfigOptions | ||
Verbose bool | ||
} | ||
|
||
func (o *PlatformDeleteOptions) Run() error { | ||
fullConfig := config.NewDefaultInstallationConfig() | ||
|
||
installer := installer.NewInstaller() | ||
|
||
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") | ||
|
||
return nil | ||
} | ||
|
||
func (p *ProjectInfo) NewAdminPlatformDeleteCmd() *cobra.Command { | ||
var o PlatformDeleteOptions | ||
|
||
var c = &cobra.Command{ | ||
Args: cobra.NoArgs, | ||
Use: "delete", | ||
Short: "Delete Educates and related cluster services from your cluster", | ||
RunE: func(cmd *cobra.Command, _ []string) error { | ||
return o.Run() | ||
}, | ||
} | ||
|
||
c.Flags().StringVar( | ||
&o.Kubeconfig, | ||
"kubeconfig", | ||
"", | ||
"kubeconfig file to use instead of $KUBECONFIG or $HOME/.kube/config", | ||
) | ||
c.Flags().StringVar( | ||
&o.Context, | ||
"context", | ||
"", | ||
"Context to use from Kubeconfig", | ||
) | ||
c.Flags().BoolVar( | ||
&o.Verbose, | ||
"verbose", | ||
false, | ||
"print verbose output", | ||
) | ||
|
||
return c | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.