Skip to content

Commit

Permalink
[installer] Switch default log level to info
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf authored and roboquat committed Jan 19, 2022
1 parent e5210db commit 92a9fd5
Show file tree
Hide file tree
Showing 20 changed files with 32 additions and 41 deletions.
3 changes: 1 addition & 2 deletions installer/cmd/mirror_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package cmd

import (
"encoding/json"
"fmt"
"os"
"regexp"
Expand Down Expand Up @@ -123,7 +122,7 @@ image to the "target" repo`,
return scoreI < scoreJ
})

fc, err := json.MarshalIndent(images, "", " ")
fc, err := common.ToJSONString(images)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions installer/cmd/validate-cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ package cmd

import (
"context"
"encoding/json"
"fmt"
"os"

"github.com/gitpod-io/gitpod/installer/pkg/cluster"
"github.com/gitpod-io/gitpod/installer/pkg/common"
"github.com/gitpod-io/gitpod/installer/pkg/config"
"github.com/spf13/cobra"
"k8s.io/client-go/rest"
Expand Down Expand Up @@ -70,7 +70,7 @@ var validateClusterCmd = &cobra.Command{
result.Items = append(result.Items, res.Items...)
}

jsonOut, err := json.MarshalIndent(result, "", " ")
jsonOut, err := common.ToJSONString(result)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions installer/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ package cmd

import (
"debug/elf"
"encoding/json"
"fmt"
"io/ioutil"
"os"

"github.com/gitpod-io/gitpod/installer/pkg/common"
"github.com/gitpod-io/gitpod/installer/pkg/config/versions"
"sigs.k8s.io/yaml"

Expand All @@ -27,7 +27,7 @@ var versionCmd = &cobra.Command{
return err
}

versions, err := json.MarshalIndent(versionMF, "", " ")
versions, err := common.ToJSONString(versionMF)
if err != nil {
return err
}
Expand Down
8 changes: 7 additions & 1 deletion installer/pkg/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package common

import (
"crypto/sha256"
"encoding/json"
"fmt"
"io"
"math/rand"
Expand Down Expand Up @@ -42,7 +43,7 @@ func MergeEnv(envs ...[]corev1.EnvVar) (res []corev1.EnvVar) {
}

func DefaultEnv(cfg *config.Config) []corev1.EnvVar {
logLevel := "debug"
logLevel := "info"
if cfg.Observability.LogLevel != "" {
logLevel = string(cfg.Observability.LogLevel)
}
Expand Down Expand Up @@ -527,3 +528,8 @@ func ThirdPartyContainerRepo(configRegistry string, thirdPartyRegistry string) s

return configRegistry
}

// ToJSONString returns the serialized JSON string of an object
func ToJSONString(input interface{}) ([]byte, error) {
return json.MarshalIndent(input, "", " ")
}
3 changes: 1 addition & 2 deletions installer/pkg/components/agent-smith/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package agentsmith

import (
"encoding/base64"
"encoding/json"
"fmt"
"time"

Expand Down Expand Up @@ -53,7 +52,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
},
}

fc, err := json.MarshalIndent(ascfg, "", " ")
fc, err := common.ToJSONString(ascfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal agent-smith config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/blobserve/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package blobserve

import (
"encoding/json"
"fmt"
"time"

Expand Down Expand Up @@ -84,7 +83,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
PrometheusAddr: "127.0.0.1:9500",
}

fc, err := json.MarshalIndent(bscfg, "", " ")
fc, err := common.ToJSONString(bscfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal blobserve config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/content-service/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package content_service

import (
"encoding/json"
"fmt"

"github.com/gitpod-io/gitpod/content-service/api/config"
Expand All @@ -30,7 +29,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
Storage: common.StorageConfig(ctx),
}

fc, err := json.MarshalIndent(cscfg, "", " ")
fc, err := common.ToJSONString(cscfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal content-service config: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions installer/pkg/components/database/incluster/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
package incluster

import (
"encoding/json"
"fmt"

"github.com/gitpod-io/gitpod/installer/pkg/common"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -26,12 +26,12 @@ func secrets(ctx *common.RenderContext) ([]runtime.Object, error) {
rootPassword := "PHejMfsLvfLcG1Drs40h"
password := "jBzVMe2w4Yi7GagadsyB"

encryptionKeys, err := json.MarshalIndent([]EncryptionKey{{
encryptionKeys, err := common.ToJSONString([]EncryptionKey{{
Name: "general",
Version: 1,
Primary: true,
Material: "4uGh1q8y2DYryJwrVMHs0kWXJlqvHWWt/KJuNi04edI=",
}}, "", " ")
}})
if err != nil {
return nil, fmt.Errorf("failed to marshal mysql encryptionKeys: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/gitpod/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package gitpod

import (
"encoding/json"
"fmt"

"github.com/gitpod-io/gitpod/installer/pkg/common"
Expand All @@ -25,7 +24,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
VersionManifest: ctx.VersionManifest,
}

fc, err := json.MarshalIndent(gpcfg, "", " ")
fc, err := common.ToJSONString(gpcfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal Gitpod config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/image-builder-mk3/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package image_builder_mk3

import (
"encoding/json"
"fmt"
"strings"
"time"
Expand Down Expand Up @@ -73,7 +72,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
},
}

fc, err := json.MarshalIndent(imgcfg, "", " ")
fc, err := common.ToJSONString(imgcfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal image-builder-mk3 config: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions installer/pkg/components/openvsx-proxy/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
package openvsx_proxy

import (
"encoding/json"
"fmt"
"time"

"github.com/gitpod-io/gitpod/common-go/util"
"github.com/gitpod-io/gitpod/installer/pkg/common"
openvsx "github.com/gitpod-io/gitpod/openvsx-proxy/pkg"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"time"
)

func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
Expand All @@ -29,7 +29,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
PrometheusAddr: fmt.Sprintf(":%d", PrometheusPort),
}

fc, err := json.MarshalIndent(imgcfg, "", " ")
fc, err := common.ToJSONString(imgcfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal openvsx config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/registry-facade/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package registryfacade

import (
"encoding/json"
"fmt"

"github.com/gitpod-io/gitpod/installer/pkg/common"
Expand Down Expand Up @@ -60,7 +59,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
PrometheusAddr: "127.0.0.1:9500",
}

fc, err := json.MarshalIndent(rfcfg, "", " ")
fc, err := common.ToJSONString(rfcfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal registry-facade config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/server/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package server

import (
"encoding/json"
"fmt"

"github.com/gitpod-io/gitpod/installer/pkg/common"
Expand Down Expand Up @@ -102,7 +101,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
ChargebeeProviderOptionsFile: "/chargebee/providerOptions",
}

fc, err := json.MarshalIndent(scfg, "", " ")
fc, err := common.ToJSONString(scfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal server config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/server/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package server

import (
"encoding/base64"
"encoding/json"
"fmt"

"github.com/gitpod-io/gitpod/installer/pkg/cluster"
Expand All @@ -32,7 +31,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
}

// Convert to a JSON string
fc, err := json.MarshalIndent(wsmanagerbridge.WSManagerList(), "", " ")
fc, err := common.ToJSONString(wsmanagerbridge.WSManagerList())
if err != nil {
return nil, fmt.Errorf("failed to marshal server.WorkspaceManagerList config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/server/ide/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package ide

import (
"encoding/json"
"fmt"

"github.com/gitpod-io/gitpod/installer/pkg/common"
Expand Down Expand Up @@ -107,7 +106,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
return nil, fmt.Errorf("default desktop IDE '%s' does not point to a desktop IDE option", idecfg.IDEOptions.DefaultIDE)
}

fc, err := json.MarshalIndent(idecfg, "", " ")
fc, err := common.ToJSONString(idecfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal server-ide-config config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/ws-daemon/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package wsdaemon

import (
"encoding/json"
"fmt"
"time"

Expand Down Expand Up @@ -137,7 +136,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
Addr: "localhost:6060",
},
}
fc, err := json.MarshalIndent(wsdcfg, "", " ")
fc, err := common.ToJSONString(wsdcfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal ws-daemon config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/ws-manager-bridge/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package wsmanagerbridge

import (
"encoding/json"
"fmt"

"github.com/gitpod-io/gitpod/installer/pkg/common"
Expand Down Expand Up @@ -34,7 +33,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
StaticBridges: WSManagerList(),
}

fc, err := json.MarshalIndent(wsmbcfg, "", " ")
fc, err := common.ToJSONString(wsmbcfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal ws-manager-bridge config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/ws-manager/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package wsmanager

import (
"encoding/json"
"fmt"
"path/filepath"
"time"
Expand Down Expand Up @@ -130,7 +129,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
}{Addr: "127.0.0.1:9500"},
}

fc, err := json.MarshalIndent(wsmcfg, "", " ")
fc, err := common.ToJSONString(wsmcfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal ws-manager config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/ws-proxy/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package wsproxy

import (
"encoding/json"
"fmt"
"time"

Expand Down Expand Up @@ -68,7 +67,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
ReadinessProbeAddr: ":60088",
}

fc, err := json.MarshalIndent(wspcfg, "", " ")
fc, err := common.ToJSONString(wspcfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal ws-proxy config: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions installer/pkg/components/ws-scheduler/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package wsscheduler

import (
"encoding/json"
"fmt"
"time"

Expand Down Expand Up @@ -124,7 +123,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
}{Addr: "127.0.0.1:9500"},
}

fc, err := json.MarshalIndent(wsscfg, "", " ")
fc, err := common.ToJSONString(wsscfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal ws-proxy config: %w", err)
}
Expand Down

0 comments on commit 92a9fd5

Please sign in to comment.