Skip to content

Commit 92a9fd5

Browse files
aledbfroboquat
authored andcommitted
[installer] Switch default log level to info
1 parent e5210db commit 92a9fd5

File tree

20 files changed

+32
-41
lines changed

20 files changed

+32
-41
lines changed

installer/cmd/mirror_list.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package cmd
66

77
import (
8-
"encoding/json"
98
"fmt"
109
"os"
1110
"regexp"
@@ -123,7 +122,7 @@ image to the "target" repo`,
123122
return scoreI < scoreJ
124123
})
125124

126-
fc, err := json.MarshalIndent(images, "", " ")
125+
fc, err := common.ToJSONString(images)
127126
if err != nil {
128127
return err
129128
}

installer/cmd/validate-cluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ package cmd
66

77
import (
88
"context"
9-
"encoding/json"
109
"fmt"
1110
"os"
1211

1312
"github.com/gitpod-io/gitpod/installer/pkg/cluster"
13+
"github.com/gitpod-io/gitpod/installer/pkg/common"
1414
"github.com/gitpod-io/gitpod/installer/pkg/config"
1515
"github.com/spf13/cobra"
1616
"k8s.io/client-go/rest"
@@ -70,7 +70,7 @@ var validateClusterCmd = &cobra.Command{
7070
result.Items = append(result.Items, res.Items...)
7171
}
7272

73-
jsonOut, err := json.MarshalIndent(result, "", " ")
73+
jsonOut, err := common.ToJSONString(result)
7474
if err != nil {
7575
return err
7676
}

installer/cmd/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ package cmd
66

77
import (
88
"debug/elf"
9-
"encoding/json"
109
"fmt"
1110
"io/ioutil"
1211
"os"
1312

13+
"github.com/gitpod-io/gitpod/installer/pkg/common"
1414
"github.com/gitpod-io/gitpod/installer/pkg/config/versions"
1515
"sigs.k8s.io/yaml"
1616

@@ -27,7 +27,7 @@ var versionCmd = &cobra.Command{
2727
return err
2828
}
2929

30-
versions, err := json.MarshalIndent(versionMF, "", " ")
30+
versions, err := common.ToJSONString(versionMF)
3131
if err != nil {
3232
return err
3333
}

installer/pkg/common/common.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package common
66

77
import (
88
"crypto/sha256"
9+
"encoding/json"
910
"fmt"
1011
"io"
1112
"math/rand"
@@ -42,7 +43,7 @@ func MergeEnv(envs ...[]corev1.EnvVar) (res []corev1.EnvVar) {
4243
}
4344

4445
func DefaultEnv(cfg *config.Config) []corev1.EnvVar {
45-
logLevel := "debug"
46+
logLevel := "info"
4647
if cfg.Observability.LogLevel != "" {
4748
logLevel = string(cfg.Observability.LogLevel)
4849
}
@@ -527,3 +528,8 @@ func ThirdPartyContainerRepo(configRegistry string, thirdPartyRegistry string) s
527528

528529
return configRegistry
529530
}
531+
532+
// ToJSONString returns the serialized JSON string of an object
533+
func ToJSONString(input interface{}) ([]byte, error) {
534+
return json.MarshalIndent(input, "", " ")
535+
}

installer/pkg/components/agent-smith/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package agentsmith
66

77
import (
88
"encoding/base64"
9-
"encoding/json"
109
"fmt"
1110
"time"
1211

@@ -53,7 +52,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
5352
},
5453
}
5554

56-
fc, err := json.MarshalIndent(ascfg, "", " ")
55+
fc, err := common.ToJSONString(ascfg)
5756
if err != nil {
5857
return nil, fmt.Errorf("failed to marshal agent-smith config: %w", err)
5958
}

installer/pkg/components/blobserve/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package blobserve
66

77
import (
8-
"encoding/json"
98
"fmt"
109
"time"
1110

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

87-
fc, err := json.MarshalIndent(bscfg, "", " ")
86+
fc, err := common.ToJSONString(bscfg)
8887
if err != nil {
8988
return nil, fmt.Errorf("failed to marshal blobserve config: %w", err)
9089
}

installer/pkg/components/content-service/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package content_service
66

77
import (
8-
"encoding/json"
98
"fmt"
109

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

33-
fc, err := json.MarshalIndent(cscfg, "", " ")
32+
fc, err := common.ToJSONString(cscfg)
3433
if err != nil {
3534
return nil, fmt.Errorf("failed to marshal content-service config: %w", err)
3635
}

installer/pkg/components/database/incluster/secret.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
package incluster
66

77
import (
8-
"encoding/json"
98
"fmt"
9+
1010
"github.com/gitpod-io/gitpod/installer/pkg/common"
1111
corev1 "k8s.io/api/core/v1"
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -26,12 +26,12 @@ func secrets(ctx *common.RenderContext) ([]runtime.Object, error) {
2626
rootPassword := "PHejMfsLvfLcG1Drs40h"
2727
password := "jBzVMe2w4Yi7GagadsyB"
2828

29-
encryptionKeys, err := json.MarshalIndent([]EncryptionKey{{
29+
encryptionKeys, err := common.ToJSONString([]EncryptionKey{{
3030
Name: "general",
3131
Version: 1,
3232
Primary: true,
3333
Material: "4uGh1q8y2DYryJwrVMHs0kWXJlqvHWWt/KJuNi04edI=",
34-
}}, "", " ")
34+
}})
3535
if err != nil {
3636
return nil, fmt.Errorf("failed to marshal mysql encryptionKeys: %w", err)
3737
}

installer/pkg/components/gitpod/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package gitpod
66

77
import (
8-
"encoding/json"
98
"fmt"
109

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

28-
fc, err := json.MarshalIndent(gpcfg, "", " ")
27+
fc, err := common.ToJSONString(gpcfg)
2928
if err != nil {
3029
return nil, fmt.Errorf("failed to marshal Gitpod config: %w", err)
3130
}

installer/pkg/components/image-builder-mk3/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package image_builder_mk3
66

77
import (
8-
"encoding/json"
98
"fmt"
109
"strings"
1110
"time"
@@ -73,7 +72,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
7372
},
7473
}
7574

76-
fc, err := json.MarshalIndent(imgcfg, "", " ")
75+
fc, err := common.ToJSONString(imgcfg)
7776
if err != nil {
7877
return nil, fmt.Errorf("failed to marshal image-builder-mk3 config: %w", err)
7978
}

installer/pkg/components/openvsx-proxy/configmap.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
package openvsx_proxy
66

77
import (
8-
"encoding/json"
98
"fmt"
9+
"time"
10+
1011
"github.com/gitpod-io/gitpod/common-go/util"
1112
"github.com/gitpod-io/gitpod/installer/pkg/common"
1213
openvsx "github.com/gitpod-io/gitpod/openvsx-proxy/pkg"
1314
corev1 "k8s.io/api/core/v1"
1415
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1516
"k8s.io/apimachinery/pkg/runtime"
16-
"time"
1717
)
1818

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

32-
fc, err := json.MarshalIndent(imgcfg, "", " ")
32+
fc, err := common.ToJSONString(imgcfg)
3333
if err != nil {
3434
return nil, fmt.Errorf("failed to marshal openvsx config: %w", err)
3535
}

installer/pkg/components/registry-facade/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package registryfacade
66

77
import (
8-
"encoding/json"
98
"fmt"
109

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

63-
fc, err := json.MarshalIndent(rfcfg, "", " ")
62+
fc, err := common.ToJSONString(rfcfg)
6463
if err != nil {
6564
return nil, fmt.Errorf("failed to marshal registry-facade config: %w", err)
6665
}

installer/pkg/components/server/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package server
66

77
import (
8-
"encoding/json"
98
"fmt"
109

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

105-
fc, err := json.MarshalIndent(scfg, "", " ")
104+
fc, err := common.ToJSONString(scfg)
106105
if err != nil {
107106
return nil, fmt.Errorf("failed to marshal server config: %w", err)
108107
}

installer/pkg/components/server/deployment.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package server
66

77
import (
88
"encoding/base64"
9-
"encoding/json"
109
"fmt"
1110

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

3433
// Convert to a JSON string
35-
fc, err := json.MarshalIndent(wsmanagerbridge.WSManagerList(), "", " ")
34+
fc, err := common.ToJSONString(wsmanagerbridge.WSManagerList())
3635
if err != nil {
3736
return nil, fmt.Errorf("failed to marshal server.WorkspaceManagerList config: %w", err)
3837
}

installer/pkg/components/server/ide/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package ide
66

77
import (
8-
"encoding/json"
98
"fmt"
109

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

110-
fc, err := json.MarshalIndent(idecfg, "", " ")
109+
fc, err := common.ToJSONString(idecfg)
111110
if err != nil {
112111
return nil, fmt.Errorf("failed to marshal server-ide-config config: %w", err)
113112
}

installer/pkg/components/ws-daemon/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package wsdaemon
66

77
import (
8-
"encoding/json"
98
"fmt"
109
"time"
1110

@@ -137,7 +136,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
137136
Addr: "localhost:6060",
138137
},
139138
}
140-
fc, err := json.MarshalIndent(wsdcfg, "", " ")
139+
fc, err := common.ToJSONString(wsdcfg)
141140
if err != nil {
142141
return nil, fmt.Errorf("failed to marshal ws-daemon config: %w", err)
143142
}

installer/pkg/components/ws-manager-bridge/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package wsmanagerbridge
66

77
import (
8-
"encoding/json"
98
"fmt"
109

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

37-
fc, err := json.MarshalIndent(wsmbcfg, "", " ")
36+
fc, err := common.ToJSONString(wsmbcfg)
3837
if err != nil {
3938
return nil, fmt.Errorf("failed to marshal ws-manager-bridge config: %w", err)
4039
}

installer/pkg/components/ws-manager/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package wsmanager
66

77
import (
8-
"encoding/json"
98
"fmt"
109
"path/filepath"
1110
"time"
@@ -130,7 +129,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
130129
}{Addr: "127.0.0.1:9500"},
131130
}
132131

133-
fc, err := json.MarshalIndent(wsmcfg, "", " ")
132+
fc, err := common.ToJSONString(wsmcfg)
134133
if err != nil {
135134
return nil, fmt.Errorf("failed to marshal ws-manager config: %w", err)
136135
}

installer/pkg/components/ws-proxy/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package wsproxy
66

77
import (
8-
"encoding/json"
98
"fmt"
109
"time"
1110

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

71-
fc, err := json.MarshalIndent(wspcfg, "", " ")
70+
fc, err := common.ToJSONString(wspcfg)
7271
if err != nil {
7372
return nil, fmt.Errorf("failed to marshal ws-proxy config: %w", err)
7473
}

installer/pkg/components/ws-scheduler/configmap.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package wsscheduler
66

77
import (
8-
"encoding/json"
98
"fmt"
109
"time"
1110

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

127-
fc, err := json.MarshalIndent(wsscfg, "", " ")
126+
fc, err := common.ToJSONString(wsscfg)
128127
if err != nil {
129128
return nil, fmt.Errorf("failed to marshal ws-proxy config: %w", err)
130129
}

0 commit comments

Comments
 (0)