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

GitHub Proxy part 2: git_server resource, service, and RBAC #49393

Merged
merged 8 commits into from
Nov 27, 2024

Conversation

greedy52
Copy link
Contributor

part of:

Sorry for the bit list of files. Mostly just boiler plate code for a new resource.

Resource yaml

kind: git_server
sub_kind: github
version: v2
spec:
  github:
    integration: github-my-org
    organization: my-org

Then:

$ tctl create -f resource_github_server.yaml
$ tctl get git_servers

@greedy52 greedy52 changed the title GitHub Proxy part 2: git_server and RBAC GitHub Proxy part 2: git_server resource, service, and RBAC Nov 24, 2024
@greedy52 greedy52 force-pushed the STeve/48762_git_server branch from 227c801 to 177eeec Compare November 25, 2024 01:45
@greedy52 greedy52 marked this pull request as ready for review November 25, 2024 17:12
@github-actions github-actions bot added size/lg tctl tctl - Teleport admin tool labels Nov 25, 2024
@github-actions github-actions bot requested a review from rudream November 25, 2024 17:12
@greedy52 greedy52 added the no-changelog Indicates that a PR does not require a changelog entry label Nov 25, 2024
lib/auth/gitserver/gitserverv1/service.go Outdated Show resolved Hide resolved
tool/tctl/common/resource_command.go Outdated Show resolved Hide resolved
tool/tctl/common/resource_command.go Outdated Show resolved Hide resolved
case types.KindGitServer:
var servers []types.Server

// TODO(greedy52) use unified resource request once available.
Copy link
Collaborator

Choose a reason for hiding this comment

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

JFYI - @tcsc is exposing Accounts for the Identity Center integration to unified resource view in #49301, we should use a common approach for all new resources we're adding.

api/proto/teleport/gitserver/v1/git_server_service.proto Outdated Show resolved Hide resolved
api/proto/teleport/legacy/types/types.proto Show resolved Hide resolved
Comment on lines +127 to +128
if serverV2, err := toServerV2(server); err != nil {
return nil, trace.Wrap(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

How this can happen

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it shouldn't. just safety check

lib/auth/gitserver/gitserverv1/service.go Show resolved Hide resolved
// CreateGitServerRequest is a request to create a Git server.
message CreateGitServerRequest {
// Server is the Git server to create.
types.ServerV2 server = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Theoretical question :-)
If there any possible way to not mix gogole proto with legacy deprecated gogo proto ?

Copy link
Contributor Author

@greedy52 greedy52 Nov 26, 2024

Choose a reason for hiding this comment

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

it's probably doable, i haven't tried. But i will have to do conversions back AND force in a LOT of places as git_server will rely on existing SSH transport. I prefer use the old type and keep backend consistent as the other server resources.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is types.ServerV2 leveraged for literally anything here? Is it planned to work for arbitrary git servers reached directly from the server?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it planned to work for arbitrary git servers reached directly from the server?

What do you mean?

Do you mean directly from the proxy server? there will be git agents eventually for private/self-hosted git services.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, the entire point of ServerV2 is that it has a bunch of fields that make sense for servers - so far, a git_server with subkind github is literally only using metadata and one field that was added to ServerSpecV2 that only makes sense in that exact scenario, so I was wondering if in the future we're planning to make use of ServerV2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i was thinking yes. For example, a git_server for self-hosted gitlab is basically a non-agentless SSH server that uses its own CA to sign.

I am open to switching git_server to its own type. What worries me more is whether I have to convert this type to satisfy the types.Server interface and/or refactor the SSH transport along the way.

What do you think?

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from rudream November 27, 2024 09:35
Copy link

🤖 Vercel preview here: https://docs-2kv7muz8t-goteleport.vercel.app/docs

@greedy52 greedy52 enabled auto-merge November 27, 2024 14:31
Copy link

🤖 Vercel preview here: https://docs-dk4vp5vo8-goteleport.vercel.app/docs

@public-teleport-github-review-bot

@greedy52 - this PR will require admin approval to merge due to its size. Consider breaking it up into a series smaller changes.

Copy link

🤖 Vercel preview here: https://docs-65k658emc-goteleport.vercel.app/docs

Copy link

🤖 Vercel preview here: https://docs-ng3o76b5d-goteleport.vercel.app/docs

@greedy52 greedy52 added this pull request to the merge queue Nov 27, 2024
Merged via the queue into master with commit fae535b Nov 27, 2024
43 checks passed
@greedy52 greedy52 deleted the STeve/48762_git_server branch November 27, 2024 16:30
@public-teleport-github-review-bot

@greedy52 See the table below for backport results.

Branch Result
branch/v17 Failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v17 no-changelog Indicates that a PR does not require a changelog entry size/lg tctl tctl - Teleport admin tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants