Skip to content

Commit

Permalink
remove the service command
Browse files Browse the repository at this point in the history
  • Loading branch information
rocktavious committed Sep 1, 2023
1 parent 410899f commit 45848ee
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var importCmd = &cobra.Command{
}

func init() {
serviceCmd.AddCommand(importCmd)
rootCmd.AddCommand(importCmd)
}

func runImport(cmd *cobra.Command, args []string) {
Expand Down
14 changes: 10 additions & 4 deletions src/cmd/preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If SAMPLES_COUNT=0 this will print out everything.`,
}

func init() {
serviceCmd.AddCommand(previewCmd)
rootCmd.AddCommand(previewCmd)
}

func runPreview(cmd *cobra.Command, args []string) {
Expand All @@ -51,7 +51,9 @@ func runPreview(cmd *cobra.Command, args []string) {
samples = servicesCount
}

if IsTextOutput() { fmt.Print("The following data was found in your Kubernetes cluster ...\n\n") }
if IsTextOutput() {
fmt.Print("The following data was found in your Kubernetes cluster ...\n\n")
}
if len(services) == 0 {
fmt.Printf("[]\n")
} else {
Expand All @@ -61,11 +63,15 @@ func runPreview(cmd *cobra.Command, args []string) {
}
fmt.Printf("%s\n", string(prettyJSON))
if samples < servicesCount {
if IsTextOutput() { fmt.Printf("\nShowing %v / %v resources\n", samples, servicesCount) }
if IsTextOutput() {
fmt.Printf("\nShowing %v / %v resources\n", samples, servicesCount)
}
}
}

if IsTextOutput() { fmt.Println("\nIf you're happy with the above data you can reconcile it with OpsLevel by running:\n\n OPSLEVEL_API_TOKEN=XXX kubectl opslevel service import\n\nOtherwise, please adjust the config file and rerun this command") }
if IsTextOutput() {
fmt.Println("\nIf you're happy with the above data you can reconcile it with OpsLevel by running:\n\n OPSLEVEL_API_TOKEN=XXX kubectl opslevel service import\n\nOtherwise, please adjust the config file and rerun this command")
}
}

func sample(data []common.ServiceRegistration, samples int) []common.ServiceRegistration {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var reconcileCmd = &cobra.Command{
}

func init() {
serviceCmd.AddCommand(reconcileCmd)
rootCmd.AddCommand(reconcileCmd)

reconcileCmd.Flags().IntVar(&reconcileResyncInterval, "resync", 24, "The amount (in hours) before a full resync of the kubernetes cluster happens with OpsLevel. [default: 24]")
reconcileCmd.Flags().IntVar(&reconcileBatchSize, "batch", 500, "The max amount of k8s resources to batch process with jq. Helps to speedup initial startup. [default: 500]")
Expand Down

0 comments on commit 45848ee

Please sign in to comment.