Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Remove authentication requirement for launchpad init#7

Merged
LucilleH merged 3 commits intomainfrom
lucille--auth
Nov 4, 2022
Merged

Remove authentication requirement for launchpad init#7
LucilleH merged 3 commits intomainfrom
lucille--auth

Conversation

@LucilleH
Copy link
Copy Markdown

@LucilleH LucilleH commented Nov 3, 2022

Summary

This is the first step towards removing auth requirement for most commands, starting with init.
Screen Shot 2022-11-03 at 11 53 19 AM

Screen Shot 2022-11-03 at 11 47 37 AM

Screen Shot 2022-11-03 at 11 48 08 AM

How was it tested?

cli-build
launchpad logout
launchpad init

Is this change backwards-compatible?

Yes

@ipince
Copy link
Copy Markdown
Contributor

ipince commented Nov 3, 2022

This seems less "remove auth from init" and more "provide a way for oss-launchpad users to upgrade into commercial launchpad".

I thought the former was already done (I didn't notice we were calling auth.Identify(), but we can just remove it). The latter seems like a new feature, which is nice.

@LucilleH LucilleH marked this pull request as ready for review November 3, 2022 19:22
@LucilleH LucilleH requested review from ipince and mikeland73 November 3, 2022 19:25
@LucilleH
Copy link
Copy Markdown
Author

LucilleH commented Nov 3, 2022

This seems less "remove auth from init" and more "provide a way for oss-launchpad users to upgrade into commercial launchpad".

I thought the former was already done

I thought so too. Apparently not 🤷‍♀️

Copy link
Copy Markdown
Contributor

@ipince ipince left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I don't know if I like where this is going. Left some comments. Might be worth talking in person

Comment thread padcli/command/initcmd.go
clusterNames = append(clusterNames, c.GetName())
}
// In case user wants to log in and use a jetpack managed cluster.
clusterNames = append(clusterNames, jetpackManagedCluster)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but, now we may have both jetpack-cloud and Jetpack managed cluster as options, which doesn't make sense.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we remove the Jetpack managed cluster option and then just indicate which clusters are jetpack-managed from the list of clusters we already have?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because if a commercial user is not logged in, we won't have the full set of clusters. By selecting Jetpack managed cluster we will drop them in the login flow, knowing that they are not OSS users.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we won't have the full set of clusters

but we will, because they were (likely) previously merged into their kubeconfig

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do have a full set, then they can simply select it from the previous question. I'll give you a full demo

Comment thread padcli/command/initcmd.go
return nil, errors.WithStack(err)
}
// Get all the cluster names again.
clusters, err := cmdOpts.ClusterProvider().GetAll(ctx)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... i think this kind of breaks the oss experience.. which im actually OK with, but want us to be aware of the breakage.

In OSS, GetAll() will only ever return what's in your kubeconfig. so.. let's say you have clusters A and B. Then the prompt will be:

What cluster?
> A
  B
  Jetpack managed cluster

And then if you select Jetpack-managed cluster, we will try to show you jetpack-managed clusters, but there won't be any because we're on OSS.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, in that case we skip the second question of displaying the jetpack-managed clusters, and ask them to run launchpad cluster create

Comment thread padcli/command/initcmd.go Outdated
}

// If no jetpack managed cluster exist, we default the answer to the only option available.
if len(clusterNames) == 1 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if len(clusterNames) == 0?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad code. Updated

@LucilleH LucilleH requested a review from ipince November 3, 2022 20:48
Copy link
Copy Markdown
Contributor

@ipince ipince left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@LucilleH LucilleH merged commit 5897818 into main Nov 4, 2022
@LucilleH LucilleH deleted the lucille--auth branch November 4, 2022 23:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants