Skip to content

Commit

Permalink
Revert changes from debugging, add --bundle to deploy command, clean …
Browse files Browse the repository at this point in the history
…up other things

Signed-off-by: Dom Del Nano <[email protected]>
  • Loading branch information
ddelnano committed Dec 22, 2024
1 parent da21ad7 commit 54c968a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 32 deletions.
4 changes: 3 additions & 1 deletion src/pixie_cli/pkg/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ var BlockListedLabels = []string{
}

func init() {
DeployCmd.Flags().StringP("bundle", "b", "", "Path/URL to bundle file")
DeployCmd.Flags().StringP("extract_yaml", "e", "", "Directory to extract the Pixie yamls to")
DeployCmd.Flags().StringP("vizier_version", "v", "", "Pixie version to deploy")
DeployCmd.Flags().BoolP("check", "c", true, "Check whether the cluster can run Pixie")
Expand Down Expand Up @@ -105,6 +106,7 @@ var DeployCmd = &cobra.Command{
Use: "deploy",
Short: "Deploys Pixie on the current K8s cluster",
PreRun: func(cmd *cobra.Command, args []string) {
viper.BindPFlag("bundle", cmd.Flags().Lookup("bundle"))
viper.BindPFlag("extract_yaml", cmd.Flags().Lookup("extract_yaml"))
viper.BindPFlag("vizier_version", cmd.Flags().Lookup("vizier_version"))
viper.BindPFlag("check", cmd.Flags().Lookup("check"))
Expand Down Expand Up @@ -640,7 +642,7 @@ func waitForHealthCheck(cloudAddr string, clusterID uuid.UUID, clientset *kubern
err := hc.RunAndMonitor()
if err != nil {
if _, ok := err.(*vizier.HealthCheckWarning); ok {
utils.WithError(err).Error("Failed Pixie healthcheck")
utils.WithError(err).Error("Pixie healthcheck detected the following warnings:")
} else {
_ = pxanalytics.Client().Enqueue(&analytics.Track{
UserId: pxconfig.Cfg().UniqueClientID,
Expand Down
4 changes: 0 additions & 4 deletions src/pixie_cli/pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ func init() {
RootCmd.PersistentFlags().StringP("cloud_addr", "a", defaultCloudAddr, "The address of Pixie Cloud")
viper.BindPFlag("cloud_addr", RootCmd.PersistentFlags().Lookup("cloud_addr"))

RootCmd.PersistentFlags().StringP("log_file", "f", "", "The log file to use instead of stdout")
viper.BindPFlag("log_file", RootCmd.PersistentFlags().Lookup("log_file"))

RootCmd.PersistentFlags().Bool("interactive_cloud_select", false, "Whether to interactively select the cloud address.")
viper.BindPFlag("interactive_cloud_select", RootCmd.PersistentFlags().Lookup("interactive_cloud_select"))

Expand Down Expand Up @@ -104,7 +101,6 @@ func init() {
// Maintain compatibility with old `PL` prefixed env names.
// This will eventually be removed
viper.BindEnv("cloud_addr", "PX_CLOUD_ADDR", "PL_CLOUD_ADDR")
viper.BindEnv("log_file", "PX_LOG_FILE")
viper.BindEnv("testing_env", "PX_TESTING_ENV", "PL_TESTING_ENV")
viper.BindEnv("cli_version", "PX_CLI_VERSION", "PL_CLI_VERSION")
viper.BindEnv("vizier_version", "PX_VIZIER_VERSION", "PL_VIZIER_VERSION")
Expand Down
5 changes: 1 addition & 4 deletions src/pixie_cli/pkg/cmd/script_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ import (
)

const defaultBundleFile = "https://storage.googleapis.com/pixie-prod-artifacts/script-bundles/bundle-core.json"

const ossBundleFile = "https://csmc-io.github.io/pxl-scripts/pxl_scripts/bundle.json"

// const ossBundleFile = "https://artifacts.px.dev/pxl_scripts/bundle.json"
const ossBundleFile = "https://artifacts.px.dev/pxl_scripts/bundle.json"

func mustCreateBundleReader() *script.BundleManager {
br, err := createBundleReader()
Expand Down
4 changes: 2 additions & 2 deletions src/pixie_cli/pkg/vizier/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ func (c *LogCollector) CollectPixieLogs(fName string) error {
if err != nil {
entry := log.WithError(err)
if _, ok := err.(*HealthCheckWarning); ok {
entry.Warn("health check script returned warning")
entry.Warn("healthcheck script detected the following warnings:")
} else {
entry.Warn("failed to run health check script")
entry.Warn("failed to run healthcheck script")
}
}

Expand Down
19 changes: 1 addition & 18 deletions src/pixie_cli/px.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ package main
// It will be responsible for managing and deploy Pixie on a cluster.

import (
"fmt"
"net/http"
_ "net/http/pprof"
"os"
"runtime"
"strings"
Expand All @@ -33,7 +30,6 @@ import (
"github.com/getsentry/sentry-go"
"github.com/segmentio/analytics-go/v3"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"

"px.dev/pixie/src/pixie_cli/pkg/cmd"
"px.dev/pixie/src/pixie_cli/pkg/pxanalytics"
Expand All @@ -46,9 +42,6 @@ import (
const sentryDSN = "https://48c370af36817aad74449b3adc509d78@o4507357617192960.ingest.us.sentry.io/4508004179771392"

func main() {
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
// Disable Sentry in dev mode.
selectedDSN := sentryDSN
if version.GetVersion().IsDev() {
Expand Down Expand Up @@ -89,17 +82,7 @@ func main() {
Event: "Exec Complete",
})

fmt.Printf("Logging to %s %s\n", viper.GetString("log_file"), viper.GetString("cloud_addr"))
if logFile := viper.GetString("log_file"); logFile != "" {
f, err := os.OpenFile(logFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
if err != nil {
utils.Fatal(fmt.Sprintf("Failed to open log file: %s", err))
}
defer f.Close()
log.SetOutput(f)
} else {
log.SetOutput(os.Stderr)
}
log.SetOutput(os.Stderr)
utils.Info("Pixie CLI")
cmd.Execute()
}
5 changes: 2 additions & 3 deletions src/shared/goversion/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ func (v *Version) Semver() semver.Version {

// IsDev returns true if dev build.
func (v *Version) IsDev() bool {
// s := v.buildSemver
return false
// return s.Major == 0 && s.Minor == 0 && s.Patch == 0
s := v.buildSemver
return s.Major == 0 && s.Minor == 0 && s.Patch == 0
}

// GetVersion returns the current version instance.
Expand Down

0 comments on commit 54c968a

Please sign in to comment.