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

Add PrivateDNSZone resource #2086

Closed
wants to merge 1 commit into from

Conversation

vaspahomov
Copy link
Contributor

Signed-off-by: vaspahomov [email protected]

What this PR does / why we need it:

I want to add PrivateDNSZone resource and their PrivateDNSZone/VirtualNetworkLink dependency.
This can help us to create PostgreSQL connected with private network without az cli or others.

Special notes for your reviewer:

I've found that '*api201*' versions of network are excluded. I think we need explicitly add PrivateDnsZones and VirtualNetworkLinks (but I can not find right resource name) resources.

After this manipulations I'm receiving:

E0211 14:19:54.561995   27841 gen_kustomize.go:111] Error during code generation:
failed during pipeline stage 23/57: Verify there are no ErroredType's containing errors: "github.com/Azure/azure-service-operator/v2/api/network/v1alpha1api20180901/PrivateDnsZone" has property "Status" with errors: "missing status information for github.com/Azure/azure-service-operator/v2/api/network/v1alpha1api20180901/PrivateDnsZones"

I've tried to add this in status section, but it did not help:

    {
      # give the privations types their own namespace
      basePath: 'privatedns/resource-management',
      namespace: 'Microsoft.Network'
    },

Can you tell me what I'm doing wrong?

How does this PR make you feel:
gif

If applicable:

  • this PR contains documentation
  • this PR contains tests

@theunrepentantgeek
Copy link
Member

This error:

missing status information for github.com/Azure/azure-service-operator/v2/api/network/v1alpha1api20180901/PrivateDnsZones

usually means that the Swagger submodule is out of date.

(Some background: after we consume the JSON schema from ARM, we need to then also consume the Swagger definitions for the same versions to pick up information that's not available through the JSON schema.)

We recently updated the Swagger submodule reference, so you may need to pick that up for the import to work. Two things to check. Firstly, make sure you've based your branch from our latest main, to ensure you've got the changes from PR #2092. Secondly, run git submodule update from the root of the repo to actually pull the updates into your working tree.

Let us know if this works for you.

@vaspahomov vaspahomov force-pushed the feature/private-dns-zone branch 2 times, most recently from 6dc3bab to c56bd1d Compare February 14, 2022 06:30
@vaspahomov
Copy link
Contributor Author

Rebase on main branch did not help in my case:(

For now I've add all types from network 2018-09-01 with PrivateDNSZone and dependencies types.

- action: include
   group: network
   version: '*api20180901*'
   because: Include networking api versions with PrivateDNSZone types

And now receiving another error:

I0214 11:30:11.073621   62105 code_generator.go:219] 32/57: Apply flattening to properties marked for flattening
E0214 11:30:11.090233   62105 gen_kustomize.go:111] Error during code generation:
failed during pipeline stage 32/57: Apply flattening to properties marked for flattening: visit of type of "github.com/Azure/azure-service-operator/v2/api/network/v1alpha1api20180901/PrivateDnsZones_Spec" failed: couldn't find definition for k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/JSON

@vaspahomov vaspahomov force-pushed the feature/private-dns-zone branch from c56bd1d to df3a880 Compare February 14, 2022 06:39
@matthchr
Copy link
Member

First off I think one issue is casing (and I will fully admit this is completely obtuse/hard to get right): In your config you should use: PrivateDnsZone not PrivateDNSZone.

Doing that got me to here:

failed during pipeline stage 32/57: Apply flattening to properties marked for flattening: visit of type of "github.com/Azure/azure-service-operator/v2/api/network/v1alpha1api20180901/PrivateDnsZones_Spec" failed: couldn't find definition for k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/JSON

I looked at the actual JSON schema for PrivateDnsZone and it looks... incomplete to me:

    "PrivateZoneProperties": {
      "description": "Represents the properties of the Private DNS zone."
    }

Looking at the Swagger for private DNS Zones looks more correct to me.

I think there is a newer version of the privateDnsZones resource, see here, but it's not in the JSON schema because microsoft.network doesn't autogenerate their JSON schema from their Swagger.

@Porges has a PR out (#2084) where he is working on moving to just Swagger as the source of truth, which would allow us to use the newer REST API version for PrivateDNSZones and in theory should fix the errors we're getting in generation. The Swagger looks correct to me while the JSON schema looks wrong. I think that PR is still a ways out from merging though (@Porges can comment), but likely you'll need to wait until then before we can generate this resource.

@theunrepentantgeek
Copy link
Member

The work on switching to Swagger as the sole source of truth is taking longer than expected; we expect it to land in for v2.0.0-beta.2. Once that lands, we're interested in getting this PR updated and merged to provide support for PrivateDNSZone.

@theunrepentantgeek
Copy link
Member

theunrepentantgeek commented Aug 10, 2022

With PR #2430 now merged, we will have support for PrivateDnsZone in the next release of ASO v2. (I found a way to land this ahead of our delayed Swagger changes.)

Closing this PR.

Many thanks for your input, and apologies for the delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants