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
feat: Implements route53 lego k8s operator (do not merge) #38
Conversation
def _on_certificate_creation_request(self, event: CertificateCreationRequestEvent) -> None: | ||
"""Handles certificate creation request event. | ||
|
||
- Retrieves subject from CSR |
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.
Nitpick: Instead of commenting about what this event callback method does, I would say it would be better to make the code self-describe what it does. This method is kinda long so it can be decomposed to several small functions.
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.
The charm here is not an owner of this lib + the method is ~20 lines long and it already calls those "small functions". In any case, this is not a charm review criteria.
def _pull_certificates_from_workload(self, csr_subject: str) -> List[Union[bytes, str]]: | ||
"""Pulls certificates from workload container.""" | ||
chain_pem = self._container.pull(path=f"{self._certs_path}{csr_subject}.crt") | ||
return [cert for cert in chain_pem.read().split("\n\n")] # type: ignore[arg-type] |
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.
Nitpick: I am curious why this method returns a list and the caller has to use the index to get the certificate, ca, and chain. It would be better to directly make the return data ready.
Another question is: is the order guaranteed to be the same everytime?
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.
Again, this charm here is not a owner of this lib, we may want to change this but that does not feel like a charm review criteria
isort {[vars]all_path} | ||
black {[vars]all_path} | ||
|
||
[testenv:lint] |
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.
Nitpick: should we switch to ruff?
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.
Maybe in the future, but this is not a charm review criteria
raise_on_blocked=True, | ||
timeout=1000, | ||
) | ||
assert ops_test.model.applications[APP_NAME].units[0].workload_status == "active" |
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.
Is this still needed when we already wait for status to be active above?
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.
Will be addressed by PR #50
|
||
|
||
@pytest.mark.abort_on_fail | ||
async def test_build_and_deploy(ops_test): |
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.
Besides testing build and deployment, is it possible that we can also test the integration with a requirer charm?
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.
Will be addressed by PR #50
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.
LGTM.
Description
The goal of this PR is to help in the process of having this charm listed in Charmhub following the charm review process. Here is the link to the charm review request.
Please do not merge this PR.
Checklist: