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(GCPVpcPeering) Delete VPC Peering #323

Merged
merged 2 commits into from
Aug 7, 2024

Conversation

bru-jer-work
Copy link
Contributor

Description

Changes proposed in this pull request:

  • Small refactor on existing GCP VPC Peering
  • Delete VPC Peering on SKR
  • Delete VPC Peering on KCP

@bru-jer-work bru-jer-work requested a review from a team as a code owner July 5, 2024 14:25
@kyma-bot kyma-bot added cla: yes Indicates the PR's author has signed the CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 5, 2024
@bru-jer-work bru-jer-work force-pushed the gcp-vpcpeering-delete branch from 021990d to 23051e3 Compare July 30, 2024 10:32
@kyma-bot kyma-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 30, 2024
@bru-jer-work bru-jer-work force-pushed the gcp-vpcpeering-delete branch 2 times, most recently from 9c5ba79 to 5da24fe Compare July 30, 2024 10:38
logger := composed.LoggerFromCtx(ctx)

if state.kymaVpcPeering != nil {
return nil, ctx
Copy link
Contributor

Choose a reason for hiding this comment

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

not a big deal but you can return nil, nil since ctx is not modified and avoid unnecessary ctx assignmet in

# pkg/composed/action.go
if nextCtx != nil {
	currentCtx = nextCtx
}

@bru-jer-work bru-jer-work force-pushed the gcp-vpcpeering-delete branch 2 times, most recently from 11bfbdf to d52c95b Compare August 2, 2024 16:11
@bru-jer-work bru-jer-work force-pushed the gcp-vpcpeering-delete branch from d52c95b to 22624b8 Compare August 2, 2024 16:13
@bru-jer-work bru-jer-work requested review from a team and dushanpantic August 2, 2024 16:18
Copy link
Contributor

@dushanpantic dushanpantic left a comment

Choose a reason for hiding this comment

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

LGTM

return fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/global/networks/%s", project, vpc)
}

func (s *vpcPeeringStore) CreateRemoteVpcPeering(ctx context.Context, remotePeeringName string, remoteVpc string, remoteProject string, importCustomRoutes bool, kymaProject string, kymaVpc string) (*compute.Operation, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (s *vpcPeeringStore) CreateRemoteVpcPeering(ctx context.Context, remotePeeringName string, remoteVpc string, remoteProject string, importCustomRoutes bool, kymaProject string, kymaVpc string) (*compute.Operation, error) {
func (s *vpcPeeringStore) CreateRemoteVpcPeering(ctx context.Context, remotePeeringName string, remoteVpc string, remoteProject string, importCustomRoutes bool, kymaProject string, kymaVpc string) (error) {

Is operation used anywhere? If not, perhaps we can omit returning it all together

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, in the beginning I was using the operation instead of each peering object and checking if it was done or not but now we don't need it for anything else. I am doing some tests with the guid on the kyma as the peeringName and will remove these :) Thanks for the heads up

return new(compute.Operation), nil
}

func (s *vpcPeeringStore) CreateKymaVpcPeering(ctx context.Context, remotePeeringName string, remoteVpc string, remoteProject string, importCustomRoutes bool, kymaProject string, kymaVpc string) (*compute.Operation, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (s *vpcPeeringStore) CreateKymaVpcPeering(ctx context.Context, remotePeeringName string, remoteVpc string, remoteProject string, importCustomRoutes bool, kymaProject string, kymaVpc string) (*compute.Operation, error) {
func (s *vpcPeeringStore) CreateKymaVpcPeering(ctx context.Context, remotePeeringName string, remoteVpc string, remoteProject string, importCustomRoutes bool, kymaProject string, kymaVpc string) (error) {

@kyma-bot kyma-bot added the lgtm Looks good to me! label Aug 7, 2024
@kyma-bot kyma-bot merged commit cf4a44b into kyma-project:main Aug 7, 2024
7 checks passed
@bru-jer-work bru-jer-work deleted the gcp-vpcpeering-delete branch August 7, 2024 10:25
@bru-jer-work bru-jer-work mentioned this pull request Aug 21, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates the PR's author has signed the CLA. lgtm Looks good to me! size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants