Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMultiple YAML files or filters #477
Comments
|
Hi @thockin. I believe you can get what you're after by using 2 ---
providers:
base:
class: octodns.provider.yaml.YamlProvider
# In this directory you'd have k8s.io.yaml and the symlinked
# canary.k8s.io.yaml without the canary delegate record
directory: ./config
delegate:
class: octodns.provider.yaml.YamlProvider
# In this directory you'd just have k8s.io.yaml with ONLY the canary
# delegate record
directory: ./delegate
zones:
k8s.io.:
sources:
# Both YamlProviders here, the first will load all the records for the
# zone, the second will just add in the canary delegate
- base
- delegate
targets:
- ...
canary.k8s.io.:
# Just the YamlProvider with all the normal records here, so the
# sub-zone will be an exact copy (san the canary record.)
sources:
- base
targets:
- ...We make extensive use of multiple sources like this internally, but not for exactly this use case. We often combine static configs coming from yaml with dynamic sources (ultimately) coming from systems we run, including k8s We also just landed #353 a few days ago that added a new flag to the |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

First, thanks for octodns!
Maybe I am going about this all wrong.
We have a zone
k8s.iowhich we sync from YamlProvider to GoogleCloudProvider. Because I do not trust myself not to screw it up, we have a script that first pushes to a canary zone. So I actually have 2 zones -k8s.ioandcanary.k8s.io. I want to (as much as possible) push the EXACT SAME yaml to the canary, run some tests, then push that yaml to "real".To do this, we symlinked canary.k8s.io.yaml -> k8s.io.yaml. Now I can use octodns to push either zone, from the same config. Awesome.
So what's the problem?
One of the records in the YAML is the NS that delegates "canary". This means that when I push to canary.k8s.io, I create a record "canary.canary.k8s.io", which has an NS record delegating to yet another zone. That hasn't really been a problem for us, but it turns out that some DNS providers see that as a "lame delegation" and it causes a problem for them.
So I want to fix this. I want to push the yaml to canary and the yaml PLUS the NS record to "real".
Now, I could keep 2 almost identical YAML files, but that seems likely to break eventually. What I really want is some way to join 2 yaml files when pushing. For example, if I had k8s.io._base.yaml and k8s.io._canary_delegation.yaml, the YamlProvider could recognize that they need to be merged. Then canary.k8s.io.yaml -> k8s.io._base.yaml. Canary gets the base, prod gets base+delegation.
Obviously YamlProvider does not support this. Is there a better way to do it? Am I taking crazy pills?