Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Rename Group to ShortGroup and allow empty short group #144

Merged
merged 4 commits into from
Nov 17, 2021

Conversation

muvaf
Copy link
Member

@muvaf muvaf commented Nov 15, 2021

Description of your changes

Group is actually the full API group like ec2.aws.crossplane.io but it seems like the content we're expecting there is not of that form, so I changed its name. Also, I added a logic to allow "" short group so that some resources can be in provider level group, like ResourceGroup in Azure where it should be in tfazure.crossplane.io.

I have:

  • Read and followed Crossplane's [contribution process].
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

N/A

…ys what it does more precisely

Signed-off-by: Muvaffak Onus <me@muvaf.com>
…hortGroupName

Signed-off-by: Muvaffak Onus <me@muvaf.com>
…e gosec does not accept them

Signed-off-by: Muvaffak Onus <me@muvaf.com>
Copy link
Collaborator

@ulucinar ulucinar left a comment

Choose a reason for hiding this comment

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

Thanks @muvaf for the PR. I have consumed these changes in crossplane-contrib/provider-jet-azure#83. Below are some minor comments for your consideration.

pkg/config/provider.go Outdated Show resolved Hide resolved
// For example, ShortGroup could be `ec2` where group suffix of the
// provider is `aws.crossplane.io` and in that case, the full group would
// be `ec2.aws.crossplane.io`
ShortGroup string
Copy link
Collaborator

Choose a reason for hiding this comment

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

ShortGroup is fine but we can also consider something like GroupPrefix as its name. From a "Short" version, I expect something that substitutes a longer version of it, like in the context of command-line options, "-d" being a substitute for "--debug".

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, in fact, it substitutes the longer version, i.e. ec2 for ec2.aws.crossplane.io. But I don't love ShortGroup either. Group only is misleading because the actual group is ec2.aws.crossplane.io.

The main motivation was that I didn't want to treat those two fields (GroupPrefix and GroupSuffix) as pure strings with those names because the concatenation we're doing now is not simply prepending anymore; we're opening a new group under the root group if short group is given. Open to suggestions for the name.

pkg/pipeline/run.go Show resolved Hide resolved
for group, versions := range resourcesGroups {
for shortGroup, versions := range resourcesGroups {
group := pc.RootGroup
if shortGroup != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can consider trimming before comparison and concatenation.

Copy link
Member Author

Choose a reason for hiding this comment

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

As synced, we can treat this as developer error if there is space there.

…g suffix anymore

Signed-off-by: Muvaffak Onus <me@muvaf.com>
@muvaf muvaf merged commit afc1cc3 into crossplane:main Nov 17, 2021
@muvaf muvaf deleted the groupstring branch November 17, 2021 10:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants