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/objects.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
wsmanagermk2 "github.com/gitpod-io/gitpod/installer/pkg/components/ws-manager-mk2"
12
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
13
)
14
15
var Objects = common.CompositeRenderFunc(
16
configmap,
17
deployment,
18
rolebinding,
19
common.DefaultServiceAccount(Component),
20
)
21
22
func WSManagerList(ctx *common.RenderContext) []WorkspaceCluster {
23
skipSelf := false
24
wsmanagerAddr := fmt.Sprintf("dns:///%s:%d", wsmanagermk2.Component, wsmanagermk2.RPCPort)
25
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
26
if cfg.WebApp != nil && cfg.WebApp.WorkspaceManagerBridge != nil {
27
skipSelf = cfg.WebApp.WorkspaceManagerBridge.SkipSelf
28
}
29
30
if !common.WithLocalWsManager(ctx) {
31
// Must skip self if cluster does not contain ws-manager.
32
skipSelf = true
33
}
34
35
return nil
36
})
37
38
// Registering a local cluster ws-manager only makes sense when we actually deploy one,
39
// (ie when we are doing a full self hosted installation rather than a SaaS install to gitpod.io).
40
if skipSelf {
41
return []WorkspaceCluster{}
42
}
43
44
return []WorkspaceCluster{{
45
Name: ctx.Config.Metadata.InstallationShortname,
46
URL: wsmanagerAddr,
47
TLS: WorkspaceClusterTLS{
48
Authority: "/ws-manager-client-tls-certs/ca.crt",
49
Certificate: "/ws-manager-client-tls-certs/tls.crt",
50
Key: "/ws-manager-client-tls-certs/tls.key",
51
},
52
State: WorkspaceClusterStateAvailable,
53
MaxScore: 100,
54
Score: 50,
55
Govern: true,
56
AdmissionConstraints: nil,
57
ApplicationCluster: ctx.Config.Metadata.InstallationShortname,
58
}}
59
}
60
61