mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 03:37:46 +08:00
support custom pvc name
This commit is contained in:
parent
27f37adb5f
commit
55ed4b8921
@ -72,6 +72,8 @@ type Response struct {
|
||||
|
||||
//Request build input
|
||||
type Request struct {
|
||||
GRDataPVCName string
|
||||
CachePVCName string
|
||||
TenantID string
|
||||
SourceDir string
|
||||
CacheDir string
|
||||
|
@ -297,7 +297,7 @@ func (s *slugBuild) runBuildJob(re *Request) error {
|
||||
Name: "slug",
|
||||
VolumeSource: corev1.VolumeSource{
|
||||
PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
|
||||
ClaimName: "grdata",
|
||||
ClaimName: s.re.GRDataPVCName,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -305,7 +305,7 @@ func (s *slugBuild) runBuildJob(re *Request) error {
|
||||
Name: "app",
|
||||
VolumeSource: corev1.VolumeSource{
|
||||
PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
|
||||
ClaimName: "cache",
|
||||
ClaimName: s.re.CachePVCName,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -443,6 +443,7 @@ func getJob(ctx context.Context, podChan chan struct{}, clientset kubernetes.Int
|
||||
job, _ = evt.Object.(*batchv1.Job)
|
||||
if job.Name == name {
|
||||
logrus.Debugf("job: %s status is: %+v ", name, job.Status)
|
||||
// active means this job has bound a pod, can't ensure this pod's status is running or creating or initing or some status else
|
||||
if job.Status.Active > 0 {
|
||||
once.Do(func() {
|
||||
logrus.Debug("job is ready")
|
||||
|
@ -46,14 +46,16 @@ import (
|
||||
|
||||
//SourceCodeBuildItem SouceCodeBuildItem
|
||||
type SourceCodeBuildItem struct {
|
||||
Namespace string `json:"namespace"`
|
||||
TenantName string `json:"tenant_name"`
|
||||
ServiceAlias string `json:"service_alias"`
|
||||
Action string `json:"action"`
|
||||
DestImage string `json:"dest_image"`
|
||||
Logger event.Logger `json:"logger"`
|
||||
EventID string `json:"event_id"`
|
||||
CacheDir string `json:"cache_dir"`
|
||||
Namespace string `json:"namespace"`
|
||||
TenantName string `json:"tenant_name"`
|
||||
GRDataPVCName string `json:"gr_data_pvc_name"`
|
||||
CachePVCName string `json:"cache_pvc_name"`
|
||||
ServiceAlias string `json:"service_alias"`
|
||||
Action string `json:"action"`
|
||||
DestImage string `json:"dest_image"`
|
||||
Logger event.Logger `json:"logger"`
|
||||
EventID string `json:"event_id"`
|
||||
CacheDir string `json:"cache_dir"`
|
||||
//SourceDir string `json:"source_dir"`
|
||||
TGZDir string `json:"tgz_dir"`
|
||||
DockerClient *client.Client
|
||||
@ -249,6 +251,8 @@ func (i *SourceCodeBuildItem) codeBuild() (*build.Response, error) {
|
||||
KubeClient: i.KubeClient,
|
||||
HostAlias: hostAlias,
|
||||
Ctx: i.Ctx,
|
||||
GRDataPVCName: i.GRDataPVCName,
|
||||
CachePVCName: i.CachePVCName,
|
||||
}
|
||||
res, err := codeBuild.Build(buildReq)
|
||||
return res, err
|
||||
|
@ -319,6 +319,8 @@ func (e *exectorManager) buildFromSourceCode(task *pb.TaskMessage) {
|
||||
i.RbdNamespace = e.cfg.RbdNamespace
|
||||
i.RbdRepoName = e.cfg.RbdRepoName
|
||||
i.Ctx = e.ctx
|
||||
i.CachePVCName = e.cfg.CachePVCName
|
||||
i.GRDataPVCName = e.cfg.GRDataPVCName
|
||||
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)
|
||||
|
@ -51,6 +51,8 @@ type Config struct {
|
||||
LogPath string
|
||||
RbdNamespace string
|
||||
RbdRepoName string
|
||||
GRDataPVCName string
|
||||
CachePVCName string
|
||||
}
|
||||
|
||||
//Builder builder server
|
||||
@ -90,6 +92,8 @@ func (a *Builder) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&a.LogPath, "log-path", "/grdata/logs", "Where Docker log files and event log files are stored.")
|
||||
fs.StringVar(&a.RbdNamespace, "rbd-namespace", "rbd-system", "rbd component namespace")
|
||||
fs.StringVar(&a.RbdRepoName, "rbd-repo", "rbd-repo", "rbd component repo's name")
|
||||
fs.StringVar(&a.GRDataPVCName, "pvc-grdata-name", "grdata", "pvc name of grdata")
|
||||
fs.StringVar(&a.CachePVCName, "pvc-cache-name", "cache", "pvc name of cache")
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user