Skip to content

Commit db2c02a

Browse files
author
igor.grzankowski
committed
Revert "Remove in progress phase"
This reverts commit 3c919d6.
1 parent 3c919d6 commit db2c02a

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed

api/v4/common_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ type PhaseInfo struct {
572572
const (
573573
// AppPkgDownloadPending indicates pending
574574
AppPkgDownloadPending AppPhaseStatusType = 101
575+
// AppPkgDownloadInProgress indicates in progress
576+
AppPkgDownloadInProgress = 102
575577
// AppPkgDownloadComplete indicates complete
576578
AppPkgDownloadComplete = 103
577579
// AppPkgDownloadError indicates error after retries
@@ -581,6 +583,8 @@ const (
581583
const (
582584
// AppPkgPodCopyPending indicates pending
583585
AppPkgPodCopyPending AppPhaseStatusType = 201
586+
// AppPkgPodCopyInProgress indicates in progress
587+
AppPkgPodCopyInProgress = 202
584588
// AppPkgPodCopyComplete indicates complete
585589
AppPkgPodCopyComplete = 203
586590
// AppPkgMissingFromOperator indicates the downloaded app package is missing
@@ -592,6 +596,8 @@ const (
592596
const (
593597
// AppPkgInstallPending indicates pending
594598
AppPkgInstallPending AppPhaseStatusType = 301
599+
// AppPkgInstallInProgress indicates in progress
600+
AppPkgInstallInProgress = 302
595601
// AppPkgInstallComplete indicates complete
596602
AppPkgInstallComplete = 303
597603
// AppPkgMissingOnPodError indicates app pkg is not available on Pod for install

pkg/splunk/enterprise/afwscheduler.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ import (
3737

3838
var appPhaseInfoStatuses = map[enterpriseApi.AppPhaseStatusType]bool{
3939
enterpriseApi.AppPkgDownloadPending: true,
40+
enterpriseApi.AppPkgDownloadInProgress: true,
4041
enterpriseApi.AppPkgDownloadComplete: true,
4142
enterpriseApi.AppPkgDownloadError: true,
4243
enterpriseApi.AppPkgPodCopyPending: true,
44+
enterpriseApi.AppPkgPodCopyInProgress: true,
4345
enterpriseApi.AppPkgPodCopyComplete: true,
4446
enterpriseApi.AppPkgMissingFromOperator: true,
4547
enterpriseApi.AppPkgPodCopyError: true,
@@ -555,6 +557,34 @@ downloadWork:
555557
continue
556558
}
557559

560+
// update the download state of app to be DownloadInProgress
561+
updatePplnWorkerPhaseInfo(ctx, downloadWorker.appDeployInfo, downloadWorker.appDeployInfo.PhaseInfo.FailCount, enterpriseApi.AppPkgDownloadInProgress)
562+
563+
appDeployInfo := downloadWorker.appDeployInfo
564+
565+
// create the sub-directories on the volume for downloading scoped apps
566+
localPath, err := downloadWorker.createDownloadDirOnOperator(ctx)
567+
if err != nil {
568+
scopedLog.Error(err, "unable to create download directory on operator", "appSrcName", downloadWorker.appSrcName, "appName", appDeployInfo.AppName)
569+
570+
// increment the retry count and mark this app as download pending
571+
updatePplnWorkerPhaseInfo(ctx, appDeployInfo, appDeployInfo.PhaseInfo.FailCount+1, enterpriseApi.AppPkgDownloadPending)
572+
573+
<-downloadWorkersRunPool
574+
continue
575+
}
576+
577+
// get the remoteDataClientMgr instance
578+
remoteDataClientMgr, err := getRemoteDataClientMgr(ctx, downloadWorker.client, downloadWorker.cr, downloadWorker.afwConfig, downloadWorker.appSrcName)
579+
if err != nil {
580+
scopedLog.Error(err, "unable to get remote data client manager")
581+
// increment the retry count and mark this app as download error
582+
updatePplnWorkerPhaseInfo(ctx, appDeployInfo, appDeployInfo.PhaseInfo.FailCount+1, enterpriseApi.AppPkgDownloadError)
583+
584+
<-downloadWorkersRunPool
585+
continue
586+
}
587+
558588
// increment the count in worker waitgroup
559589
downloadWorker.waiter.Add(1)
560590

pkg/splunk/enterprise/util.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,18 +426,24 @@ func appPhaseStatusAsStr(status enterpriseApi.AppPhaseStatusType) string {
426426
switch status {
427427
case enterpriseApi.AppPkgDownloadPending:
428428
return "Download Pending"
429+
case enterpriseApi.AppPkgDownloadInProgress:
430+
return "Download In Progress"
429431
case enterpriseApi.AppPkgDownloadComplete:
430432
return "Download Complete"
431433
case enterpriseApi.AppPkgDownloadError:
432434
return "Download Error"
433435
case enterpriseApi.AppPkgPodCopyPending:
434436
return "Pod Copy Pending"
437+
case enterpriseApi.AppPkgPodCopyInProgress:
438+
return "Pod Copy In Progress"
435439
case enterpriseApi.AppPkgPodCopyComplete:
436440
return "Pod Copy Complete"
437441
case enterpriseApi.AppPkgPodCopyError:
438442
return "Pod Copy Error"
439443
case enterpriseApi.AppPkgInstallPending:
440444
return "Install Pending"
445+
case enterpriseApi.AppPkgInstallInProgress:
446+
return "Install In Progress"
441447
case enterpriseApi.AppPkgInstallComplete:
442448
return "Install Complete"
443449
case enterpriseApi.AppPkgInstallError:
@@ -452,6 +458,8 @@ func bundlePushStateAsStr(ctx context.Context, state enterpriseApi.BundlePushSta
452458
switch state {
453459
case enterpriseApi.BundlePushPending:
454460
return "Bundle Push Pending"
461+
case enterpriseApi.BundlePushInProgress:
462+
return "Bundle Push In Progress"
455463
case enterpriseApi.BundlePushComplete:
456464
return "Bundle Push Complete"
457465
default:

pkg/splunk/enterprise/util_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,11 @@ func TestAppPhaseStatusAsStr(t *testing.T) {
10981098
t.Errorf("Got wrong status. Expected status=Download Pending, Got = %s", status)
10991099
}
11001100

1101+
status = appPhaseStatusAsStr(enterpriseApi.AppPkgDownloadInProgress)
1102+
if status != "Download In Progress" {
1103+
t.Errorf("Got wrong status. Expected status=\"Download In Progress\", Got = %s", status)
1104+
}
1105+
11011106
status = appPhaseStatusAsStr(enterpriseApi.AppPkgDownloadComplete)
11021107
if status != "Download Complete" {
11031108
t.Errorf("Got wrong status. Expected status=\"Download Complete\", Got = %s", status)
@@ -1108,11 +1113,36 @@ func TestAppPhaseStatusAsStr(t *testing.T) {
11081113
t.Errorf("Got wrong status. Expected status=\"Download Error\", Got = %s", status)
11091114
}
11101115

1116+
status = appPhaseStatusAsStr(enterpriseApi.AppPkgPodCopyPending)
1117+
if status != "Pod Copy Pending" {
1118+
t.Errorf("Got wrong status. Expected status=Pod Copy Pending, Got = %s", status)
1119+
}
1120+
1121+
status = appPhaseStatusAsStr(enterpriseApi.AppPkgPodCopyInProgress)
1122+
if status != "Pod Copy In Progress" {
1123+
t.Errorf("Got wrong status. Expected status=\"Pod Copy In Progress\", Got = %s", status)
1124+
}
1125+
1126+
status = appPhaseStatusAsStr(enterpriseApi.AppPkgPodCopyComplete)
1127+
if status != "Pod Copy Complete" {
1128+
t.Errorf("Got wrong status. Expected status=\"Pod Copy Complete\", Got = %s", status)
1129+
}
1130+
1131+
status = appPhaseStatusAsStr(enterpriseApi.AppPkgPodCopyError)
1132+
if status != "Pod Copy Error" {
1133+
t.Errorf("Got wrong status. Expected status=\"Pod Copy Error\", Got = %s", status)
1134+
}
1135+
11111136
status = appPhaseStatusAsStr(enterpriseApi.AppPkgInstallPending)
11121137
if status != "Install Pending" {
11131138
t.Errorf("Got wrong status. Expected status=Install Pending, Got = %s", status)
11141139
}
11151140

1141+
status = appPhaseStatusAsStr(enterpriseApi.AppPkgInstallInProgress)
1142+
if status != "Install In Progress" {
1143+
t.Errorf("Got wrong status. Expected status=\"Install In Progress\", Got = %s", status)
1144+
}
1145+
11161146
status = appPhaseStatusAsStr(enterpriseApi.AppPkgInstallComplete)
11171147
if status != "Install Complete" {
11181148
t.Errorf("Got wrong status. Expected status=\"Install Complete\", Got = %s", status)
@@ -1132,6 +1162,7 @@ func TestAppPhaseStatusAsStr(t *testing.T) {
11321162
func TestBundlePushStateAsStr(t *testing.T) {
11331163
bpsMap := map[enterpriseApi.BundlePushStageType]string{
11341164
enterpriseApi.BundlePushPending: "Bundle Push Pending",
1165+
enterpriseApi.BundlePushInProgress: "Bundle Push In Progress",
11351166
enterpriseApi.BundlePushComplete: "Bundle Push Complete",
11361167
4: "Invalid bundle push state",
11371168
}

0 commit comments

Comments
 (0)