-
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
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
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.
You can make them "safe" using SecretStr
from pydantic but I don't recommend it b/c users of this library would have to change to access them.
thing.client_token.get_secret_value()
@@ -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
ops/setup.py
Outdated
@@ -22,7 +22,7 @@ | |||
keywords=["juju", "charming", "kubernetes", "ops", "framework", "interface"], | |||
name="ops.interface_kube_control", | |||
packages=find_namespace_packages(include=["ops.*"]), | |||
url="https://github.com/juju-solutions/interface-kube-control/blob/HEAD/ops", | |||
url="https://github.com/charmed-kubernetes/interface-kube-control/blob/HEAD/ops", |
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.
Uh... no let's leave it pointing at the original for the time being
If we need to move the archived repo to the canonical
org so be it...
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.
There are reasons -- but this ck fork should remain a "fork" for historical reasons
I think we should move towards a well defined schema for the interfaces. |
Overview
juju-solutions
withcharmed-kubernetes
in the URL of the setup file.AuthCredentials