Refactor version/feature/cmd packages (#148)

Signed-off-by: Jian Qiu <jqiu@redhat.com>
This commit is contained in:
Jian Qiu
2023-05-30 14:07:32 +08:00
committed by GitHub
parent ad38b9465f
commit 116ae8cc28
45 changed files with 170 additions and 343 deletions

View File

@@ -4,6 +4,7 @@ import (
goflag "flag"
"fmt"
"math/rand"
"open-cluster-management.io/ocm/pkg/cmd/hub"
"os"
"time"
@@ -13,8 +14,7 @@ import (
utilflag "k8s.io/component-base/cli/flag"
"k8s.io/component-base/logs"
"open-cluster-management.io/ocm/pkg/placement/cmd/hub"
"open-cluster-management.io/ocm/pkg/placement/version"
"open-cluster-management.io/ocm/pkg/version"
)
func main() {
@@ -49,7 +49,7 @@ func newPlacementCommand() *cobra.Command {
cmd.Version = v
}
cmd.AddCommand(hub.NewController())
cmd.AddCommand(hub.NewPlacementController())
return cmd
}

View File

@@ -4,6 +4,8 @@ import (
goflag "flag"
"fmt"
"math/rand"
"open-cluster-management.io/ocm/pkg/cmd/hub"
"open-cluster-management.io/ocm/pkg/cmd/spoke"
"os"
"time"
@@ -13,8 +15,7 @@ import (
utilflag "k8s.io/component-base/cli/flag"
"k8s.io/component-base/logs"
"open-cluster-management.io/ocm/pkg/registration-operator/cmd/operator"
"open-cluster-management.io/ocm/pkg/registration-operator/version"
"open-cluster-management.io/ocm/pkg/version"
)
func main() {
@@ -50,8 +51,8 @@ func newNucleusCommand() *cobra.Command {
cmd.Version = v
}
cmd.AddCommand(operator.NewHubOperatorCmd())
cmd.AddCommand(operator.NewKlusterletOperatorCmd())
cmd.AddCommand(hub.NewHubOperatorCmd())
cmd.AddCommand(spoke.NewKlusterletOperatorCmd())
return cmd
}

View File

@@ -4,6 +4,8 @@ import (
goflag "flag"
"fmt"
"math/rand"
"open-cluster-management.io/ocm/pkg/cmd/hub"
"open-cluster-management.io/ocm/pkg/cmd/spoke"
"os"
"time"
@@ -13,10 +15,8 @@ import (
utilflag "k8s.io/component-base/cli/flag"
"k8s.io/component-base/logs"
"open-cluster-management.io/ocm/pkg/registration/cmd/hub"
"open-cluster-management.io/ocm/pkg/registration/cmd/spoke"
"open-cluster-management.io/ocm/pkg/registration/cmd/webhook"
"open-cluster-management.io/ocm/pkg/registration/version"
"open-cluster-management.io/ocm/pkg/cmd/webhook"
"open-cluster-management.io/ocm/pkg/version"
)
// The registration binary contains both the hub-side controllers for the
@@ -57,8 +57,8 @@ func newRegistrationCommand() *cobra.Command {
cmd.Version = v
}
cmd.AddCommand(hub.NewController())
cmd.AddCommand(spoke.NewAgent())
cmd.AddCommand(webhook.NewWebhook())
cmd.AddCommand(hub.NewRegistrationController())
cmd.AddCommand(spoke.NewRegistrationAgent())
cmd.AddCommand(webhook.NewRegistrationWebhook())
return cmd
}

View File

@@ -4,6 +4,8 @@ import (
goflag "flag"
"fmt"
"math/rand"
"open-cluster-management.io/ocm/pkg/cmd/hub"
"open-cluster-management.io/ocm/pkg/cmd/spoke"
"os"
"time"
@@ -13,10 +15,8 @@ import (
utilflag "k8s.io/component-base/cli/flag"
"k8s.io/component-base/logs"
"open-cluster-management.io/ocm/pkg/work/cmd/hub"
"open-cluster-management.io/ocm/pkg/work/cmd/spoke"
"open-cluster-management.io/ocm/pkg/work/cmd/webhook"
"open-cluster-management.io/ocm/pkg/work/version"
"open-cluster-management.io/ocm/pkg/cmd/webhook"
"open-cluster-management.io/ocm/pkg/version"
)
func main() {
@@ -52,8 +52,8 @@ func newWorkCommand() *cobra.Command {
cmd.Version = v
}
cmd.AddCommand(spoke.NewWorkloadAgent())
cmd.AddCommand(webhook.NewWebhook())
cmd.AddCommand(hub.NewHubManager())
cmd.AddCommand(spoke.NewWorkAgent())
cmd.AddCommand(webhook.NewWorkWebhook())
cmd.AddCommand(hub.NewWorkController())
return cmd
}