Skip to content

Conversation

vflaux
Copy link
Contributor

@vflaux vflaux commented Jul 3, 2025

What does it do ?

Migrate the regional services logic to the cloudflare lib v4.
We keep the old version for other parts (zone, custom hostnames, dns).

The v4 lib do not have the RegionalHostname struct so I redefined it (done in #5615).
I also introduce a function autoPagerIterator() to convert the v4 lib "AutoPager" to a go iterator.
This is used only once for now but it is intended to be used in other list calls.

There is no changes in the logic, simply a different api / structs.

Motivation

The current client is not supported anymore.
See #5540.

More

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • Yes, I updated end user documentation accordingly

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. provider Issues or PRs related to a provider labels Jul 3, 2025
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 3, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @vflaux. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 3, 2025
@ivankatliarchuk
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 3, 2025
@vflaux vflaux force-pushed the cloudflare_v4_regional branch from 5cfc160 to 00b2c47 Compare July 3, 2025 22:13
@vflaux vflaux changed the title Cloudflare v4 regional chore(cloudflare): use v4 lib for regional services Jul 3, 2025
@vflaux vflaux changed the title chore(cloudflare): use v4 lib for regional services chore(cloudflare): use lib v4 for regional services Jul 3, 2025
@vflaux vflaux force-pushed the cloudflare_v4_regional branch from 00b2c47 to c403285 Compare July 6, 2025 13:13
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 6, 2025
@vflaux vflaux force-pushed the cloudflare_v4_regional branch from c403285 to 72dc47b Compare July 7, 2025 08:39
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 7, 2025
@vflaux
Copy link
Contributor Author

vflaux commented Jul 10, 2025

smoke tests:

external-dns args

  • --log-level=debug
  • --log-format=json
  • --events
  • --source=ingress
  • --provider=cloudflare
  • --cloudflare-regional-services
  • --cloudflare-region-key=

validation

GET on https://api.cloudflare.com/client/v4/zones/:zone_id/addressing/regional_hostnames

Cases

Create

Create new ingress with regional key to "eu".

Ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: test
  namespace: default
  annotations:
    external-dns.alpha.kubernetes.io/cloudflare-region-key: "eu"
spec:
  ingressClassName: cloudflare
  rules:
    - host: external-dns-test.xxx.xx
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: test
                port:
                  name: http

Log:

{"action":"CREATE","hostname":"external-dns-test.xxx.xx","level":"debug","msg":"Creating regional hostname","region_key":"eu","time":"xxx","zone":"xxx"}

Cloudflare:

{
  "success": true,
  "errors": [],
  "result": [
    {
      "hostname": "external-dns-test.xxx.xx",
      "region_key": "eu",
      "created_on": "xxx"
    }
  ],
  "messages": []
}

Update

Update ingress with regional key "us".

Ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: test
  namespace: default
  annotations:
    external-dns.alpha.kubernetes.io/cloudflare-region-key: "us"

Log:

{"action":"UPDATE","hostname":"external-dns-test.xxx.xx","level":"debug","msg":"Updating regional hostname","region_key":"us","time":"xxx","zone":"xxx"}

Cloudflare:

{
  "success": true,
  "errors": [],
  "result": [
    {
      "hostname": "external-dns-test.xxx.xx",
      "region_key": "us",
      "created_on": "xxx"
    }
  ],
  "messages": []
}

Update

Delete ingress.

Log:

{"action":"DELETE","hostname":"external-dns-test.xxx.xx","level":"debug","msg":"Deleting regional hostname","region_key":"","time":"xxx","zone":"xxx"}

Cloudflare:

{
  "success": true,
  "errors": [],
  "result": [],
  "messages": []
}

@vflaux vflaux force-pushed the cloudflare_v4_regional branch from e247152 to 7304ba0 Compare July 10, 2025 16:35
@vflaux vflaux marked this pull request as ready for review July 10, 2025 16:35
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2025
@k8s-ci-robot k8s-ci-robot requested a review from szuecs July 10, 2025 16:35
Copy link
Contributor

@ivankatliarchuk ivankatliarchuk left a comment

Choose a reason for hiding this comment

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

Closes #5540

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 10, 2025
Copy link
Collaborator

@mloiseleur mloiseleur left a comment

Choose a reason for hiding this comment

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

Thanks.
There's still a long way to migrate other parts !

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mloiseleur

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 11, 2025
@k8s-ci-robot k8s-ci-robot merged commit e2b5604 into kubernetes-sigs:master Jul 11, 2025
14 checks passed
@ivankatliarchuk
Copy link
Contributor

Thanks.
There's still a long way to migrate other parts !
Indeed

@vflaux vflaux deleted the cloudflare_v4_regional branch July 11, 2025 23:46
troll-os pushed a commit to FiligranHQ/external-dns that referenced this pull request Aug 28, 2025
…5609)

* chore(cloudflare): add cloudflare v4 client

* chrome(cloudflare): cli v4 for regional hostanmes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. provider Issues or PRs related to a provider size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants