Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ReconcileCmd = &cobra.Command{ Use: "reconcile", Short: "Runs and uploads reports", RunE: func(cmd *cobra.Command, args []string) error { if namespace == "" { return errors.New("namespace not provided") } ctx, cancel := context.WithTimeout(context.Background(), 45*time.Minute) defer cancel() tmpDir := os.TempDir() targets := uploaders.UploaderTargets{} for _, uploadTarget := range uploadTargets { uploadTarget := uploaders.MustParseUploaderTarget(uploadTarget) log.Info("upload target", "target set to", uploadTarget.Name()) switch v := uploadTarget.(type) { case *uploaders.LocalFilePathUploader: v.LocalFilePath = localFilePath } targets = append(targets, uploadTarget) } isDisconnectedBool, err := strconv.ParseBool(isDisconnected) if err != nil { return errors.Wrap(err, "error converting IS_DISCONNECTED to bool") } tlsVersion, err := k8sapiflag.TLSVersion(minVersion) if err != nil { return errors.Wrap(err, "TLS version invalid") } tlsCipherSuites, err := k8sapiflag.TLSCipherSuites(cipherSuites) if err != nil { return errors.Wrap(err, "failed to convert TLS cipher suite name to ID") } cfg := &reporter.Config{ OutputDirectory: tmpDir, Retry: ptr.Int(retry), CaFile: cafile, TokenFile: tokenFile, DataServiceTokenFile: dataServiceTokenFile, DataServiceCertFile: dataServiceCertFile, Local: local, Upload: upload, IsDisconnected: isDisconnectedBool, UploaderTargets: targets, DeployedNamespace: deployedNamespace, PrometheusService: prometheusService, PrometheusNamespace: prometheusNamespace, PrometheusPort: prometheusPort, ReporterSchema: reporterSchema, MinVersion: tlsVersion, CipherSuites: tlsCipherSuites, } err = cfg.SetDefaults() if err != nil { return errors.Wrap(err, "couldn't get defaults") } broadcaster, stopBroadcast, err := reporter.NewEventBroadcaster(cfg) if err != nil { return errors.Wrap(err, "couldn't initialize event broadcaster") } defer stopBroadcast() task, err := reporter.NewReconcileTask( ctx, cfg, broadcaster, reporter.Namespace(namespace), reporter.NewTask, reporter.NewUploadTask, ) if err != nil { return errors.Wrap(err, "couldn't initialize task") } err = task.Run(ctx) if err != nil { return errors.Wrap(err, "error running task") } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.