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

Openfga relation interface update 01 #12

Merged

Conversation

alesstimec
Copy link
Collaborator

Description

The what and why - include a summary of the change, describe what it does, and include relevant motivation and context.

Fixes JIRA/GitHub issue number

Engineering checklist

Check only items that apply

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

Test instructions

Notes for code reviewers

@alesstimec alesstimec force-pushed the openfga-relation-interface-update-01 branch from ae66259 to ca41991 Compare June 23, 2023 10:36
charms/openfga-k8s/lib/charms/openfga_k8s/v0/openfga.py Outdated Show resolved Hide resolved
charms/openfga-k8s/tox.ini Outdated Show resolved Hide resolved
Copy link
Contributor

@kian99 kian99 left a comment

Choose a reason for hiding this comment

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

Some things to address but otherwise looks good.

charms/openfga-k8s/lib/charms/openfga_k8s/v0/openfga.py Outdated Show resolved Hide resolved
self.state = PeerRelationState(self.model, self.app, "openfga-peer")
port_http = ServicePort(8080, name=f"{self.app.name}-http", protocol="TCP")
port_grpc = ServicePort(8081, name=f"{self.app.name}-grpc", protocol="TCP")
self.service_patcher = KubernetesServicePatch(self, [port_http, port_grpc])
Copy link
Contributor

Choose a reason for hiding this comment

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

I think Ali might have a way of handling multiple ingress ports without the K8ServicePatch now. Something for the future.

return

if not self._state.token_secret_id:
token = secrets.token_urlsafe(32)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this 32 bit? Should we make it a constant so it has a name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i don't know.. it think this is ok


self._create_token_secret(event)

# Quickly update logrotates config each workload update
Copy link
Contributor

Choose a reason for hiding this comment

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

It's python so arguably it won't be running quickly.

charms/openfga-k8s/src/charm.py Outdated Show resolved Hide resolved
charms/openfga-k8s/src/charm.py Outdated Show resolved Hide resolved
charms/openfga-k8s/tests/unit/test_charm.py Outdated Show resolved Hide resolved
@alesstimec alesstimec force-pushed the openfga-relation-interface-update-01 branch 4 times, most recently from 984dca5 to 4342f9c Compare June 26, 2023 13:36
charms/openfga-k8s/metadata.yaml Outdated Show resolved Hide resolved
logger.info("created token secret {}".format(secret.id))

@must_be_leader
@requires_state
Copy link
Contributor

Choose a reason for hiding this comment

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

Really like the decorators, very nice.

charms/openfga-k8s/tests/unit/test_charm.py Outdated Show resolved Hide resolved
@kian99
Copy link
Contributor

kian99 commented Jun 26, 2023

Oh and gentle reminder about committing without --amend --no-edit sometimes :D

- uses secrets to transfer tokens via relations
- updated to use the new state implementation
@alesstimec alesstimec force-pushed the openfga-relation-interface-update-01 branch from 4342f9c to e42aed7 Compare June 27, 2023 07:55
@alesstimec alesstimec merged commit 3d59d19 into canonical:main Jun 27, 2023
alesstimec added a commit to alesstimec/public-cs-openfga that referenced this pull request Jul 5, 2023
…rface-update-01

Openfga relation interface update 01
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.

3 participants