Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: CLI user can run cf create-space successfully #147

Closed
gcapizzi opened this issue Sep 30, 2021 · 2 comments · Fixed by #241
Closed

[Feature]: CLI user can run cf create-space successfully #147

gcapizzi opened this issue Sep 30, 2021 · 2 comments · Fixed by #241
Assignees
Labels

Comments

@gcapizzi
Copy link
Contributor

gcapizzi commented Sep 30, 2021

Blockers/Dependencies

Background

As a developer
I want to create a space using the cf CLI
And automatically become a SpaceManager and SpaceDeveloper for the new space
So that I can manage apps in my space

Acceptance Criteria

GIVEN a cf-k8s-api instance exists
AND an organization exists
AND I have targeted the org with cf target -o <org-name>
WHEN I run cf create-space <space-name>
AND cf spaces
THEN I see the created space in the list

GIVEN a cf-k8s-api instance exists
AND an organization exists
WHEN I run cf create-space -o <org-name> <space-name>
AND cf target -o <org-name>
AND cf spaces
THEN I see the created space in the list

Dev Notes

  • The CLI will try to assign the OrgUser, SpaceManager and SpaceDeveloper roles to the user creating the space. This will in turn need a valid username returned by the CurrentUser() method in Config. This in turn will need a /whoami enpoint. We have discussed these things here and here.
@gcapizzi gcapizzi changed the title [Feature]: Admin can use the cf CLI to manage organizations and spaces [Feature]: Developer can cf create-space Oct 26, 2021
@akrishna90 akrishna90 transferred this issue from cloudfoundry/cf-k8s-api Nov 2, 2021
@gcapizzi gcapizzi added blocked and removed blocked labels Nov 8, 2021
@kieron-dev kieron-dev self-assigned this Nov 11, 2021
kieron-dev pushed a commit to eirini-forks/cli that referenced this issue Nov 11, 2021
Previously, CurrentUser[Name]() implementation was split in the config
area for standard CF and CF-on-k8s. It would have been great to update
the k8s version to call /whoami, but the cloud controller logic doesn't
seem to belong in the config area.

So instead, GetCurrentUser() has been added to the actor interface, and
also to the AuthActor interface. This has a standard CF and a k8s CF
implementation. The standard implementation just defers to the config
method, whereas the k8s implementation invokes the new /whoami endpoint
on the cloud controller.

This commit also introduces handling that endpoint.

Issue: cloudfoundry/korifi#147
kieron-dev pushed a commit to eirini-forks/cli that referenced this issue Nov 11, 2021
Previously, CurrentUser[Name]() implementation was split in the config
area for standard CF and CF-on-k8s. It would have been great to update
the k8s version to call /whoami, but the cloud controller logic doesn't
seem to belong in the config area.

So instead, GetCurrentUser() has been added to the actor interface, and
also to the AuthActor interface. This has a standard CF and a k8s CF
implementation. The standard implementation just defers to the config
method, whereas the k8s implementation invokes the new /whoami endpoint
on the cloud controller.

This commit also introduces handling that endpoint.

Issue: cloudfoundry/korifi#147
@kieron-dev
Copy link
Contributor

kieron-dev commented Nov 11, 2021

See commit eirini-forks/cli@e5d4155 for the comment and changes. This has passing tests. The branch is real-k8s-username.

I've changed the cmd.Config.CurrentUser() call to cmd.Actor.GetCurrentUser() in the v7 create_space_command, to get the self-contained integration test passing. It remains to change all ~150 invocations of Config.CurrentUser() to the actor variant in the other commands. This will mainly have the effect of showing the current k8s username in the output of the command.

It also remains to build the /whoami endpoint in the API.

kieron-dev pushed a commit to eirini-forks/cli that referenced this issue Nov 11, 2021
Previously, CurrentUser[Name]() implementation was split in the config
area for standard CF and CF-on-k8s. It would have been great to update
the k8s version to call /whoami, but the cloud controller logic doesn't
seem to belong in the config area.

So instead, GetCurrentUser() has been added to the actor interface, and
also to the AuthActor interface. This has a standard CF and a k8s CF
implementation. The standard implementation just defers to the config
method, whereas the k8s implementation invokes the new /whoami endpoint
on the cloud controller.

This commit also introduces handling that endpoint.

Issue: cloudfoundry/korifi#147
@mnitchev mnitchev assigned mnitchev and unassigned kieron-dev Nov 12, 2021
kieron-dev pushed a commit that referenced this issue Nov 15, 2021
This returns name and kind (i.e. User or ServiceAccount) for the given
token or client certificate passed in the auth header.

Required so the CF CLI can send the correct username in requests for
automatic role creation.

Issue: #147
Co-authored-by: Kieron Browne <[email protected]>
mnitchev added a commit that referenced this issue Nov 15, 2021
mnitchev added a commit that referenced this issue Nov 15, 2021
In cf-on-k8s, user username and guid will always be the same. We need to
accept either in the create-role payload.

Issue: #147
Co-authored-by: Kieron Browne <[email protected]>
@mnitchev mnitchev linked a pull request Nov 15, 2021 that will close this issue
@kieron-dev
Copy link
Contributor

PR in the CLI repo here: eirini-forks/cli#9

kieron-dev pushed a commit that referenced this issue Nov 17, 2021
kieron-dev pushed a commit that referenced this issue Nov 17, 2021
@gcapizzi gcapizzi changed the title [Feature]: Developer can cf create-space [Feature]: CLI user can run cf create-space successfully Nov 17, 2021
gcapizzi pushed a commit to eirini-forks/cli that referenced this issue Nov 18, 2021
Previously, CurrentUser[Name]() implementation was split in the config
area for standard CF and CF-on-k8s. It would have been great to update
the k8s version to call /whoami, but the cloud controller logic doesn't
seem to belong in the config area.

So instead, GetCurrentUser() has been added to the actor interface, and
also to the AuthActor interface. This has a standard CF and a k8s CF
implementation. The standard implementation just defers to the config
method, whereas the k8s implementation invokes the new /whoami endpoint
on the cloud controller.

This commit also introduces handling that endpoint.

Issue: cloudfoundry/korifi#147
gcapizzi added a commit to eirini-forks/cli that referenced this issue Nov 22, 2021
Previously, CurrentUser[Name]() implementation was split in the config
area for standard CF and CF-on-k8s. It would have been great to update
the k8s version to call /whoami, but the cloud controller logic doesn't
seem to belong in the config area.

So instead, GetCurrentUser() has been added to the actor interface, and
also to the AuthActor interface. This has a standard CF and a k8s CF
implementation. The standard implementation just defers to the config
method, whereas the k8s implementation invokes the new /whoami endpoint
on the cloud controller.

This commit also introduces handling that endpoint.

Issue: cloudfoundry/korifi#147
Co-authored-by: Giuseppe Capizzi <[email protected]>
Co-authored-by: Danail Branekov <[email protected]>
Co-authored-by: Giuseppe Capizzi <[email protected]>
danail-branekov pushed a commit that referenced this issue Nov 22, 2021
This returns name and kind (i.e. User or ServiceAccount) for the given
token or client certificate passed in the auth header.

Required so the CF CLI can send the correct username in requests for
automatic role creation.

Issue: #147
Co-authored-by: Kieron Browne <[email protected]>
danail-branekov pushed a commit that referenced this issue Nov 22, 2021
danail-branekov pushed a commit that referenced this issue Nov 22, 2021
In cf-on-k8s, user username and guid will always be the same. We need to
accept either in the create-role payload.

Issue: #147
Co-authored-by: Kieron Browne <[email protected]>
danail-branekov pushed a commit that referenced this issue Nov 22, 2021
danail-branekov pushed a commit that referenced this issue Nov 22, 2021
This returns name and kind (i.e. User or ServiceAccount) for the given
token or client certificate passed in the auth header.

Required so the CF CLI can send the correct username in requests for
automatic role creation.

Issue: #147
Co-authored-by: Kieron Browne <[email protected]>
danail-branekov pushed a commit that referenced this issue Nov 22, 2021
danail-branekov pushed a commit that referenced this issue Nov 22, 2021
In cf-on-k8s, user username and guid will always be the same. We need to
accept either in the create-role payload.

Issue: #147
Co-authored-by: Kieron Browne <[email protected]>
danail-branekov pushed a commit that referenced this issue Nov 22, 2021
@gcapizzi gcapizzi moved this to ✅ Done in Korifi - Backlog Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants