-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor AuthCredentials #3
base: main
Are you sure you want to change the base?
Conversation
juju-solutions
with charmed-kubernetes
in the URL
juju-solutions
with charmed-kubernetes
in the URLThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work Hue, I've got a few questions on the way we store the tokens.
kubelet_token: str | ||
proxy_token: str | ||
client_token: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these tokens going to be encoded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, I just created this model because I have personal issues with a type-unsafe dict :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'll be the go developer in you :D
@@ -139,3 +149,21 @@ def get_ca_certificate(self, model: ops.Model) -> Optional[bytes]: | |||
return secret.get_content(refresh=True)["ca-certificate"].encode() | |||
except ops.SecretNotFoundError: | |||
return None | |||
|
|||
|
|||
class AuthCredentials(BaseModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any tests around getting and setting these AuthCredentials?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is. The only thing that we use from that AuthCredentials
is the client_token
field, and that field is used to populate the token
in the created kubeconfig. We have a test covering it here: https://github.com/charmed-kubernetes/interface-kube-control/blob/main/ops/tests/unit/test_ops_requires.py#L157
Overview
juju-solutions
withcharmed-kubernetes
in the URL of the setup file.AuthCredentials