Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/openvsx-proxy/service.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 openvsx_proxy
6
7
import (
8
"github.com/gitpod-io/gitpod/common-go/baseserver"
9
"github.com/gitpod-io/gitpod/installer/pkg/common"
10
11
corev1 "k8s.io/api/core/v1"
12
"k8s.io/apimachinery/pkg/runtime"
13
)
14
15
func service(ctx *common.RenderContext) ([]runtime.Object, error) {
16
var annotations map[string]string
17
18
if ctx.Config.OpenVSX.Proxy != nil {
19
annotations = ctx.Config.OpenVSX.Proxy.ServiceAnnotations
20
}
21
22
ports := []common.ServicePort{
23
{
24
Name: PortName,
25
ContainerPort: ContainerPort,
26
ServicePort: ServicePort,
27
},
28
{
29
Name: baseserver.BuiltinMetricsPortName,
30
ContainerPort: baseserver.BuiltinMetricsPort,
31
ServicePort: baseserver.BuiltinMetricsPort,
32
},
33
}
34
35
return common.GenerateService(Component, ports, func(service *corev1.Service) {
36
for k, v := range annotations {
37
service.Annotations[k] = v
38
}
39
})(ctx)
40
}
41
42