Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/ide-service/configmap.go
2501 views
1
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package ide_service
6
7
import (
8
"fmt"
9
10
"github.com/gitpod-io/gitpod/common-go/baseserver"
11
"github.com/gitpod-io/gitpod/ide-service-api/config"
12
"github.com/gitpod-io/gitpod/installer/pkg/common"
13
14
corev1 "k8s.io/api/core/v1"
15
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
16
"k8s.io/apimachinery/pkg/runtime"
17
)
18
19
func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
20
21
cfg := config.ServiceConfiguration{
22
Server: &baseserver.Configuration{
23
Services: baseserver.ServicesConfiguration{
24
GRPC: &baseserver.ServerConfiguration{
25
Address: fmt.Sprintf("0.0.0.0:%d", GRPCServicePort),
26
},
27
},
28
},
29
IDEConfigPath: "/ide-config/config.json",
30
DockerCfg: "/mnt/pull-secret/pull-secret.json",
31
}
32
33
fc, err := common.ToJSONString(cfg)
34
if err != nil {
35
return nil, fmt.Errorf("failed to marshal ide-service config: %w", err)
36
}
37
38
res := []runtime.Object{
39
&corev1.ConfigMap{
40
TypeMeta: common.TypeMetaConfigmap,
41
ObjectMeta: metav1.ObjectMeta{
42
Name: Component,
43
Namespace: ctx.Namespace,
44
Labels: common.CustomizeLabel(ctx, Component, common.TypeMetaConfigmap),
45
Annotations: common.CustomizeAnnotation(ctx, Component, common.TypeMetaConfigmap),
46
},
47
Data: map[string]string{
48
"config.json": string(fc),
49
},
50
},
51
}
52
return res, nil
53
}
54
55