Skip to content

Commit

Permalink
Merge branch 'master' into fix-codecov-ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
MatousJobanek authored Apr 3, 2024
2 parents 40c458d + b786246 commit 54105ff
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 22 deletions.
2 changes: 0 additions & 2 deletions pkg/cmd/adm/adm.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ func NewAdmCmd() *cobra.Command {
func registerCommands(admCommand *cobra.Command) {
// commands with go runtime client
admCommand.AddCommand(NewRestartCmd())
admCommand.AddCommand(NewSetupCmd())
admCommand.AddCommand(NewGenerateCliConfigsCmd())
admCommand.AddCommand(NewUnregisterMemberCmd())
admCommand.AddCommand(NewMustGatherNamespaceCmd())

Expand Down
10 changes: 5 additions & 5 deletions pkg/cmd/adm/setup.go → pkg/cmd/generate/admin-manifests.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"os"
Expand All @@ -19,12 +19,12 @@ type setupFlags struct {
singleCluster bool
}

func NewSetupCmd() *cobra.Command {
func NewAdminManifestsCmd() *cobra.Command {
f := setupFlags{}
command := &cobra.Command{
Use: "setup --kubesaw-admins=<path-to-kubesaw-admins-file> --out-dir <path-to-out-dir>",
Example: `ksctl adm setup ./path/to/kubesaw.openshiftapps.com/kubesaw-admins.yaml --out-dir ./components/auth/kubesaw-production
ksctl adm setup ./path/to/kubesaw-stage.openshiftapps.com/kubesaw-admins.yaml --out-dir ./components/auth/kubesaw-staging -s`,
Use: "admin-manifests --kubesaw-admins=<path-to-kubesaw-admins-file> --out-dir <path-to-out-dir>",
Example: `ksctl generate admin-manifests ./path/to/kubesaw.openshiftapps.com/kubesaw-admins.yaml --out-dir ./components/auth/kubesaw-production
ksctl generate admin-manifests ./path/to/kubesaw-stage.openshiftapps.com/kubesaw-admins.yaml --out-dir ./components/auth/kubesaw-staging -s`,
Short: "Generates user-management manifests",
Long: `Reads the kubesaw-admins.yaml file and based on the content it generates user-management RBAC and manifests.`,
Args: cobra.ExactArgs(0),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"encoding/json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"context"
Expand Down Expand Up @@ -33,10 +33,10 @@ type generateFlags struct {
kubeconfigs []string
}

func NewGenerateCliConfigsCmd() *cobra.Command {
func NewCliConfigsCmd() *cobra.Command {
f := generateFlags{}
command := &cobra.Command{
Use: "generate-cli-configs --kubesaw-admins=<path-to-kubesaw-admins-file>",
Use: "cli-configs --kubesaw-admins=<path-to-kubesaw-admins-file>",
Short: "Generate ksctl.yaml files",
Long: `Generate ksctl.yaml files, that is used by ksctl, for every ServiceAccount defined in the given kubesaw-admins.yaml file`,
Args: cobra.ExactArgs(0),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"encoding/json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"github.com/kubesaw/ksctl/pkg/configuration"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"fmt"
Expand Down
20 changes: 20 additions & 0 deletions pkg/cmd/generate/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package generate

import (
"github.com/spf13/cobra"
)

func NewGenerateCmd() *cobra.Command {
admCommand := &cobra.Command{
Use: "generate",
Short: "Generate commands",
Long: `Commands to generate manifests and CLI config files`,
}
registerCommands(admCommand)
return admCommand
}

func registerCommands(admCommand *cobra.Command) {
admCommand.AddCommand(NewAdminManifestsCmd())
admCommand.AddCommand(NewCliConfigsCmd())
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/adm/setup_util.go → pkg/cmd/generate/util.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package adm
package generate

import (
"fmt"
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"

"github.com/kubesaw/ksctl/pkg/cmd/adm"
"github.com/kubesaw/ksctl/pkg/cmd/generate"
"github.com/kubesaw/ksctl/pkg/configuration"
"github.com/kubesaw/ksctl/pkg/version"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -56,6 +57,7 @@ func init() {

// administrative commands
rootCmd.AddCommand(adm.NewAdmCmd())
rootCmd.AddCommand(generate.NewGenerateCmd())

// also, by default, we're configuring the underlying http.Client to accept insecured connections.
// but gopkg.in/h2non/gock.v1 may change the client's Transport to intercept the requests.
Expand Down

0 comments on commit 54105ff

Please sign in to comment.