Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

gruyaume
Copy link
Contributor

@gruyaume gruyaume commented Jan 16, 2024

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:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that validate the behaviour of the software
  • I validated that new and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have bumped the version of the library

def _on_certificate_creation_request(self, event: CertificateCreationRequestEvent) -> None:
"""Handles certificate creation request event.

- Retrieves subject from CSR

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.

Copy link
Contributor Author

@gruyaume gruyaume Feb 1, 2024

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]

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?

Copy link
Contributor Author

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]

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?

Copy link
Contributor Author

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"

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?

Copy link
Contributor Author

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):

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?

Copy link
Contributor Author

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

Copy link

@wood-push-melon wood-push-melon left a comment

Choose a reason for hiding this comment

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

LGTM.

@gruyaume gruyaume closed this Feb 15, 2024
@gruyaume gruyaume deleted the charm-review branch April 11, 2024 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants