Skip to content
Open
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
3 changes: 1 addition & 2 deletions cmd/bastion/aws/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

hyperv1 "github.com/openshift/hypershift/api/hypershift/v1beta1"
awsutil "github.com/openshift/hypershift/cmd/infra/aws/util"
"github.com/openshift/hypershift/cmd/log"
"github.com/openshift/hypershift/cmd/util"

"github.com/aws/aws-sdk-go-v2/aws"
Expand Down Expand Up @@ -64,7 +63,7 @@ func NewCreateCommand() *cobra.Command {
_ = cmd.MarkFlagFilename("ssh-key-file")
_ = cmd.MarkFlagFilename("aws-creds")

logger := log.Log
logger := util.NewLogger()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
if err := opts.Validate(); err != nil {
logger.Error(err, "Invalid arguments")
Expand Down
3 changes: 1 addition & 2 deletions cmd/bastion/aws/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

hyperv1 "github.com/openshift/hypershift/api/hypershift/v1beta1"
awsutil "github.com/openshift/hypershift/cmd/infra/aws/util"
"github.com/openshift/hypershift/cmd/log"
"github.com/openshift/hypershift/cmd/util"

"github.com/aws/aws-sdk-go-v2/aws"
Expand Down Expand Up @@ -49,7 +48,7 @@ func NewDestroyCommand() *cobra.Command {
_ = cmd.MarkFlagRequired("aws-creds")
_ = cmd.MarkFlagFilename("aws-creds")

logger := log.Log
logger := util.NewLogger()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
if err := opts.Validate(); err != nil {
logger.Error(err, "Invalid arguments")
Expand Down
4 changes: 2 additions & 2 deletions cmd/cluster/agent/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/openshift/hypershift/cmd/cluster/core"
"github.com/openshift/hypershift/cmd/cluster/none"
"github.com/openshift/hypershift/cmd/log"
cmdutil "github.com/openshift/hypershift/cmd/util"

"github.com/spf13/cobra"
)
Expand All @@ -24,7 +24,7 @@ func NewDestroyCommand(opts *core.DestroyOptions) *cobra.Command {
SilenceUsage: true,
}

logger := log.Log
logger := cmdutil.NewLogger()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
if err := DestroyCluster(cmd.Context(), opts); err != nil {
logger.Error(err, "Failed to destroy cluster")
Expand Down
3 changes: 1 addition & 2 deletions cmd/cluster/aws/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/openshift/hypershift/cmd/cluster/core"
awsinfra "github.com/openshift/hypershift/cmd/infra/aws"
awsutil "github.com/openshift/hypershift/cmd/infra/aws/util"
"github.com/openshift/hypershift/cmd/log"
"github.com/openshift/hypershift/cmd/util"

"k8s.io/apimachinery/pkg/util/errors"
Expand Down Expand Up @@ -38,7 +37,7 @@ func NewDestroyCommand(opts *core.DestroyOptions) *cobra.Command {
opts.AWSPlatform.Credentials.BindFlags(cmd.Flags())
opts.AWSPlatform.VPCOwnerCredentials.BindVPCOwnerFlags(cmd.Flags())

logger := log.Log
logger := util.NewLogger()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
err := ValidateCredentialInfo(opts.AWSPlatform.Credentials, opts.CredentialSecretName, opts.Namespace, opts.Kubeconfig)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions cmd/cluster/azure/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
hyperv1 "github.com/openshift/hypershift/api/hypershift/v1beta1"
"github.com/openshift/hypershift/cmd/cluster/core"
azureinfra "github.com/openshift/hypershift/cmd/infra/azure"
"github.com/openshift/hypershift/cmd/log"
"github.com/openshift/hypershift/cmd/util"
"github.com/openshift/hypershift/support/azureutil"
"github.com/openshift/hypershift/support/config"
Expand Down Expand Up @@ -47,7 +46,7 @@ func NewDestroyCommand(opts *core.DestroyOptions) *cobra.Command {
_ = cmd.MarkFlagRequired("azure-creds")
_ = cmd.MarkFlagRequired("dns-zone-rg-name")

logger := log.Log
logger := util.NewLogger()
cmd.Run = func(cmd *cobra.Command, args []string) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down
6 changes: 3 additions & 3 deletions cmd/cluster/azure/destroy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

hyperv1 "github.com/openshift/hypershift/api/hypershift/v1beta1"
"github.com/openshift/hypershift/cmd/cluster/core"
"github.com/openshift/hypershift/cmd/log"
cmdutil "github.com/openshift/hypershift/cmd/util"
"github.com/openshift/hypershift/support/config"
)

Expand Down Expand Up @@ -71,7 +71,7 @@ func TestDestroyClusterSetsCloudFromHostedCluster(t *testing.T) {
g := NewGomegaWithT(t)
opts := &core.DestroyOptions{
ClusterGracePeriod: 10 * time.Minute,
Log: log.Log,
Log: cmdutil.NewLogger(),
AzurePlatform: core.AzurePlatformDestroyOptions{
CredentialsFile: "/fake/creds",
Location: "eastus",
Expand Down Expand Up @@ -141,7 +141,7 @@ func TestDestroyClusterSetsGracePeriodFromTopology(t *testing.T) {
g := NewGomegaWithT(t)
opts := &core.DestroyOptions{
ClusterGracePeriod: test.initialGracePeriod,
Log: log.Log,
Log: cmdutil.NewLogger(),
AzurePlatform: core.AzurePlatformDestroyOptions{
CredentialsFile: "/fake/creds",
Location: "eastus",
Expand Down
7 changes: 3 additions & 4 deletions cmd/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import (
"github.com/openshift/hypershift/cmd/cluster/none"
"github.com/openshift/hypershift/cmd/cluster/openstack"
"github.com/openshift/hypershift/cmd/cluster/powervs"
"github.com/openshift/hypershift/cmd/log"
"github.com/openshift/hypershift/cmd/util"
cmdutil "github.com/openshift/hypershift/cmd/util"

"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -49,7 +48,7 @@ func NewDestroyCommands() *cobra.Command {
Namespace: "clusters",
Name: "",
ClusterGracePeriod: 10 * time.Minute,
Log: log.Log,
Log: cmdutil.NewLogger(),
DestroyCloudResources: true,
}

Expand All @@ -58,7 +57,7 @@ func NewDestroyCommands() *cobra.Command {
Short: "Destroys a HostedCluster and its associated infrastructure.",
SilenceUsage: true,
}
cmd.PersistentFlags().StringVar(&opts.Kubeconfig, "kubeconfig", opts.Kubeconfig, util.KubeconfigFlagHelp)
cmd.PersistentFlags().StringVar(&opts.Kubeconfig, "kubeconfig", opts.Kubeconfig, cmdutil.KubeconfigFlagHelp)
cmd.PersistentFlags().StringVar(&opts.Namespace, "namespace", opts.Namespace, "A cluster namespace")
cmd.PersistentFlags().StringVar(&opts.Name, "name", opts.Name, "A cluster name (required)")
cmd.PersistentFlags().DurationVar(&opts.ClusterGracePeriod, "cluster-grace-period", opts.ClusterGracePeriod, "How long to wait for the cluster to be deleted before forcibly destroying its infra")
Expand Down
3 changes: 1 addition & 2 deletions cmd/cluster/core/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

hyperv1 "github.com/openshift/hypershift/api/hypershift/v1beta1"
"github.com/openshift/hypershift/api/util/ipnet"
"github.com/openshift/hypershift/cmd/log"
"github.com/openshift/hypershift/cmd/util"
hyperapi "github.com/openshift/hypershift/support/api"
"github.com/openshift/hypershift/support/certs"
Expand Down Expand Up @@ -49,7 +48,7 @@ func DefaultOptions() *RawCreateOptions {
ServiceCIDR: []string{globalconfig.DefaultIPv4ServiceCIDR},
ClusterCIDR: []string{globalconfig.DefaultIPv4ClusterCIDR},
MachineCIDR: []string{},
Log: log.Log,
Log: util.NewLogger(),
Arch: "amd64",
OLMCatalogPlacement: hyperv1.ManagementOLMCatalogPlacement,
NetworkType: string(hyperv1.OVNKubernetes),
Expand Down
6 changes: 3 additions & 3 deletions cmd/cluster/core/destroy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

. "github.com/onsi/gomega"

"github.com/openshift/hypershift/cmd/log"
cmdutil "github.com/openshift/hypershift/cmd/util"
)

func TestDestroyCluster(t *testing.T) {
Expand All @@ -28,7 +28,7 @@ func TestDestroyCluster(t *testing.T) {
Name: "test-cluster",
Namespace: "clusters",
InfraID: "test-infra",
Log: log.Log,
Log: cmdutil.NewLogger(),
AzurePlatform: AzurePlatformDestroyOptions{
Cloud: "AzurePublicCloud",
Location: "eastus",
Expand Down Expand Up @@ -59,7 +59,7 @@ func TestDestroyCluster(t *testing.T) {
Name: "test-cluster",
Namespace: "clusters",
InfraID: "test-infra",
Log: log.Log,
Log: cmdutil.NewLogger(),
}

err := DestroyCluster(context.Background(), nil, opts, mockPlatformSpecifics)
Expand Down
3 changes: 1 addition & 2 deletions cmd/cluster/core/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
hyperv1 "github.com/openshift/hypershift/api/hypershift/v1beta1"
hyperkarpenterv1 "github.com/openshift/hypershift/api/karpenter/v1"
scheduling "github.com/openshift/hypershift/api/scheduling/v1alpha1"
"github.com/openshift/hypershift/cmd/log"
"github.com/openshift/hypershift/cmd/util"
"github.com/openshift/hypershift/hypershift-operator/controllers/manifests"
"github.com/openshift/hypershift/hypershift-operator/controllers/sharedingress"
Expand Down Expand Up @@ -150,7 +149,7 @@ func NewDumpCommand() *cobra.Command {
ArtifactDir: "",
ArchiveDump: true,
AgentNamespace: "",
Log: log.Log,
Log: util.NewLogger(),
}

cmd.Flags().StringVar(&opts.Namespace, "namespace", opts.Namespace, "The namespace of the hostedcluster to dump")
Expand Down
4 changes: 2 additions & 2 deletions cmd/cluster/gcp/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/openshift/hypershift/cmd/cluster/core"
"github.com/openshift/hypershift/cmd/log"
cmdutil "github.com/openshift/hypershift/cmd/util"

"github.com/spf13/cobra"
)
Expand All @@ -17,7 +17,7 @@ func NewDestroyCommand(opts *core.DestroyOptions) *cobra.Command {
SilenceUsage: true,
}

logger := log.Log
logger := cmdutil.NewLogger()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
if err := DestroyCluster(cmd.Context(), opts); err != nil {
logger.Error(err, "Failed to destroy cluster")
Expand Down
4 changes: 2 additions & 2 deletions cmd/cluster/kubevirt/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package kubevirt
import (
"github.com/openshift/hypershift/cmd/cluster/core"
"github.com/openshift/hypershift/cmd/cluster/none"
"github.com/openshift/hypershift/cmd/log"
cmdutil "github.com/openshift/hypershift/cmd/util"

"github.com/spf13/cobra"
)
Expand All @@ -15,7 +15,7 @@ func NewDestroyCommand(opts *core.DestroyOptions) *cobra.Command {
SilenceUsage: true,
}

logger := log.Log
logger := cmdutil.NewLogger()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
if err := none.DestroyCluster(cmd.Context(), opts); err != nil {
logger.Error(err, "Failed to destroy cluster")
Expand Down
4 changes: 2 additions & 2 deletions cmd/cluster/none/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

"github.com/openshift/hypershift/cmd/cluster/core"
"github.com/openshift/hypershift/cmd/log"
cmdutil "github.com/openshift/hypershift/cmd/util"

"k8s.io/apimachinery/pkg/util/errors"

Expand All @@ -19,7 +19,7 @@ func NewDestroyCommand(opts *core.DestroyOptions) *cobra.Command {
SilenceUsage: true,
}

logger := log.Log
logger := cmdutil.NewLogger()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
if err := DestroyCluster(cmd.Context(), opts); err != nil {
logger.Error(err, "Failed to destroy cluster")
Expand Down
4 changes: 2 additions & 2 deletions cmd/cluster/openstack/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"syscall"

"github.com/openshift/hypershift/cmd/cluster/core"
"github.com/openshift/hypershift/cmd/log"
cmdutil "github.com/openshift/hypershift/cmd/util"

"k8s.io/apimachinery/pkg/util/errors"

Expand All @@ -22,7 +22,7 @@ func NewDestroyCommand(opts *core.DestroyOptions) *cobra.Command {
SilenceUsage: true,
}

logger := log.Log
logger := cmdutil.NewLogger()
cmd.Run = func(cmd *cobra.Command, args []string) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down
4 changes: 2 additions & 2 deletions cmd/cluster/powervs/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/openshift/hypershift/cmd/cluster/core"
powervsinfra "github.com/openshift/hypershift/cmd/infra/powervs"
"github.com/openshift/hypershift/cmd/log"
cmdutil "github.com/openshift/hypershift/cmd/util"

"k8s.io/apimachinery/pkg/util/errors"

Expand Down Expand Up @@ -48,7 +48,7 @@ func NewDestroyCommand(opts *core.DestroyOptions) *cobra.Command {
_ = cmd.Flags().MarkHidden("vpc")
_ = cmd.Flags().MarkHidden("transit-gateway")

logger := log.Log
logger := cmdutil.NewLogger()
cmd.Run = func(cmd *cobra.Command, args []string) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down
7 changes: 3 additions & 4 deletions cmd/consolelogs/aws/getlogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (

hyperv1 "github.com/openshift/hypershift/api/hypershift/v1beta1"
awsutil "github.com/openshift/hypershift/cmd/infra/aws/util"
"github.com/openshift/hypershift/cmd/log"
"github.com/openshift/hypershift/cmd/util"
cmdutil "github.com/openshift/hypershift/cmd/util"
"github.com/openshift/hypershift/support/awsapi"

"github.com/aws/aws-sdk-go-v2/aws"
Expand Down Expand Up @@ -52,7 +51,7 @@ func NewCommand() *cobra.Command {
_ = cmd.MarkFlagRequired("name")
_ = cmd.MarkFlagRequired("output-dir")

logger := log.Log
logger := cmdutil.NewLogger()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
err := opts.AWSCredentialsOpts.Validate()
if err != nil {
Expand All @@ -70,7 +69,7 @@ func NewCommand() *cobra.Command {
}

func (o *ConsoleLogOpts) Run(ctx context.Context) error {
c, err := util.GetClient()
c, err := cmdutil.GetClient()
if err != nil {
return err
}
Expand Down
9 changes: 4 additions & 5 deletions cmd/infra/aws/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
"time"

awsutil "github.com/openshift/hypershift/cmd/infra/aws/util"
"github.com/openshift/hypershift/cmd/log"
"github.com/openshift/hypershift/cmd/util"
cmdutil "github.com/openshift/hypershift/cmd/util"
"github.com/openshift/hypershift/support/awsapi"

"github.com/aws/aws-sdk-go-v2/aws"
Expand Down Expand Up @@ -47,7 +46,7 @@ type CreateInfraOptions struct {
SingleNATGateway bool
VPCCIDR string

CredentialsSecretData *util.CredentialsSecretData
CredentialsSecretData *cmdutil.CredentialsSecretData

VPCOwnerCredentialOpts awsutil.AWSCredentialsOptions
PrivateZonesInClusterAccount bool
Expand Down Expand Up @@ -129,7 +128,7 @@ func NewCreateCommand() *cobra.Command {
opts.AWSCredentialsOpts.BindFlags(cmd.Flags())
opts.VPCOwnerCredentialOpts.BindVPCOwnerFlags(cmd.Flags())

l := log.Log
l := cmdutil.NewLogger()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
err := opts.AWSCredentialsOpts.Validate()
if err != nil {
Expand Down Expand Up @@ -528,7 +527,7 @@ func (o *CreateInfraOptions) createProxyHost(ctx context.Context, l logr.Logger,

var result proxyInfo

publicSSHKey, privateSSHKey, err := util.GenerateSSHKeys()
publicSSHKey, privateSSHKey, err := cmdutil.GenerateSSHKeys()
if err != nil {
return nil, fmt.Errorf("failed to generate proxy ssh keys: %w", err)
}
Expand Down
6 changes: 4 additions & 2 deletions cmd/infra/aws/create_cli_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

awsutil "github.com/openshift/hypershift/cmd/infra/aws/util"
"github.com/openshift/hypershift/cmd/log"
cmdutil "github.com/openshift/hypershift/cmd/util"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/iam"
Expand Down Expand Up @@ -175,7 +175,9 @@ func NewCreateCLIRoleCommand() *cobra.Command {
cmd.Flags().StringVar(&opts.RoleName, "name", opts.RoleName, "Role name")
cmd.Flags().StringToStringVarP(&opts.AdditionalTags, "additional-tags", "t", opts.AdditionalTags, "Additional tags to apply to the role created (e.g. 'key1=value1,key2=value2')")

logger := log.Log
_ = cmd.MarkFlagRequired("aws-creds")

logger := cmdutil.NewLogger()
cmd.RunE = func(cmd *cobra.Command, args []string) error {
if err := opts.Run(cmd.Context(), logger); err != nil {
logger.Error(err, "failed to create cli role")
Expand Down
Loading
Loading