Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/content-service/configmap.go
2501 views
1
// Copyright (c) 2021 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 content_service
6
7
import (
8
"fmt"
9
10
"github.com/gitpod-io/gitpod/common-go/baseserver"
11
12
"github.com/gitpod-io/gitpod/content-service/api/config"
13
"github.com/gitpod-io/gitpod/installer/pkg/common"
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
cscfg := config.ServiceConfig{
21
Service: baseserver.ServerConfiguration{
22
Address: fmt.Sprintf("0.0.0.0:%d", RPCPort),
23
},
24
Storage: common.StorageConfig(ctx),
25
}
26
27
fc, err := common.ToJSONString(cscfg)
28
if err != nil {
29
return nil, fmt.Errorf("failed to marshal content-service config: %w", err)
30
}
31
32
return []runtime.Object{&corev1.ConfigMap{
33
TypeMeta: common.TypeMetaConfigmap,
34
ObjectMeta: metav1.ObjectMeta{
35
Name: Component,
36
Namespace: ctx.Namespace,
37
Labels: common.CustomizeLabel(ctx, Component, common.TypeMetaConfigmap),
38
Annotations: common.CustomizeAnnotation(ctx, Component, common.TypeMetaConfigmap),
39
},
40
Data: map[string]string{
41
"config.json": string(fc),
42
},
43
}}, nil
44
}
45
46