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] v4/sync/etcd - add username/password options #41

Open
dbereza-machinify opened this issue Aug 9, 2022 · 2 comments
Open

[FEATURE] v4/sync/etcd - add username/password options #41

dbereza-machinify opened this issue Aug 9, 2022 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@dbereza-machinify
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently, the v4/sync/etcd plugin does not allow passing in a username/password for RBAC authentication with etcd, either embedded in the endpoint URL or as separate custom options.

Describe the solution you'd like
The etcd client library expects the username/password for RBAC authentication passed in the config, which is being defined here:

c, err := clientv3.New(clientv3.Config{
Endpoints: endpoints,
TLS: options.TLSConfig,
})

Currently, the username / password are not being defined here, and embedding the username/password into the endpoint URL does not cause the etcd client to parse them out and use them for RBAC auth.

As such, the username/password could be parsed out of the sync.Nodes sync option, which isn't super ideal, or new etcd-specific credential options could be created and stored/retrieved from the option context.

Additional context
N/A

@xpunch
Copy link
Contributor

xpunch commented Aug 11, 2022

func Auth(username, password string) registry.Option {
return func(o *registry.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, authKey{}, &authCreds{Username: username, Password: password})
}
}

Hope this can be helpful.

@dbereza-machinify
Copy link
Contributor Author

Yep yep, thanks!

I was hoping to use that same code once the Context option was added to the sync interface, for consistency :)

@xpunch xpunch added enhancement New feature or request help wanted Extra attention is needed labels Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants