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

Additional nil checks during reference resolution #326

Merged
merged 2 commits into from
Apr 21, 2022

Conversation

vijtrip2
Copy link
Contributor

Description of changes:

  • This change adds additional nil checks for ReferencesConfig.Path during reference resolution
  • This change also fixes import order inside main.go.tpl
  • I thought of these improvements when adding KMSKey reference inside RDSCluster and RDSInstance.
  • Successfully generated rds-controller locally with reference to KMSKey and also tested with existing apigatewayv2 controller which contains the references as well.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

// useful to avoid nil pointer panics when accessing the referenced value.
//
// This function only outputs the logical condition and not the "if" block
// so that the output can be reused in many templates, where
Copy link
Contributor

Choose a reason for hiding this comment

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

🚀

Copy link
Collaborator

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

There is a problem with the assumption in the code that all components of the field path point to scalar Go types (or structs). However, this problem is present in the existing code and this PR doesn't need to be held up for it.

@vijtrip2 we can chat about a more robust solution that can handle map and slice field types.

pkg/generate/code/check.go Show resolved Hide resolved
templates/cmd/controller/main.go.tpl Show resolved Hide resolved
@jaypipes
Copy link
Collaborator

/lgtm

@ack-bot ack-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 21, 2022
@ack-bot
Copy link
Collaborator

ack-bot commented Apr 21, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brycahta, jaypipes, vijtrip2

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [brycahta,jaypipes,vijtrip2]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-bot ack-bot merged commit 3226a8f into aws-controllers-k8s:main Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants