-
Notifications
You must be signed in to change notification settings - Fork 582
/
proxy.go
30 lines (24 loc) · 1.03 KB
/
proxy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package services
import (
"context"
"github.com/rancher/rke/docker"
"github.com/rancher/rke/hosts"
v3 "github.com/rancher/rke/types"
)
const (
NginxProxyImage = "rancher/rke-nginx-proxy:0.1.0"
NginxProxyEnvName = "CP_HOSTS"
)
func runNginxProxy(ctx context.Context, host *hosts.Host, prsMap map[string]v3.PrivateRegistry, proxyProcess v3.Process, alpineImage, k8sVersion string) error {
imageCfg, hostCfg, _ := GetProcessConfig(proxyProcess, host, k8sVersion)
if err := docker.DoRunContainer(ctx, host.DClient, imageCfg, hostCfg, NginxProxyContainerName, host.Address, WorkerRole, prsMap); err != nil {
return err
}
return createLogLink(ctx, host, NginxProxyContainerName, WorkerRole, alpineImage, prsMap)
}
func removeNginxProxy(ctx context.Context, host *hosts.Host) error {
return docker.DoRemoveContainer(ctx, host.DClient, NginxProxyContainerName, host.Address)
}
func RestartNginxProxy(ctx context.Context, host *hosts.Host) error {
return docker.DoRestartContainer(ctx, host.DClient, NginxProxyContainerName, host.Address)
}