Remove custom ssl code and add TLS support in Ingress rules
This commit is contained in:
parent
5feb452ce4
commit
6cb0e41737
11 changed files with 190 additions and 226 deletions
34
controllers/nginx-third-party/nginx/nginx.go
vendored
34
controllers/nginx-third-party/nginx/nginx.go
vendored
|
|
@ -16,13 +16,11 @@ limitations under the License.
|
|||
|
||||
package nginx
|
||||
|
||||
// NGINXController Updates NGINX configuration, starts and reloads NGINX
|
||||
type NGINXController struct {
|
||||
resolver string
|
||||
nginxConfdPath string
|
||||
nginxCertsPath string
|
||||
local bool
|
||||
}
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
// IngressNGINXConfig describes an NGINX configuration
|
||||
type IngressNGINXConfig struct {
|
||||
|
|
@ -113,3 +111,25 @@ func NewUpstream(name string) Upstream {
|
|||
Backends: []UpstreamServer{},
|
||||
}
|
||||
}
|
||||
|
||||
// AddOrUpdateCertAndKey creates a .pem file wth the cert and the key with the specified name
|
||||
func (nginx *NginxManager) AddOrUpdateCertAndKey(name string, cert string, key string) string {
|
||||
pemFileName := sslDirectory + "/" + name + ".pem"
|
||||
|
||||
pem, err := os.Create(pemFileName)
|
||||
if err != nil {
|
||||
glog.Fatalf("Couldn't create pem file %v: %v", pemFileName, err)
|
||||
}
|
||||
defer pem.Close()
|
||||
|
||||
_, err = pem.WriteString(string(key))
|
||||
if err != nil {
|
||||
glog.Fatalf("Couldn't write to pem file %v: %v", pemFileName, err)
|
||||
}
|
||||
_, err = pem.WriteString(string(cert))
|
||||
if err != nil {
|
||||
glog.Fatalf("Couldn't write to pem file %v: %v", pemFileName, err)
|
||||
}
|
||||
|
||||
return pemFileName
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue