-
Notifications
You must be signed in to change notification settings - Fork 190
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
Allow skipping state validations for resources that support cyclic references #544
Allow skipping state validations for resources that support cyclic references #544
Conversation
/retest |
62d1932
to
e66e2f7
Compare
e66e2f7
to
390d759
Compare
390d759
to
8213a7d
Compare
/retest |
flaky eks tests |
@TiberiuGC: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍
/lgtm
// SkipResourceStateValidations if true, skips state validations performed during | ||
// ResolveReferences step, that ensure the referenced resource exists in AWS and is synced. | ||
// This is needed when multiple resources reference each other in a cyclic manner, | ||
// as otherwise they will never sync due to circular ResourceReferenceNotSynced errors. | ||
// | ||
// see: https://github.com/aws-controllers-k8s/community/issues/2119 | ||
// | ||
// N.B. when setting this field to true, the developer is responsible to amend the sdkCreate | ||
// and/or sdkUpdate functions of the referencing resource, in order to correctly wait on the | ||
// desired state of the referenced resource, before SDK API calls that require the latter. | ||
// In the future, we could consider generating this logic, but for now this is a niche use case. | ||
// | ||
// see: https://github.com/aws-controllers-k8s/ec2-controller/blob/main/pkg/resource/security_group/sdk.go | ||
SkipResourceStateValidations bool `json:"skip_resource_state_validations"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great explanation!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: a-hilaly, TiberiuGC 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:
Approvers can indicate their approval by writing |
Issue #, if available: aws-controllers-k8s/community#2119 Description of changes: Cyclic references support is done via. the following workflow: 1. skip runtime reference state validations by setting `SecurityGroup.Rules.UserIDGroupPairs.GroupID.skip_resource_state_validations: true` (see aws-controllers-k8s/code-generator#544). This allows runtime to proceed with the `sdkCreate` call. 2. inside `sdkCreate` and `sdkUpdate` add custom logic that checks whether referenced security groups are being created on AWS end (i.e. `groupID != nil`). If the checks succeed, move forward with syncing SG rules. Otherwise, requeue and wait for all referenced SGs to be created. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: aws-controllers-k8s/community#2119 Description of changes: Cyclic references support is done via. the following workflow: 1. skip runtime reference state validations by setting `SecurityGroup.Rules.UserIDGroupPairs.GroupID.skip_resource_state_validations: true` (see aws-controllers-k8s/code-generator#544). This allows runtime to proceed with the `sdkCreate` call. 2. inside `sdkCreate` and `sdkUpdate` add custom logic that checks whether referenced security groups are being created on AWS end (i.e. `groupID != nil`). If the checks succeed, move forward with syncing SG rules. Otherwise, requeue and wait for all referenced SGs to be created. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: aws-controllers-k8s/community#2119
Description of changes:
Introducing a new field
config.Resources.Fields.References.SkipResourceStateValidations
, that, if set to true, skips state validations performed duringResolveReferences
step, that ensure the referenced resource exists in AWS and is synced. This is needed when multiple resources reference each other in a cyclic manner, as otherwise they will never sync due to circularResourceReferenceNotSynced
errors.N.B. when setting this field to true, the developer is responsible to amend the
sdkCreate
and/orsdkUpdate
functions of the referencing resource, in order to correctly wait on the desired state of the referenced resource, before SDK API calls that require the latter. In the future, we could consider generating this logic, but for now this is a niche use case.see (example will be available when this PR is merged): https://github.com/aws-controllers-k8s/ec2-controller/blob/main/pkg/resource/security_group/sdk.go
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.