Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/ws-manager-bridge/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 wsmanagerbridge
6
7
import (
8
"fmt"
9
10
"github.com/gitpod-io/gitpod/installer/pkg/common"
11
"github.com/gitpod-io/gitpod/installer/pkg/components/redis"
12
13
corev1 "k8s.io/api/core/v1"
14
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
15
"k8s.io/apimachinery/pkg/runtime"
16
)
17
18
func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
19
wsmbcfg := Configuration{
20
Installation: ctx.Config.Metadata.InstallationShortname,
21
WSClusterDBReconcileIntervalSeconds: 60,
22
ControllerIntervalSeconds: 60,
23
ControllerMaxDisconnectSeconds: 150,
24
ClusterService: ClusterService{
25
Port: 8080, // todo(sje) where does this value come from?
26
Host: "localhost",
27
},
28
Timeouts: Timeouts{
29
PreparingPhaseSeconds: 3600,
30
BuildingPhaseSeconds: 3600,
31
UnknownPhaseSeconds: 600,
32
PendingPhaseSeconds: 3600,
33
StoppingPhaseSeconds: 3600,
34
},
35
EmulatePreparingIntervalSeconds: 10,
36
StaticBridges: WSManagerList(ctx),
37
ClusterSyncIntervalSeconds: 60,
38
Redis: redis.GetConfiguration(ctx),
39
}
40
41
fc, err := common.ToJSONString(wsmbcfg)
42
if err != nil {
43
return nil, fmt.Errorf("failed to marshal ws-manager-bridge config: %w", err)
44
}
45
46
return []runtime.Object{
47
&corev1.ConfigMap{
48
TypeMeta: common.TypeMetaConfigmap,
49
ObjectMeta: metav1.ObjectMeta{
50
Name: fmt.Sprintf("%s-config", Component),
51
Namespace: ctx.Namespace,
52
Labels: common.CustomizeLabel(ctx, Component, common.TypeMetaConfigmap),
53
Annotations: common.CustomizeAnnotation(ctx, Component, common.TypeMetaConfigmap),
54
},
55
Data: map[string]string{
56
"ws-manager-bridge.json": string(fc),
57
},
58
},
59
}, nil
60
}
61
62