Skip to content

Commit c9104ea

Browse files
committed
address merge conflicts
1 parent 80f3811 commit c9104ea

2 files changed

Lines changed: 26 additions & 38 deletions

File tree

cmd/vclusterctl/cmd/platform/start.go

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ before running this command:
8787
}
8888

8989
func (cmd *StartCmd) Run(ctx context.Context) error {
90-
<<<<<<< HEAD
91-
// get version to deploy
92-
=======
9390
cfg := cmd.LoadedConfig(cmd.Log)
9491

9592
// Bootstrap defaults to insecure because the platform starts with a
@@ -98,14 +95,7 @@ func (cmd *StartCmd) Run(ctx context.Context) error {
9895
cfg.Platform.Insecure = true
9996
}
10097

101-
// automatically use docker mode if the driver is set to docker
102-
if cfg.Driver.Type == config.DockerDriver && !cmd.Docker {
103-
cmd.Log.Info("Automatically using --docker flag because driver is set to 'docker'")
104-
cmd.Docker = true
105-
}
106-
10798
// get the version to deploy
108-
>>>>>>> 1499106e9 (ENGPLAT-399 Add --secure flag for TLS verification (#3781))
10999
if cmd.Version == "latest" || cmd.Version == "" {
110100
cmd.Version = platform.MinimumVersionTag
111101
latestVersion, err := platform.LatestCompatibleVersion(ctx)
@@ -173,8 +163,10 @@ func (cmd *StartCmd) Run(ctx context.Context) error {
173163
}
174164
}
175165

176-
if err := cmd.ensureEmailWithDisclaimer(ctx, cmd.KubeClient, cmd.Namespace); err != nil {
177-
return err
166+
if !cmd.platformUsesNewActivationFlow(cmd.Version) {
167+
if err := cmd.ensureEmailWithDisclaimer(ctx, cmd.KubeClient, cmd.Namespace); err != nil {
168+
return err
169+
}
178170
}
179171

180172
return start.NewLoftStarter(cmd.StartOptions).Start(ctx)
@@ -222,6 +214,26 @@ func promptForEmail(emailAddress string) (string, error) {
222214
return emailAddress, nil
223215
}
224216

217+
// platformUsesNewActivationFlow checks if the platform version supports the new platform activation flow.
218+
//
219+
// The new platform activation flow is supported for the platform version 4.6.0-rc.8 and above.
220+
func (cmd *StartCmd) platformUsesNewActivationFlow(platformVersion string) bool {
221+
platformSemVerVersion, err := semver.ParseTolerant(platformVersion)
222+
if err != nil {
223+
cmd.Log.Warnf("Failed to parse platform version %s, falling back to the old platform activation flow with the admin email prompt", platformVersion)
224+
return false
225+
}
226+
227+
const minPlatformVersionWithNewActivationFlow = "4.6.0-rc.8"
228+
if platformSemVerVersion.GTE(semver.MustParse(minPlatformVersionWithNewActivationFlow)) {
229+
cmd.Log.Debugf("Platform version %s is greater than or equal to %s, platform is using the new activation flow, so skipping admin email prompt", platformVersion, minPlatformVersionWithNewActivationFlow)
230+
return true
231+
}
232+
233+
cmd.Log.Debugf("Platform version %s is not using the new activation flow, so admin email is required", platformVersion)
234+
return false
235+
}
236+
225237
func validateEmail(emailAddress string) error {
226238
if emailAddress == "" {
227239
return fmt.Errorf("admin email address is required")

pkg/cli/start/login.go

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ func (l *LoftStarter) login(url string) error {
5858
}
5959

6060
func (l *LoftStarter) loginViaCLI(url string) error {
61-
loginPath := "%s/auth/password/login"
62-
6361
loginRequest := types.PasswordLoginRequest{
6462
Username: defaultUser,
6563
Password: l.Password,
@@ -70,12 +68,6 @@ func (l *LoftStarter) loginViaCLI(url string) error {
7068
return err
7169
}
7270

73-
<<<<<<< HEAD
74-
loginRequestBuf := bytes.NewBuffer(loginRequestBytes)
75-
76-
tr := &http.Transport{
77-
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
78-
=======
7971
config := l.LoadedConfig(l.Log)
8072
httpClient := &http.Client{Transport: &http.Transport{
8173
TLSClientConfig: &tls.Config{InsecureSkipVerify: config.Platform.Insecure},
@@ -104,25 +96,9 @@ func (l *LoftStarter) loginViaCLI(url string) error {
10496
continue
10597
}
10698
break
107-
>>>>>>> 1499106e9 (ENGPLAT-399 Add --secure flag for TLS verification (#3781))
108-
}
109-
httpClient := &http.Client{Transport: tr}
110-
111-
resp, err := httpClient.Post(fmt.Sprintf(loginPath, url), "application/json", loginRequestBuf)
112-
if err != nil {
113-
return err
114-
}
115-
defer resp.Body.Close()
116-
117-
body, err := io.ReadAll(resp.Body)
118-
if err != nil {
119-
return err
12099
}
121-
122-
accessKey := &types.AccessKey{}
123-
err = json.Unmarshal(body, accessKey)
124-
if err != nil {
125-
return err
100+
if accessKey.AccessKey == "" {
101+
return fmt.Errorf("couldn't retrieve access key from platform to login")
126102
}
127103

128104
// log into loft

0 commit comments

Comments
 (0)