Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Apr 23, 2024
1 parent 34120ef commit a62a6ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions internal/defaults/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (d envDefaultValue[_]) MarkdownDescription(_ context.Context) string {
}

func (d envDefaultValue[T]) DefaultString(_ context.Context, _ defaults.StringRequest, resp *defaults.StringResponse) {
value := interface{}(d.defaultValue)
value := any(d.defaultValue)
if v := os.Getenv(d.envVar); len(v) > 0 {
value = v
}
Expand All @@ -48,7 +48,7 @@ func (d envDefaultValue[T]) DefaultString(_ context.Context, _ defaults.StringRe
}

func (d envDefaultValue[T]) DefaultBool(_ context.Context, _ defaults.BoolRequest, resp *defaults.BoolResponse) {
value := interface{}(d.defaultValue)
value := any(d.defaultValue)
if v := os.Getenv(d.envVar); len(v) > 0 {
value = v == "true"
}
Expand Down
6 changes: 3 additions & 3 deletions internal/resource/cluster_kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func newKubeconfig(ctx context.Context, kubeconfig *Kubeconfig, namespace *strin
loader := &clientcmd.ClientConfigLoadingRules{}

if !lo.IsEmpty(kubeconfig.ConfigPath.ValueString()) {
tflog.Info(ctx, "using kubeconfig", map[string]interface{}{
tflog.Info(ctx, "using kubeconfig", map[string]any{
"kubeconfig": kubeconfig.ConfigPath.ValueString(),
})

Expand All @@ -79,7 +79,7 @@ func newKubeconfig(ctx context.Context, kubeconfig *Kubeconfig, namespace *strin
if !lo.IsEmpty(kubeconfig.ConfigContext.ValueString()) || !lo.IsEmpty(kubeconfig.ConfigContextAuthInfo.ValueString()) || !lo.IsEmpty(kubeconfig.ConfigContextCluster.ValueString()) {
if !lo.IsEmpty(kubeconfig.ConfigContext.ValueString()) {
overrides.CurrentContext = kubeconfig.ConfigContext.ValueString()
tflog.Info(ctx, "using custom current context", map[string]interface{}{
tflog.Info(ctx, "using custom current context", map[string]any{
"context": overrides.CurrentContext,
})
}
Expand All @@ -91,7 +91,7 @@ func newKubeconfig(ctx context.Context, kubeconfig *Kubeconfig, namespace *strin
if !lo.IsEmpty(kubeconfig.ConfigContextCluster.ValueString()) {
overrides.Context.Cluster = kubeconfig.ConfigContextCluster.ValueString()
}
tflog.Info(ctx, "using overridden context", map[string]interface{}{
tflog.Info(ctx, "using overridden context", map[string]any{
"context": overrides.Context,
})
}
Expand Down
10 changes: 5 additions & 5 deletions internal/resource/cluster_operator_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type OperatorHandler struct {
repoUrl string

// additional values used on install
vals map[string]interface{}
vals map[string]any

// Preconfigured helm actions and chart
chart *chart.Chart
Expand Down Expand Up @@ -152,9 +152,9 @@ func (oh *OperatorHandler) listReleases(state action.ListStates) ([]*release.Rel
return client.Run()
}

func (oh *OperatorHandler) values(token string) (map[string]interface{}, error) {
globalVals := map[string]interface{}{}
vals := map[string]interface{}{
func (oh *OperatorHandler) values(token string) (map[string]any, error) {
globalVals := map[string]any{}
vals := map[string]any{
"secrets": map[string]string{
"deployToken": token,
},
Expand Down Expand Up @@ -232,7 +232,7 @@ func (oh *OperatorHandler) Uninstall() error {
}

func NewOperatorHandler(ctx context.Context, client *client.Client, kubeconfig *Kubeconfig, repoUrl string, values *string, consoleUrl string) (*OperatorHandler, error) {
vals := map[string]interface{}{}
vals := map[string]any{}
if values != nil {
if err := yaml.Unmarshal([]byte(*values), &vals); err != nil {
return nil, err
Expand Down

0 comments on commit a62a6ea

Please sign in to comment.