Skip to content

Commit

Permalink
fix: Unable to get k8s cluster configuration (#3017)
Browse files Browse the repository at this point in the history
Co-authored-by: alexlokshin-czi <[email protected]>
  • Loading branch information
alexlokshin-czi and alexlokshin-czi committed Feb 9, 2024
1 parent 775d3a7 commit 3677c7c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cli/COVERAGE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.76
20.67
2 changes: 1 addition & 1 deletion cli/cmd/COVERAGE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.0
10.8
10 changes: 3 additions & 7 deletions cli/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ var (
stack string
fromEnv string
fromStack string
logger *logrus.Logger
reveal bool
v2 bool
)

func init() {
logger = logrus.New()
logger.SetLevel(logrus.InfoLevel)

rootCmd.AddCommand(configCmd)
config.ConfigureCmdWithBootstrapConfig(configCmd)
configCmd.PersistentFlags().StringVarP(&stack, "stack", "s", "", "Specify the stack that this applies to")
Expand Down Expand Up @@ -187,7 +183,7 @@ var configGetCmd = &cobra.Command{
Short: "get config",
Long: "Get the config for the given app, env, stack, and key",
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(cmd *cobra.Command, args []string) error {
checklist := util.NewValidationCheckList()
return util.ValidateEnvironment(cmd.Context(),
checklist.TerraformInstalled,
Expand Down Expand Up @@ -263,7 +259,7 @@ var configSetCmd = &cobra.Command{
Short: "set config",
Long: "Set the config for the given app, env, stack, and key to the provided value",
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(cmd *cobra.Command, args []string) error {
checklist := util.NewValidationCheckList()
return util.ValidateEnvironment(cmd.Context(),
checklist.TerraformInstalled,
Expand Down Expand Up @@ -333,7 +329,7 @@ var configDeleteCmd = &cobra.Command{
Short: "delete config",
Long: "Delete the config for the given app, env, stack, and key",
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(cmd *cobra.Command, args []string) error {
checklist := util.NewValidationCheckList()
return util.ValidateEnvironment(cmd.Context(),
checklist.TerraformInstalled,
Expand Down
1 change: 1 addition & 0 deletions cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ var rootCmd = &cobra.Command{
return errors.Wrap(err, "missing verbose flag")
}
if verbose {
log.Info("Running in verbose mode")
log.SetLevel(log.DebugLevel)
log.SetReportCaller(true)
}
Expand Down
15 changes: 15 additions & 0 deletions shared/backend/aws/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ func NewAWSBackend(

// Create an AWS session if we don't have one
if b.awsConfig == nil {
logrus.Debug("Creating an AWS Config:\n")
if b.awsRegion != nil {
logrus.Debugf("\tRegion: %s\n", *b.awsRegion)
}
if b.awsProfile != nil {
logrus.Debugf("\tProfile: %s\n", *b.awsProfile)
}
if b.awsAccountID != nil {
logrus.Debugf("\tAccountID: %s\n", *b.awsAccountID)
}
if b.awsRoleArn != nil {
logrus.Debugf("\tRoleArn: %s\n", *b.awsRoleArn)
}

options := []func(*configv2.LoadOptions) error{
configv2.WithRegion(*b.awsRegion),
configv2.WithRetryer(func() aws.Retryer {
Expand Down Expand Up @@ -176,6 +190,7 @@ func NewAWSBackend(
}

if b.eksclient == nil {
logrus.Debugf("Creating an EKS client: region=%s. \n", b.awsConfig.Region)
b.eksclient = eks.NewFromConfig(*b.awsConfig)
}

Expand Down

0 comments on commit 3677c7c

Please sign in to comment.