Skip to content

[public-api] Extend k8s definitions with a service #9362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
package public_api_server

const (
Component = "public-api-server"
ContainerPort = 9000
PortName = "http"
Component = "public-api-server"

HTTPPortName = "http"
HTTPContainerPort = 9000
HTTPServicePort = 9000

GRPCPortName = "grpc"
GRPCContainerPort = 9001
GRPCServicePort = 9001
)
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
"memory": resource.MustParse("32Mi"),
},
},
Ports: []corev1.ContainerPort{{
ContainerPort: ContainerPort,
Name: PortName,
}},
Ports: []corev1.ContainerPort{
{
ContainerPort: HTTPContainerPort,
Name: HTTPPortName,
},
{
ContainerPort: GRPCContainerPort,
Name: GRPCPortName,
},
},
SecurityContext: &corev1.SecurityContext{
Privileged: pointer.Bool(false),
},
Expand All @@ -66,7 +72,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/",
Port: intstr.IntOrString{IntVal: ContainerPort},
Port: intstr.IntOrString{IntVal: HTTPContainerPort},
Scheme: corev1.URISchemeHTTP,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func Objects(ctx *common.RenderContext) ([]runtime.Object, error) {
deployment,
rolebinding,
common.DefaultServiceAccount(Component),
service,
)(ctx)
}

Expand Down
22 changes: 22 additions & 0 deletions install/installer/pkg/components/public-api-server/service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
// Licensed under the MIT License. See License-MIT.txt in the project root for license information.

package public_api_server

import (
"github.com/gitpod-io/gitpod/installer/pkg/common"
"k8s.io/apimachinery/pkg/runtime"
)

func service(ctx *common.RenderContext) ([]runtime.Object, error) {
return common.GenerateService(Component, map[string]common.ServicePort{
HTTPPortName: {
ContainerPort: HTTPContainerPort,
ServicePort: HTTPServicePort,
},
GRPCPortName: {
ContainerPort: GRPCContainerPort,
ServicePort: GRPCServicePort,
},
})(ctx)
}