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

Support role bootstrapping in OSS #7130

Closed
wants to merge 3 commits into from

Conversation

fspmarshall
Copy link
Contributor

Adds support for roles in the OSS variant of the --bootstrap flag. Supersedes #7036.

@fspmarshall fspmarshall force-pushed the fspmarshall/bootstrap-roles-oss branch from 2e9ceed to bb676af Compare June 1, 2021 18:20
@stefansedich
Copy link
Contributor

@fspmarshall I had a play around with this and it does not appear to be working with roles and the GH provider defined in the bootstrap files.

I am seeing a similar problem to #7134 where it creates the migrated github- roles as if I tctl create the provider before the roles.

@russjones
Copy link
Contributor

@fspmarshall Is this ready to review?

@russjones russjones modified the milestones: 7.0 "Stockholm", 7.1 Jul 16, 2021
@russjones russjones marked this pull request as draft September 1, 2021 17:22
@russjones russjones added the good-starter-issue Good starter issue to start contributing to Teleport label Sep 1, 2021
@russjones russjones modified the milestones: 7.1, 7.3 Sep 11, 2021
@russjones russjones modified the milestones: 7.3, 9.0 Oct 8, 2021
@russjones russjones marked this pull request as ready for review November 30, 2021 23:54
@@ -418,6 +418,25 @@ func init() {
return rsc, nil
})

RegisterResourceMarshaler(KindRole, func(r Resource, opts ...MarshalOption) ([]byte, error) {
rsc, ok := r.(Role)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe:

Suggested change
rsc, ok := r.(Role)
role, ok := r.(Role)

return raw, nil
})
RegisterResourceUnmarshaler(KindRole, func(b []byte, opts ...MarshalOption) (Resource, error) {
rsc, err := UnmarshalRole(b, opts...)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe (as above):

Suggested change
rsc, err := UnmarshalRole(b, opts...)
role, err := UnmarshalRole(b, opts...)

Comment on lines +53 to +54
err = ioutil.WriteFile(bootstrapFile, []byte(YAMLBootstrap), 0660)
require.NoError(t, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
err = ioutil.WriteFile(bootstrapFile, []byte(YAMLBootstrap), 0660)
require.NoError(t, err)
require.NoError(t, ioutil.WriteFile(bootstrapFile, []byte(YAMLBootstrap), 0660))

require.Equal(t, "start", cmd)
require.Equal(t, 2, len(conf.Auth.Resources))
require.Equal(t, "github", conf.Auth.Resources[0].GetKind())
require.Equal(t, "role", conf.Auth.Resources[1].GetKind())
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we do a deeper assertion at the resources or is this enough? (If yes, please leave a comment stating why.)

@espadolini
Copy link
Contributor

Replaced by #11175.

@espadolini espadolini closed this Mar 16, 2022
@espadolini espadolini deleted the fspmarshall/bootstrap-roles-oss branch March 16, 2022 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-starter-issue Good starter issue to start contributing to Teleport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants