-
Notifications
You must be signed in to change notification settings - Fork 121
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 credential-get hook tool #186
Comments
This is somewhat related to #532 where "is my charm trusted" isn't modelling in ops. |
This definitely seems worth modelling in ops to avoid people implementing it themselves. Tony linked to a GitHub search showing a bunch of places that charms use We'd probably want to make the return type a dataclass of some kind, but there's a map/dict of cloud-specific attributes that we'd keep as a dict (don't want to go to the level of having cloud-specific code in ops just to get better typing). We'll look at doing this in 24.04. |
I have done some research and found that:
{
"type": "lxd",
"name": "localhost",
"region": "localhost",
"endpoint": "https://10.76.251.1:8443",
"credential": {
"auth-type": "certificate",
"attrs": {
"client-cert": "...",
"client-key": "...",
"server-cert": "..."
}
},
"is-controller-cloud": true
} Due to resource limitation, I didn't test on Azure or any other cloud; only with AWS/LXD. Based on the differences between different clouds, my temporary conclusion is that the
class CloudSpec:
"""Cloud information (metadata)."""
def __init__(self,
type: str,
name: str,
region: Optional[str],
endpoint: Optional[str],
isControllerCloud: Optional[str],
credential: Optional[Dict[str, Any]],
identityEndpoint: Optional[str],
storageEndpoint: Optional[str],
caACertificates: Optional[List[str]],
skipTLSVerify: Optional[bool],
):
pass I prefer the second one because:
After the investigation, I propose the following design:
Please review, upon approval I'll start working on this issue. |
Excellent summary!
This is the most compelling argument for me. I agree that if Juju is modelling it then ops should do that as well. |
Excellent, thanks. Seems reasonable, and I think copying those structs in Juju is a good idea (as dataclasses). It looks like the "credential" field should itself be a nested object with Actually, I wonder if we should call the top-level API method Should it be Let's also make sure we use Pythonic names with underscores, like |
|
Also, because we want charmers to be able to test
|
chore: limit Scenario 6 to use ops 2.12-2.16
credential-get
hook tool is used by k8s cloud integrator charms (OpenStack, AWS, GCP, Azure etc.) to get access to cloud credentials via a Juju controller.https://jaas.ai/docs/deploying-advanced-applications#heading--trusting-an-application-with-a-credential
https://github.com/juju/juju/blob/juju-2.7.4/worker/uniter/runner/jujuc/credential-get.go
E.g. OpenStack Integrator:
https://github.com/juju-solutions/charm-openstack-integrator/blob/101913504d047a1b4b9b6c4dcfb901d66fd9399e/lib/charms/layer/openstack.py#L38-L70
This needs to be modeled in the framework so that this class of charms can be written with the operator framework.
The text was updated successfully, but these errors were encountered: