mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 02:38:17 +08:00
use env for cache mode
This commit is contained in:
parent
9ef470895c
commit
639fb79d57
@ -79,7 +79,6 @@ type Request struct {
|
||||
CachePVCName string
|
||||
CacheMode string
|
||||
CachePath string
|
||||
BuilderInNode string
|
||||
TenantID string
|
||||
SourceDir string
|
||||
CacheDir string
|
||||
|
@ -307,16 +307,20 @@ func (s *slugBuild) runBuildJob(re *Request) error {
|
||||
|
||||
podSpec := corev1.PodSpec{RestartPolicy: corev1.RestartPolicyOnFailure} // only support never and onfailure
|
||||
// schedule builder
|
||||
if re.BuilderInNode != "" {
|
||||
logrus.Debugf("builder schedule to node: %s", re.BuilderInNode)
|
||||
podSpec.NodeSelector = map[string]string{
|
||||
"kubernetes.io/hostname": re.BuilderInNode,
|
||||
}
|
||||
podSpec.Tolerations = []corev1.Toleration{
|
||||
{
|
||||
Operator: "Exists",
|
||||
},
|
||||
if re.CacheMode == "hostpath" {
|
||||
logrus.Debugf("builder cache mode using hostpath, schedule job into current node")
|
||||
hostIP := os.Getenv("HOST_IP")
|
||||
if hostIP != "" {
|
||||
podSpec.NodeSelector = map[string]string{
|
||||
"kubernetes.io/hostname": hostIP,
|
||||
}
|
||||
podSpec.Tolerations = []corev1.Toleration{
|
||||
{
|
||||
Operator: "Exists",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
logrus.Debugf("request is: %+v", re)
|
||||
podSpec.Volumes = []corev1.Volume{
|
||||
|
@ -53,7 +53,6 @@ type SourceCodeBuildItem struct {
|
||||
CachePVCName string `json:"cache_pvc_name"`
|
||||
CacheMode string `json:"cache_mode"`
|
||||
CachePath string `json:"cache_path"`
|
||||
BuilderInNode string `json:"builder_in_node"`
|
||||
ServiceAlias string `json:"service_alias"`
|
||||
Action string `json:"action"`
|
||||
DestImage string `json:"dest_image"`
|
||||
@ -261,7 +260,6 @@ func (i *SourceCodeBuildItem) codeBuild() (*build.Response, error) {
|
||||
CachePVCName: i.CachePVCName,
|
||||
CacheMode: i.CacheMode,
|
||||
CachePath: i.CachePath,
|
||||
BuilderInNode: i.BuilderInNode,
|
||||
}
|
||||
res, err := codeBuild.Build(buildReq)
|
||||
return res, err
|
||||
|
@ -328,7 +328,6 @@ func (e *exectorManager) buildFromSourceCode(task *pb.TaskMessage) {
|
||||
i.GRDataPVCName = e.cfg.GRDataPVCName
|
||||
i.CacheMode = e.cfg.CacheMode
|
||||
i.CachePath = e.cfg.CachePath
|
||||
i.BuilderInNode = e.cfg.BuilderInNode
|
||||
i.Logger.Info("Build app version from source code start", map[string]string{"step": "builder-exector", "status": "starting"})
|
||||
start := time.Now()
|
||||
defer event.GetManager().ReleaseLogger(i.Logger)
|
||||
|
@ -55,7 +55,6 @@ type Config struct {
|
||||
CachePVCName string
|
||||
CacheMode string
|
||||
CachePath string
|
||||
BuilderInNode string
|
||||
}
|
||||
|
||||
//Builder builder server
|
||||
@ -99,7 +98,6 @@ func (a *Builder) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&a.CachePVCName, "pvc-cache-name", "cache", "pvc name of cache")
|
||||
fs.StringVar(&a.CacheMode, "cache-mode", "pvc", "volume cache mount type, can be hostpath and sharefile, default is sharefile, which mount using pvc")
|
||||
fs.StringVar(&a.CachePath, "cache-path", "/cache", "volume cache mount path, when cache-mode using hostpath, default path is /cache")
|
||||
fs.StringVar(&a.BuilderInNode, "job-node", "", "where builder job running")
|
||||
}
|
||||
|
||||
//SetLog 设置log
|
||||
|
Loading…
Reference in New Issue
Block a user