Fixups to dnspolicy for realgcp - #9594
Conversation
- Normalize Id to ${dnsPolicyId} in mockdns/normalize.go when kind is dns#policy.
- In DNSPolicyAdapter Update, set desired.Id = a.actual.Id as a workaround for the DNS update API bug where Id is required.
- Add cnrm.cloud.google.com/deletion-policy: abandon on the DNSPolicy test fixture objects.
- Update NotFound error messages in mockdns/policy.go to match the expected format for dns policies.
Fixes GoogleCloudPlatform#9593
| X-Xss-Protection: 0 | ||
|
|
||
| { | ||
| "id": "000000000000000000000", |
There was a problem hiding this comment.
I was expecting this to be ${dnsPolicyId}. Let's also make sure that we are generating a "random" id in mockgcp also (we tend to just use the unix timestamp, it's random enough for a mock).
|
|
||
| --- | ||
|
|
||
| PATCH https://dns.googleapis.com/dns/v1beta2/projects/${projectId}/policies/dnspolicy-test-${uniqueId}?alt=json |
There was a problem hiding this comment.
Oh I see - the old controller would clear the networks first. I like that approach, let's do that, then we don't need to mark the dns policy objects with abandon-on-delete
|
|
||
| if a.actual != nil && len(a.actual.Networks) > 0 { | ||
| log.V(2).Info("clearing networks for DNSPolicy before deletion", "name", a.id) | ||
| cleared := common.DeepCopy(a.actual) |
There was a problem hiding this comment.
It might be clearer if we wrote this one as a patch
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinsb The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
96670a6
Following on from #9569, a few fixups that are needed based on real-gcp testing:
${dnsPolicyId}inmockgcp/mockdns/normalize.gowhenkindisdns#policy(similar logic tomanagedZoneId).func (a *DNSPolicyAdapter) Update, setdesired.Id = a.actual.Idto work around the undocumented bug in the DNS update API whereIdis required in update calls.cnrm.cloud.google.com/deletion-policy: abandonon thekind: DNSPolicytest fixture objects to prevent deletion blocks from VPC networks in real GCP.mockgcp/mockdns/policy.goto follow the format"The 'parameters.policy' resource named 'dnspolicy-test-${uniqueId}' does not exist.".Fixes #9593