Skip to content

Commit cac08fd

Browse files
committed
Fix pools.yaml rndc_key_file typo
So far we were generating a pools.yaml file with rndc_config_file config option, but it should have been rndc_key_file, with the correct path. This patch fixes it.
1 parent f1e0d96 commit cac08fd

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

pkg/designate/generate_bind9_pools_yaml.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ type Master struct {
5858
}
5959

6060
type Options struct {
61-
Host string `yaml:"host"`
62-
Port int `yaml:"port"`
63-
RNDCHost string `yaml:"rndc_host"`
64-
RNDCPort int `yaml:"rndc_port"`
65-
RNDCConfigFile string `yaml:"rndc_config_file"`
61+
Host string `yaml:"host"`
62+
Port int `yaml:"port"`
63+
RNDCHost string `yaml:"rndc_host"`
64+
RNDCPort int `yaml:"rndc_port"`
65+
RNDCKeyFile string `yaml:"rndc_key_file"`
6666
}
6767

6868
type CatalogZone struct {
@@ -83,7 +83,7 @@ func GeneratePoolsYamlData(BindMap, MdnsMap, NsRecordsMap map[string]string) (st
8383
// Create targets and nameservers
8484
nameservers := []Nameserver{}
8585
targets := []Target{}
86-
rndcKeyNum := 1
86+
rndcKeyNum := 0
8787

8888
for _, bindIP := range BindMap {
8989
nameservers = append(nameservers, Nameserver{
@@ -104,11 +104,11 @@ func GeneratePoolsYamlData(BindMap, MdnsMap, NsRecordsMap map[string]string) (st
104104
Description: fmt.Sprintf("BIND9 Server %d (%s)", rndcKeyNum, bindIP),
105105
Masters: masters,
106106
Options: Options{
107-
Host: bindIP,
108-
Port: 53,
109-
RNDCHost: bindIP,
110-
RNDCPort: 953,
111-
RNDCConfigFile: fmt.Sprintf("%s/%s-%d.conf", RndcConfDir, DesignateRndcKey, rndcKeyNum),
107+
Host: bindIP,
108+
Port: 53,
109+
RNDCHost: bindIP,
110+
RNDCPort: 953,
111+
RNDCKeyFile: fmt.Sprintf("%s/%s-%d", RndcConfDir, DesignateRndcKey, rndcKeyNum),
112112
},
113113
}
114114
targets = append(targets, target)

templates/designatepoolmanager/config/pools.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
port: {{.Options.Port}}
3636
rndc_host: {{.Options.RNDCHost}}
3737
rndc_port: {{.Options.RNDCPort}}
38-
rndc_config_file: {{.Options.RNDCConfigFile}}
38+
rndc_key_file: {{.Options.RNDCKeyFile}}
3939
{{- end }}
4040

4141
{{- if .CatalogZone }}

tests/functional/designate_controller_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ var _ = Describe("Designate controller", func() {
680680
Expect(target.Type).To(Equal("bind9"), "Only Bind9 is a supported Designate backend")
681681

682682
// Check description format
683-
serverNum := i + 1
683+
serverNum := i
684684
expectedDesc := fmt.Sprintf("BIND9 Server %d (%s)", serverNum, target.Options.Host)
685685
Expect(target.Description).To(Equal(expectedDesc), "Target description format mismatch")
686686

@@ -712,8 +712,8 @@ var _ = Describe("Designate controller", func() {
712712
Expect(target.Options.RNDCPort).To(BeNumerically(">", 0), "RNDC port should be a positive number")
713713

714714
// Validate RNDC config file path
715-
expectedRndcPath := fmt.Sprintf("/etc/designate/rndc-keys/rndc-key-%d.conf", serverNum)
716-
Expect(target.Options.RNDCConfigFile).To(Equal(expectedRndcPath), "RNDC config file path mismatch")
715+
expectedRndcPath := fmt.Sprintf("/etc/designate/rndc-keys/rndc-key-%d", serverNum)
716+
Expect(target.Options.RNDCKeyFile).To(Equal(expectedRndcPath), "RNDC config file path mismatch")
717717
}
718718

719719
// Validate len(nameservers) == len(hosts) - which are all Bind9 hosts

0 commit comments

Comments
 (0)