@@ -20,9 +20,9 @@ import (
2020 ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
2121 "github.com/replicatedhq/embedded-cluster/kinds/types"
2222 "github.com/replicatedhq/embedded-cluster/operator/charts"
23- "github.com/replicatedhq/embedded-cluster/pkg/addons2 "
24- "github.com/replicatedhq/embedded-cluster/pkg/addons2 /adminconsole"
25- "github.com/replicatedhq/embedded-cluster/pkg/addons2 /embeddedclusteroperator"
23+ "github.com/replicatedhq/embedded-cluster/pkg/addons "
24+ "github.com/replicatedhq/embedded-cluster/pkg/addons /adminconsole"
25+ "github.com/replicatedhq/embedded-cluster/pkg/addons /embeddedclusteroperator"
2626 "github.com/replicatedhq/embedded-cluster/pkg/airgap"
2727 "github.com/replicatedhq/embedded-cluster/pkg/config"
2828 "github.com/replicatedhq/embedded-cluster/pkg/configutils"
@@ -54,7 +54,7 @@ import (
5454 "sigs.k8s.io/yaml"
5555)
5656
57- type Install2CmdFlags struct {
57+ type InstallCmdFlags struct {
5858 adminConsolePassword string
5959 adminConsolePort int
6060 airgapBundle string
@@ -78,18 +78,18 @@ type Install2CmdFlags struct {
7878 cidrCfg * CIDRConfig
7979}
8080
81- // Install2Cmd returns a cobra command for installing the embedded cluster.
81+ // InstallCmd returns a cobra command for installing the embedded cluster.
8282// This is the upcoming version of install without the operator and where
8383// install does all of the work. This is a hidden command until it's tested
8484// and ready.
85- func Install2Cmd (ctx context.Context , name string ) * cobra.Command {
86- var flags Install2CmdFlags
85+ func InstallCmd (ctx context.Context , name string ) * cobra.Command {
86+ var flags InstallCmdFlags
8787
8888 cmd := & cobra.Command {
8989 Use : "install" ,
9090 Short : fmt .Sprintf ("Install %s" , name ),
9191 PreRunE : func (cmd * cobra.Command , args []string ) error {
92- if err := preRunInstall2 (cmd , & flags ); err != nil {
92+ if err := preRunInstall (cmd , & flags ); err != nil {
9393 return err
9494 }
9595
@@ -102,7 +102,7 @@ func Install2Cmd(ctx context.Context, name string) *cobra.Command {
102102 clusterID := metrics .ClusterID ()
103103 metricsReporter := NewInstallReporter (flags .license , clusterID , cmd .CalledAs ())
104104 metricsReporter .ReportInstallationStarted (ctx )
105- if err := runInstall2 (cmd .Context (), name , flags , metricsReporter ); err != nil {
105+ if err := runInstall (cmd .Context (), name , flags , metricsReporter ); err != nil {
106106 metricsReporter .ReportInstallationFailed (ctx , err )
107107 return err
108108 }
@@ -123,7 +123,7 @@ func Install2Cmd(ctx context.Context, name string) *cobra.Command {
123123 return cmd
124124}
125125
126- func addInstallFlags (cmd * cobra.Command , flags * Install2CmdFlags ) error {
126+ func addInstallFlags (cmd * cobra.Command , flags * InstallCmdFlags ) error {
127127 cmd .Flags ().StringVar (& flags .airgapBundle , "airgap-bundle" , "" , "Path to the air gap bundle. If set, the installation will complete without internet access." )
128128 cmd .Flags ().StringVar (& flags .dataDir , "data-dir" , ecv1beta1 .DefaultDataDir , "Path to the data directory" )
129129 cmd .Flags ().IntVar (& flags .localArtifactMirrorPort , "local-artifact-mirror-port" , ecv1beta1 .DefaultLocalArtifactMirrorPort , "Port on which the Local Artifact Mirror will be served" )
@@ -157,7 +157,7 @@ func addInstallFlags(cmd *cobra.Command, flags *Install2CmdFlags) error {
157157 return nil
158158}
159159
160- func addInstallAdminConsoleFlags (cmd * cobra.Command , flags * Install2CmdFlags ) error {
160+ func addInstallAdminConsoleFlags (cmd * cobra.Command , flags * InstallCmdFlags ) error {
161161 cmd .Flags ().StringVar (& flags .adminConsolePassword , "admin-console-password" , "" , "Password for the Admin Console" )
162162 cmd .Flags ().IntVar (& flags .adminConsolePort , "admin-console-port" , ecv1beta1 .DefaultAdminConsolePort , "Port on which the Admin Console will be served" )
163163 cmd .Flags ().StringVarP (& flags .licenseFile , "license" , "l" , "" , "Path to the license file" )
@@ -169,7 +169,7 @@ func addInstallAdminConsoleFlags(cmd *cobra.Command, flags *Install2CmdFlags) er
169169 return nil
170170}
171171
172- func preRunInstall2 (cmd * cobra.Command , flags * Install2CmdFlags ) error {
172+ func preRunInstall (cmd * cobra.Command , flags * InstallCmdFlags ) error {
173173 if os .Getuid () != 0 {
174174 return fmt .Errorf ("install command must be run as root" )
175175 }
@@ -228,7 +228,7 @@ func preRunInstall2(cmd *cobra.Command, flags *Install2CmdFlags) error {
228228 return nil
229229}
230230
231- func runInstall2 (ctx context.Context , name string , flags Install2CmdFlags , metricsReporter preflights.MetricsReporter ) error {
231+ func runInstall (ctx context.Context , name string , flags InstallCmdFlags , metricsReporter preflights.MetricsReporter ) error {
232232 if err := runInstallVerifyAndPrompt (ctx , name , & flags ); err != nil {
233233 return err
234234 }
@@ -329,7 +329,7 @@ func runInstall2(ctx context.Context, name string, flags Install2CmdFlags, metri
329329 defer hcli .Close ()
330330
331331 logrus .Debugf ("installing addons" )
332- if err := addons2 .Install (ctx , hcli , addons2 .InstallOptions {
332+ if err := addons .Install (ctx , hcli , addons .InstallOptions {
333333 AdminConsolePwd : flags .adminConsolePassword ,
334334 License : flags .license ,
335335 IsAirgap : flags .airgapBundle != "" ,
@@ -373,7 +373,7 @@ func runInstall2(ctx context.Context, name string, flags Install2CmdFlags, metri
373373 return nil
374374}
375375
376- func runInstallVerifyAndPrompt (ctx context.Context , name string , flags * Install2CmdFlags ) error {
376+ func runInstallVerifyAndPrompt (ctx context.Context , name string , flags * InstallCmdFlags ) error {
377377 logrus .Debugf ("checking if k0s is already installed" )
378378 err := verifyNoInstallation (name , "reinstall" )
379379 if err != nil {
@@ -415,7 +415,7 @@ func runInstallVerifyAndPrompt(ctx context.Context, name string, flags *Install2
415415 return nil
416416}
417417
418- func ensureAdminConsolePassword (flags * Install2CmdFlags ) error {
418+ func ensureAdminConsolePassword (flags * InstallCmdFlags ) error {
419419 if flags .adminConsolePassword == "" {
420420 // no password was provided
421421 if flags .assumeYes {
@@ -898,7 +898,7 @@ func waitForK0s() error {
898898 }
899899}
900900
901- func recordInstallation (ctx context.Context , kcli client.Client , flags Install2CmdFlags , k0sCfg * k0sv1beta1.ClusterConfig , disasterRecoveryEnabled bool ) (* ecv1beta1.Installation , error ) {
901+ func recordInstallation (ctx context.Context , kcli client.Client , flags InstallCmdFlags , k0sCfg * k0sv1beta1.ClusterConfig , disasterRecoveryEnabled bool ) (* ecv1beta1.Installation , error ) {
902902 loading := spinner .Start ()
903903 defer loading .Close ()
904904 loading .Infof ("Creating types" )
@@ -1061,7 +1061,7 @@ func createVersionMetadataConfigmap(ctx context.Context, kcli client.Client) err
10611061// when deploying them.
10621062func gatherVersionMetadata (withChannelRelease bool ) (* types.ReleaseMetadata , error ) {
10631063 versionsMap := map [string ]string {}
1064- for name , version := range addons2 .Versions () {
1064+ for name , version := range addons .Versions () {
10651065 versionsMap [name ] = version
10661066 }
10671067 if withChannelRelease {
@@ -1108,7 +1108,7 @@ func gatherVersionMetadata(withChannelRelease bool) (*types.ReleaseMetadata, err
11081108 Artifacts : artifacts ,
11091109 }
11101110
1111- chtconfig , repconfig , err := addons2 .GenerateChartConfigs ()
1111+ chtconfig , repconfig , err := addons .GenerateChartConfigs ()
11121112 if err != nil {
11131113 return nil , fmt .Errorf ("unable to generate chart configs: %w" , err )
11141114 }
@@ -1128,12 +1128,12 @@ func gatherVersionMetadata(withChannelRelease bool) (*types.ReleaseMetadata, err
11281128
11291129 k0sCfg := config .RenderK0sConfig ()
11301130 meta .K0sImages = config .ListK0sImages (k0sCfg )
1131- meta .K0sImages = append (meta .K0sImages , addons2 .GetAdditionalImages ()... )
1131+ meta .K0sImages = append (meta .K0sImages , addons .GetAdditionalImages ()... )
11321132 meta .K0sImages = helpers .UniqueStringSlice (meta .K0sImages )
11331133 sort .Strings (meta .K0sImages )
11341134
11351135 meta .Images = config .ListK0sImages (k0sCfg )
1136- meta .Images = append (meta .Images , addons2 .GetImages ()... )
1136+ meta .Images = append (meta .Images , addons .GetImages ()... )
11371137 meta .Images = append (meta .Images , versions .LocalArtifactMirrorImage )
11381138 meta .Images = helpers .UniqueStringSlice (meta .Images )
11391139 sort .Strings (meta .Images )
0 commit comments