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

CLOUDP-280230: Network peering translation layer #1884

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

josvazg
Copy link
Collaborator

@josvazg josvazg commented Oct 23, 2024

All Submissions:

  • Have you signed our CLA?

@josvazg josvazg marked this pull request as draft October 23, 2024 15:49
Including fuzzing based conversion testing

Signed-off-by: jose.vazquez <[email protected]>
@josvazg josvazg force-pushed the CLOUDP-280230/net-peering-crd branch from 78de4b3 to 23da286 Compare October 23, 2024 16:05
VnetName: pointer.SetOrNil(peer.VNetName, ""),
}
default:
panic(fmt.Errorf("unsupported provider %q", peer.ProviderName))
Copy link
Collaborator

Choose a reason for hiding this comment

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

i am sceptical this should panic 🤔 are we really considering this being a programmatic error?

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 am on the fence as well. There are 2 ways to hit this:

  1. Our validation fails to filter the provider name in the CRD.
  2. Atlas sends an incorrect value.

For the first one we could panic, is our fault. But for the second, I guess we should error out instead.

Copy link
Collaborator

@s-urbaniak s-urbaniak Oct 24, 2024

Choose a reason for hiding this comment

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

@josvazg given this is driven by user input or Atlas responses I am in strong favor of returning an error.

A panic is valid if for we wire things incorrectly internally, i.e. use the "wrong indexer name" or something like that. But anything that arrives "via wire" from the user or Atlas to AKO shouldn't panic unless there are very very strong reasons.

Copy link
Collaborator

@s-urbaniak s-urbaniak Oct 24, 2024

Choose a reason for hiding this comment

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

Our validation fails to filter the provider name in the CRD.

If we apply the rule I mentioned above this shouldn't panic as the provider name is returned from Atlas, aka it arrived externally to us.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Atlas sends an incorrect value.

same rule as above. This is Atlas output, not an internal wiring error, it shouldn't panic.

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 will introduce an error return value and change all the code accordingly.

@josvazg
Copy link
Collaborator Author

josvazg commented Oct 24, 2024

CLOUDP-280230

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.

2 participants