Skip to content

Commit

Permalink
Fix installation of etcd secrets into config file
Browse files Browse the repository at this point in the history
  • Loading branch information
caseydavenport committed Sep 4, 2020
1 parent b513628 commit 5dc7b14
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,23 +353,22 @@ func writeCNIConfig(c config) {

// Replace etcd datastore variables.
hostSecretsDir := c.CNINetDir + "/calico-tls"

etcdCertFile := fmt.Sprintf("%s/etcd-cert", hostSecretsDir)
if fileExists(etcdCertFile) {
if fileExists("/host/etc/cni/net.d/calico-tls/etcd-cert") {
etcdCertFile := fmt.Sprintf("%s/etcd-cert", hostSecretsDir)
netconf = strings.Replace(netconf, "__ETCD_CERT_FILE__", etcdCertFile, -1)
} else {
netconf = strings.Replace(netconf, "__ETCD_CERT_FILE__", "", -1)
}

etcdCACertFile := fmt.Sprintf("%s/etcd-ca", hostSecretsDir)
if fileExists(etcdCACertFile) {
if fileExists("/host/etc/cni/net.d/calico-tls/etcd-ca") {
etcdCACertFile := fmt.Sprintf("%s/etcd-ca", hostSecretsDir)
netconf = strings.Replace(netconf, "__ETCD_CA_CERT_FILE__", etcdCACertFile, -1)
} else {
netconf = strings.Replace(netconf, "__ETCD_CA_CERT_FILE__", "", -1)
}

etcdKeyFile := fmt.Sprintf("%s/etcd-key", hostSecretsDir)
if fileExists(etcdKeyFile) {
if fileExists("/host/etc/cni/net.d/calico-tls/etcd-key") {
etcdKeyFile := fmt.Sprintf("%s/etcd-key", hostSecretsDir)
netconf = strings.Replace(netconf, "__ETCD_KEY_FILE__", etcdKeyFile, -1)
} else {
netconf = strings.Replace(netconf, "__ETCD_KEY_FILE__", "", -1)
Expand Down

0 comments on commit 5dc7b14

Please sign in to comment.