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

Route53 HostedZone delegationSet not in use-full format for ResourceRecordSet #628

Closed
martin-ducar-gd opened this issue Apr 13, 2021 · 5 comments
Labels
enhancement New feature or request stale

Comments

@martin-ducar-gd
Copy link

What problem are you facing?

Consider 2 nested domains example.com and test.example.com
Now either both or at least test.example.com is created via Crossplane.
The HostedZone domain record has in status.atProvider.delegationSet.nameServers a array of strings:

          status:
            description: HostedZoneStatus represents the observed state of a HostedZone.
            properties:
              atProvider:
                description: HostedZoneObservation keeps the state for the external
                  resource.
                properties:
                  delegationSet:
                    description: DelegationSet describes the name servers for this
                      hosted zone.
                    properties:
                      callerReference:
                        description: The value that you specified for CallerReference
                          when you created the reusable delegation set.
                        type: string
                      id:
                        description: The ID that Amazon Route 53 assigns to a reusable
                          delegation set.
                        type: string
                      nameServers:
                        description: NameServers contains a list of the authoritative
                          name servers for a hosted Hostedzone.
                        items:
                          type: string

Now you want to delegate that test.example.com from example.com via ResourceRecordSet
which input for NS type of records has this specification:

                  resourceRecords:
                    description: "Information about the resource records to act upon.
                      \n If you're creating an alias resource record set, omit ResourceRecords."
                    items:
                      description: ResourceRecord holds the DNS value to be used for
                        the record.
                      properties:
                        value:
                          description: "The current or new DNS record value, not to
                            exceed 4,000 characters. In the case of a DELETE action,
                            if the current value does not match the actual value,
                            an error is returned. For descriptions about how to format
                            Value for different record types, see Supported DNS Resource
                            Record Types (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html)
                            in the Amazon Route 53 Developer Guide. \n You can specify
                            more than one value for all record types except CNAME
                            and SOA. \n If you're creating an alias resource record
                            set, omit Value."
                          type: string
                      required:
                      - value
                      type: object

As you can see in example they are not the same:

status:
  atProvider:
    delegationSet:
      nameServers:
      - ns-example1.awsdns-1.net
      - ns-example2.awsdns-2.com
      - ns-example3.awsdns-3.co.uk
      - ns-example4.awsdns-4.org

vs

  spec:
    forProvider:
      resourceRecords:
      - value: ns-example1.awsdns-1.net
      - value: ns-example2.awsdns-2.com
      - value: ns-example3.awsdns-3.co.uk
      - value: ns-example4.awsdns-4.org
      ttl: 300
      type: NS
      zoneId: ZexampleZ

Now when I look at CompositeResourceDefinition and Composition and its transform capabilities: https://doc.crds.dev/github.com/crossplane/crossplane/apiextensions.crossplane.io/Composition/v1@v1.1.0 I can't seam to find any which would be able to transform the values.

How could Crossplane help solve your problem?

3 options:

  1. Add nested transform function to apply on each array entry another transform
  2. Change HostedZone status.atProvider.delegationSet.nameServers to be an output in same format as ResourceRecordSet spec.forProvider.resourceRecords
  3. Change ResourceRecordSet definition spec.forProvider.resourceRecords to be same format as HostedZone status.atProvider.delegationSet.nameServers
    options 2,3 are backwards incompatible, but would make to me most sense as simplest approach
@martin-ducar-gd martin-ducar-gd added the enhancement New feature or request label Apr 13, 2021
@martin-ducar-gd
Copy link
Author

martin-ducar-gd commented Apr 16, 2021

Thinking of option 2. It might be possible to introduce compatibility status field which would just reformat output, example crds field:

              atProvider:
                description: HostedZoneObservation keeps the state for the external resource.
                properties:
                  delegationSet:
                    description: DelegationSet describes the name servers for this hosted zone.
                    properties:
                      callerReference:
                        description: The value that you specified for CallerReference when you created the reusable delegation set.
                        type: string
                      id:
                        description: The ID that Amazon Route 53 assigns to a reusable delegation set.
                        type: string
                      nameServers:
                        description: NameServers contains a list of the authoritative name servers for a hosted Hostedzone.
                        items:
                          type: string
                        type: array
                      compatibility: # Compatibility layer fields with other crossplane resources
                        properties:
                          resourceRecordSet:
                            properties:
                              nameservers:
                                items:
                                  properties:
                                    value:
                                      type: string
                                  type: object
                                type: array
                            type: object
                        type: object  
                    type: object

@muvaf
Copy link
Member

muvaf commented Apr 20, 2021

Please let me know if my understanding is correct. You have an array like the following:

status:
  atProvider:
    delegationSet:
      nameServers:
      - ns-example1.awsdns-1.net
      - ns-example2.awsdns-2.com
      - ns-example3.awsdns-3.co.uk
      - ns-example4.awsdns-4.org

And you'd like to use this status.atProvider.delegationSet.nameServers entries as input to another ResourceRecordSet by patching in Composition. So, in the end it'd look like the following:

spec:
    forProvider:
      resourceRecords:
      - value: ns-example1.awsdns-1.net
      - value: ns-example2.awsdns-2.com
      - value: ns-example3.awsdns-3.co.uk
      - value: ns-example4.awsdns-4.org

You're not able to do this because input is a string array while the target field is object array.

@martin-ducar-gd
Copy link
Author

@muvaf exactly

@project-administrator
Copy link

project-administrator commented May 19, 2023

Here is a workaround to pass the data from HostedZone list to the ResourceRecordSet:

    - type: FromCompositeFieldPath
      fromFieldPath: status.nameServers[0]
      toFieldPath: spec.forProvider.resourceRecords[0].value
      policy:
        fromFieldPath: Required
    - type: FromCompositeFieldPath
      fromFieldPath: status.nameServers[1]
      toFieldPath: spec.forProvider.resourceRecords[1].value
    - type: FromCompositeFieldPath
      fromFieldPath: status.nameServers[2]
      toFieldPath: spec.forProvider.resourceRecords[2].value
    - type: FromCompositeFieldPath
      fromFieldPath: status.nameServers[3]
      toFieldPath: spec.forProvider.resourceRecords[3].value

@github-actions
Copy link

Crossplane does not currently have enough maintainers to address every issue and pull request. This issue has been automatically marked as stale because it has had no activity in the last 90 days. It will be closed in 14 days if no further activity occurs. Leaving a comment starting with /fresh will mark this issue as not stale.

@github-actions github-actions bot added the stale label Sep 24, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2023
tektondeploy pushed a commit to gtn3010/provider-aws that referenced this issue Mar 12, 2024
rds.instance: add ability to auto-generate password in referenced secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

3 participants