-
Notifications
You must be signed in to change notification settings - Fork 88
/
preflight_airgap.go
45 lines (39 loc) · 1.33 KB
/
preflight_airgap.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package reporting
import (
"time"
"github.com/pkg/errors"
"github.com/replicatedhq/kots/pkg/buildversion"
storetypes "github.com/replicatedhq/kots/pkg/store/types"
"github.com/replicatedhq/kots/pkg/util"
kotsv1beta1 "github.com/replicatedhq/kotskinds/apis/kots/v1beta1"
)
func (r *AirgapReporter) SubmitPreflightData(license *kotsv1beta1.License, appID string, clusterID string, sequence int64, skipPreflights bool, installStatus storetypes.DownstreamVersionStatus, isCLI bool, preflightStatus string, appStatus string) error {
app, err := r.store.GetApp(appID)
if err != nil {
if r.store.IsNotFound(err) {
return nil
}
return errors.Wrap(err, "failed to get airgapped app")
}
report := &PreflightReport{
Events: []PreflightReportEvent{
{
ReportedAt: time.Now().UTC().UnixMilli(),
LicenseID: license.Spec.LicenseID,
InstanceID: appID,
ClusterID: clusterID,
Sequence: sequence,
SkipPreflights: skipPreflights,
InstallStatus: string(installStatus),
IsCLI: isCLI,
PreflightStatus: preflightStatus,
AppStatus: appStatus,
UserAgent: buildversion.GetUserAgent(),
},
},
}
if err := AppendReport(r.clientset, util.PodNamespace, app.Slug, report); err != nil {
return errors.Wrap(err, "failed to append preflight report")
}
return nil
}