Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .openshift-ci/tests/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ export ENABLE_DB_PORT_FORWARDING="false"

if [[ "$SPAWN_LOGGER" == "true" ]]; then
# Need to create the namespaces prior to spawning the stern loggers.
apply "${MANIFESTS_DIR}/shared/00-namespace.yaml"
# The namespace will be created later anyway, so this pre-creation for stern is best-effort.
# If it fails, the loggers just won't capture the earliest bootstrap output.
apply "${MANIFESTS_DIR}/shared/00-namespace.yaml" || true
sleep 2
log "Spawning logger, log directory is ${LOG_DIR}"
stern -n "$ACSCS_NAMESPACE" '.*' --color=never --template '[{{.ContainerName}}] {{.Message}}{{"\n"}}' >"${LOG_DIR}/namespace-${ACSCS_NAMESPACE}.txt" 2>&1 &
Expand Down
2 changes: 0 additions & 2 deletions cmd/acsfleetctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"os"

"github.com/spf13/cobra"
"github.com/stackrox/acs-fleet-manager/internal/central/pkg/cmd/admin"
"github.com/stackrox/acs-fleet-manager/internal/central/pkg/cmd/centrals"
gitopsCmd "github.com/stackrox/acs-fleet-manager/internal/central/pkg/gitops/cmd"
)
Expand All @@ -26,6 +25,5 @@ func main() {

func setupSubCommands(rootCmd *cobra.Command) {
rootCmd.AddCommand(centrals.NewCentralsCommand())
rootCmd.AddCommand(admin.NewAdminCommand())
rootCmd.AddCommand(gitopsCmd.NewGitOpsCommand())
}
40 changes: 20 additions & 20 deletions cmd/fleet-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ package main

import (
"flag"
"fmt"
"os"

"github.com/stackrox/acs-fleet-manager/internal/central/pkg/cmd/admin"
"github.com/stackrox/acs-fleet-manager/pkg/cmd/migrate"
"github.com/stackrox/acs-fleet-manager/pkg/cmd/serve"

Expand All @@ -19,8 +22,6 @@ func main() {
// parsed.
_ = flag.CommandLine.Parse([]string{})

// pflag.CommandLine.AddGoFlagSet(flag.CommandLine)

// Always log to stderr by default
if err := flag.Set("logtostderr", "true"); err != nil {
glog.Infof("Unable to set logtostderr to true")
Expand All @@ -30,32 +31,31 @@ func main() {
central.ConfigProviders(),
)
if err != nil {
glog.Fatalf("error initializing: %v", err)
_, _ = fmt.Fprintf(os.Stderr, "error initializing: %v\n", err)
os.Exit(1)
}
defer env.Cleanup()
rootCmd := rootCommand(env)

if err := env.AddFlags(rootCmd.PersistentFlags()); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "unable to add global flags: %v\n", err)
os.Exit(1)
}
err = rootCmd.Execute()
env.Cleanup()
if err != nil {
os.Exit(1)
}
}

func rootCommand(env *environments.Env) *cobra.Command {
rootCmd := &cobra.Command{
Use: "fleet-manager",
Long: "fleet-manager is a service that exposes a Rest API to manage ACS Central instances.",
}

err = env.AddFlags(rootCmd.PersistentFlags())
if err != nil {
glog.Fatalf("Unable to add global flags: %s", err.Error())
}

rootCmd.AddCommand(admin.NewAdminCommand())
rootCmd.AddCommand(migrate.NewMigrateCommand(env))
rootCmd.AddCommand(serve.NewServeCommand(env))
// Unsupported CLI commands. Eventually some of them can be removed.
// rootCmd.AddCommand(cluster.NewClusterCommand(env))
// rootCmd.AddCommand(cloudprovider.NewCloudProviderCommand(env))
// rootCmd.AddCommand(errors.NewErrorsCommand(env))

if err := rootCmd.Execute(); err != nil {
glog.Fatalf("error running command: %v", err)
}

if err != nil {
glog.Fatalf("Unable to initialize environment: %s", err.Error())
}
return rootCmd
}
5 changes: 4 additions & 1 deletion dev/env/scripts/apply
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -eo pipefail

## This script can apply Kubernetes manifests provided as parameters -- either individual files or directories with manifests.

Expand All @@ -19,7 +20,9 @@ apply_res() {
for path in "$@"; do

if [[ -d "$path" ]]; then
find "$path" -name "*.yaml" -type f | sort -n | while read -r f; do
mapfile -t files < <(find "$path" -name "*.yaml" -type f | sort -n)
wait "$!" || { log "Failed to discover manifests in '${path}'"; exit 1; }
for f in "${files[@]}"; do
apply_res "$f"
done
else
Expand Down
2 changes: 2 additions & 0 deletions internal/central/pkg/api/admin/private/api/openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 20 additions & 19 deletions internal/central/pkg/api/admin/private/model_central.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions internal/central/pkg/cmd/admin/centrals/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const (
// NewAdminCentralsCommand creates a new admin central command.
func NewAdminCentralsCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "centrals",
Aliases: []string{"central"},
Short: "Perform admin central API calls.",
Long: "Perform admin central API calls.",
PersistentPreRun: func(cmd *cobra.Command, args []string) {},
Use: "centrals",
Aliases: []string{"central"},
Short: "Perform admin central API calls.",
Long: "Perform admin central API calls.",
}
cmd.AddCommand(
NewAdminCentralsListCommand(),
NewAdminReportCommand(),
)

return cmd
Expand Down
2 changes: 1 addition & 1 deletion internal/central/pkg/cmd/admin/centrals/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func NewAdminCentralsListCommand() *cobra.Command {
Short: "lists all managed central requests",
Long: "lists all managed central requests",
Run: func(cmd *cobra.Command, args []string) {
runList(fleetmanagerclient.AuthenticatedClientWithRHOASToken(cmd.Context()), cmd, args)
runList(fleetmanagerclient.ClientFromContext(cmd.Context()), cmd, args)
},
}
return cmd
Expand Down
Loading
Loading