Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

Add type info to the AuthInfo object. #176

Merged
merged 2 commits into from
Jan 18, 2018

Conversation

perotinus
Copy link
Contributor

/sig multicluster

Fixes #169.

/cc @pmorie @madhusudancs @font
Please take a look at this; this is an API change and I want to make sure that we're happy with it, or that we have a chance to suggest more fields that should be in AuthProviderType.

@k8s-ci-robot k8s-ci-robot added sig/multicluster Categorizes an issue or PR as relevant to SIG Multicluster. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 16, 2018
@perotinus perotinus changed the title Authinfo Add type info to the AuthInfo object. Jan 16, 2018
@madhusudancs
Copy link
Contributor

Looks reasonable to me. Nothing controversial here.

@madhusudancs
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 16, 2018
@perotinus
Copy link
Contributor Author

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 17, 2018
// Config is a map of values that contains the information necessary for a
// client to determine how to authenticate to a Kubernetes API server.
// +optional
Config map[string]string
}

// AuthProviderType contains metadata about the auth provider. It should be used
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: This says metadata but it just contains the name right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true. However, I expect this object to potentially grow, and the name is technically "metadata", so I think I'd prefer to leave it like this, since it describes the of this object.

// Config is a map of values that contains the information necessary for a
// client to determine how to authenticate to a Kubernetes API server.
// +optional
Config map[string]string
}

// AuthProviderType contains metadata about the auth provider. It should be used
// by clients to differentiate between different kinds of auth providers, and so
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/so//?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I actually meant "to", not "so". Fixed.

type AuthProviderType struct {
// Name is the name of the auth provider.
// +optional
Name string
Copy link
Contributor

@font font Jan 17, 2018

Choose a reason for hiding this comment

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

If we don't add anything else to this, it seems somewhat similar to the AuthProviderConfig:Name field. That is, couldn't one use the AuthProviderConfig:Name field to designate the auth provider's name? It seems the example of a controller vs a user could still use the AuthProviderConfig:Name to find the relevant auth config.

Is this AuthProviderType addition still relevant if we consider making cluster namespace scoped?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think so. The idea of the Type field is that it specifically allows for repeated AuthProviders of one type with different info, and makes this more obvious than having that info in the bag of data. For example, imagine that you have an AuthProvider type that is "GCP service account". You can now have two different AuthProvider instances with that type, but with different names and representing different service accounts.

Also, my intention here is that this may expand in the future in a backwards-compatible way. For example, I could see adding a version field. I'd also rather people not try to squeeze this information into the name (e.g., gcp-service-account_foo, gcp-service-account-bar for two different AuthProviders). I think this field makes writing a plugin a bit easier as well, and provides a standard way to encode this. It's something that every AuthProvider object will need to do somehow, so making it top-level and typed seems like a reasonable thing to do.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! I was interested to hear your thoughts on this. I agree, I had thought that reusing an auth provider type in the top level config name would require overloading that name field quite a bit. I also think that explicitly specifying this AuthProviderType struct field makes it prescriptive so that users don't try to embed that sort of metadata in the Config map. Instead, this new field is where it should go.

Copy link
Contributor

@font font left a comment

Choose a reason for hiding this comment

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

/lgtm

type AuthProviderType struct {
// Name is the name of the auth provider.
// +optional
Name string
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! I was interested to hear your thoughts on this. I agree, I had thought that reusing an auth provider type in the top level config name would require overloading that name field quite a bit. I also think that explicitly specifying this AuthProviderType struct field makes it prescriptive so that users don't try to embed that sort of metadata in the Config map. Instead, this new field is where it should go.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: font, madhusudancs, perotinus

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:
  • OWNERS [font,madhusudancs,perotinus]

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@perotinus
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 18, 2018
@font
Copy link
Contributor

font commented Jan 18, 2018

/test pull-cluster-registry-verify-gosrc

@k8s-ci-robot k8s-ci-robot merged commit bfe22c6 into kubernetes-retired:master Jan 18, 2018
@perotinus perotinus deleted the authinfo branch January 26, 2018 01:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. sig/multicluster Categorizes an issue or PR as relevant to SIG Multicluster. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants