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

Chore: Replace entity GRN with infra/grn GRN #74198

Merged
merged 1 commit into from
Aug 31, 2023
Merged

Chore: Replace entity GRN with infra/grn GRN #74198

merged 1 commit into from
Aug 31, 2023

Conversation

DanCech
Copy link
Collaborator

@DanCech DanCech commented Aug 31, 2023

This PR replaces the entity definition of GRN with the definition from the infra/grn package, and updates the infra/grn package to use a proto definition so that we can import it into the entity proto definition. This allows us to have a single unified understanding of what a GRN is.

To support this I did have to change infra/grn somewhat, the main changes being to use pointers to the GRN structs so that we aren't copying the internal mutexes used by protobuf, and changing the String function to ToGRNString because proto defines String already.

@DanCech DanCech requested review from a team as code owners August 31, 2023 15:15
@DanCech DanCech requested a review from a team August 31, 2023 15:15
@DanCech DanCech requested a review from a team as a code owner August 31, 2023 15:15
@DanCech DanCech requested review from marefr, oshirohugo, mildwonkey, suntala and yangkb09 and removed request for a team August 31, 2023 15:15
@DanCech DanCech changed the title replace entity GRN with infra/grn GRN Chore: Replace entity GRN with infra/grn GRN Aug 31, 2023
@grafana-delivery-bot grafana-delivery-bot bot added this to the 10.2.x milestone Aug 31, 2023
Comment on lines +266 to +268
bash pkg/plugins/backendplugin/secretsmanagerplugin/generate.sh
bash pkg/services/store/entity/generate.sh
bash pkg/infra/grn/generate.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we maybe have a script that find's all .proto files and applies protoc command to them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is some nuance to the generate.sh files right now, but we could potentially do something like that if we can resolve the differences that we need currently. That sounds like a separate PR though ;)

Comment on lines +11 to +19
int64 TenantID = 1;

// The kind of resource being identified, for e.g. "dashboard" or "user".
// The caller is responsible for validating the value.
string ResourceKind = 3;

// ResourceIdentifier is used by the underlying service to identify the
// resource.
string ResourceIdentifier = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is a relatively new and unexposed message - why do we use 1, 3 and 4 and skip the 2 for field IDs?

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 opted to stay consistent with the fields in the entity GRN definition, in theory at least this is wire-compatible even though the field names are different.

Copy link
Contributor

@mildwonkey mildwonkey left a comment

Choose a reason for hiding this comment

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

LGTM! (I also quite appreciate ResourceKind and ResourceIdentifier, I find those much clearer)

@DanCech DanCech merged commit 85a207f into main Aug 31, 2023
28 checks passed
@DanCech DanCech deleted the infra-grn branch August 31, 2023 19:43
chauchausoup pushed a commit to chauchausoup/grafana that referenced this pull request Sep 15, 2023
rwwiv pushed a commit that referenced this pull request Oct 2, 2023
replace entity GRN with infra/grn GRN
@zerok zerok modified the milestones: 10.2.x, 10.2.0 Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants