Skip to content

Commit

Permalink
Merge pull request #1870 from cybertron/backport-record-type-fix
Browse files Browse the repository at this point in the history
Bug 1851541: Correctly handle requests for ipv4/ipv6 records
  • Loading branch information
openshift-merge-robot committed Jul 1, 2020
2 parents 9712a7c + c8a2610 commit 3608783
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 18 deletions.
29 changes: 23 additions & 6 deletions manifests/baremetal/coredns-corefile.tmpl
Expand Up @@ -5,14 +5,31 @@
forward . {{`{{- range $upstream := .DNSUpstreams}} {{$upstream}}{{- end}}`}}
cache 30
reload
hosts {
{{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }} api-int.{{ .ControllerConfig.EtcdDiscoveryDomain }}
{{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }} api.{{ .ControllerConfig.EtcdDiscoveryDomain }}
template IN {{`{{ .Cluster.IngressVIPRecordType }}`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match .*.apps.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
answer "{{`{{"{{ .Name }}"}}`}} 60 in {{`{{"{{ .Type }}"}}`}} {{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.IngressIP }}"
fallthrough
}
template IN A {{ .ControllerConfig.EtcdDiscoveryDomain }} {
match .*.apps.{{ .ControllerConfig.EtcdDiscoveryDomain }}
answer "{{`{{"{{ .Name }}"}}`}} 60 in a {{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.IngressIP }}"
template IN {{`{{ .Cluster.IngressVIPEmptyType }}`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match .*.apps.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
fallthrough
}
template IN {{`{{ .Cluster.APIVIPRecordType }}`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match api.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
answer "{{`{{"{{ .Name }}"}}`}} 60 in {{`{{"{{ .Type }}"}}`}} {{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }}"
fallthrough
}
template IN {{`{{ .Cluster.APIVIPEmptyType }}`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match api.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
fallthrough
}
template IN {{`{{ .Cluster.APIVIPRecordType }}`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match api-int.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
answer "{{`{{"{{ .Name }}"}}`}} 60 in {{`{{"{{ .Type }}"}}`}} {{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }}"
fallthrough
}
template IN {{`{{ .Cluster.APIVIPEmptyType }}`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match api-int.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
fallthrough
}
}
29 changes: 23 additions & 6 deletions pkg/operator/assets/bindata.go
Expand Up @@ -101,14 +101,31 @@ var _manifestsBaremetalCorednsCorefileTmpl = []byte(`. {
forward . {{`+"`"+`{{- range $upstream := .DNSUpstreams}} {{$upstream}}{{- end}}`+"`"+`}}
cache 30
reload
hosts {
{{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }} api-int.{{ .ControllerConfig.EtcdDiscoveryDomain }}
{{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }} api.{{ .ControllerConfig.EtcdDiscoveryDomain }}
template IN {{`+"`"+`{{ .Cluster.IngressVIPRecordType }}`+"`"+`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match .*.apps.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
answer "{{`+"`"+`{{"{{ .Name }}"}}`+"`"+`}} 60 in {{`+"`"+`{{"{{ .Type }}"}}`+"`"+`}} {{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.IngressIP }}"
fallthrough
}
template IN A {{ .ControllerConfig.EtcdDiscoveryDomain }} {
match .*.apps.{{ .ControllerConfig.EtcdDiscoveryDomain }}
answer "{{`+"`"+`{{"{{ .Name }}"}}`+"`"+`}} 60 in a {{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.IngressIP }}"
template IN {{`+"`"+`{{ .Cluster.IngressVIPEmptyType }}`+"`"+`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match .*.apps.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
fallthrough
}
template IN {{`+"`"+`{{ .Cluster.APIVIPRecordType }}`+"`"+`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match api.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
answer "{{`+"`"+`{{"{{ .Name }}"}}`+"`"+`}} 60 in {{`+"`"+`{{"{{ .Type }}"}}`+"`"+`}} {{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }}"
fallthrough
}
template IN {{`+"`"+`{{ .Cluster.APIVIPEmptyType }}`+"`"+`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match api.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
fallthrough
}
template IN {{`+"`"+`{{ .Cluster.APIVIPRecordType }}`+"`"+`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match api-int.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
answer "{{`+"`"+`{{"{{ .Name }}"}}`+"`"+`}} 60 in {{`+"`"+`{{"{{ .Type }}"}}`+"`"+`}} {{ .ControllerConfig.Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }}"
fallthrough
}
template IN {{`+"`"+`{{ .Cluster.APIVIPEmptyType }}`+"`"+`}} {{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }} {
match api-int.{{ .ControllerConfig.Infra.Status.EtcdDiscoveryDomain }}
fallthrough
}
}
Expand Down
29 changes: 23 additions & 6 deletions templates/common/baremetal/files/baremetal-coredns-corefile.yaml
Expand Up @@ -10,14 +10,31 @@ contents:
forward . {{`{{- range $upstream := .DNSUpstreams}} {{$upstream}}{{- end}}`}}
cache 30
reload
hosts {
{{ .Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }} api-int.{{ .EtcdDiscoveryDomain }}
{{ .Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }} api.{{ .EtcdDiscoveryDomain }}
template IN {{`{{ .Cluster.IngressVIPRecordType }}`}} {{ .Infra.Status.EtcdDiscoveryDomain }} {
match .*.apps.{{ .Infra.Status.EtcdDiscoveryDomain }}
answer "{{`{{"{{ .Name }}"}}`}} 60 in {{`{{"{{ .Type }}"}}`}} {{ .Infra.Status.PlatformStatus.BareMetal.IngressIP }}"
fallthrough
}
template IN A {{ .EtcdDiscoveryDomain }} {
match .*.apps.{{ .EtcdDiscoveryDomain }}
answer "{{`{{"{{ .Name }}"}}`}} 60 in a {{ .Infra.Status.PlatformStatus.BareMetal.IngressIP }}"
template IN {{`{{ .Cluster.IngressVIPEmptyType }}`}} {{ .Infra.Status.EtcdDiscoveryDomain }} {
match .*.apps.{{ .Infra.Status.EtcdDiscoveryDomain }}
fallthrough
}
template IN {{`{{ .Cluster.APIVIPRecordType }}`}} {{ .Infra.Status.EtcdDiscoveryDomain }} {
match api.{{ .Infra.Status.EtcdDiscoveryDomain }}
answer "{{`{{"{{ .Name }}"}}`}} 60 in {{`{{"{{ .Type }}"}}`}} {{ .Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }}"
fallthrough
}
template IN {{`{{ .Cluster.APIVIPEmptyType }}`}} {{ .Infra.Status.EtcdDiscoveryDomain }} {
match api.{{ .Infra.Status.EtcdDiscoveryDomain }}
fallthrough
}
template IN {{`{{ .Cluster.APIVIPRecordType }}`}} {{ .Infra.Status.EtcdDiscoveryDomain }} {
match api-int.{{ .Infra.Status.EtcdDiscoveryDomain }}
answer "{{`{{"{{ .Name }}"}}`}} 60 in {{`{{"{{ .Type }}"}}`}} {{ .Infra.Status.PlatformStatus.BareMetal.APIServerInternalIP }}"
fallthrough
}
template IN {{`{{ .Cluster.APIVIPEmptyType }}`}} {{ .Infra.Status.EtcdDiscoveryDomain }} {
match api-int.{{ .Infra.Status.EtcdDiscoveryDomain }}
fallthrough
}
}

0 comments on commit 3608783

Please sign in to comment.