Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/image-builder-mk3/tlssecret.go
2506 views
1
// Copyright (c) 2022 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 image_builder_mk3
6
7
import (
8
"fmt"
9
10
"github.com/gitpod-io/gitpod/installer/pkg/common"
11
12
certmanagerv1 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1"
13
cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1"
14
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
15
"k8s.io/apimachinery/pkg/runtime"
16
)
17
18
func tlssecret(ctx *common.RenderContext) ([]runtime.Object, error) {
19
serverAltNames := []string{
20
fmt.Sprintf("%s.%s.svc", Component, ctx.Namespace),
21
fmt.Sprintf("%s.%s.svc.cluster.local", Component, ctx.Namespace),
22
Component,
23
fmt.Sprintf("%s-dev", Component),
24
}
25
26
return []runtime.Object{
27
&certmanagerv1.Certificate{
28
TypeMeta: common.TypeMetaCertificate,
29
ObjectMeta: metav1.ObjectMeta{
30
Name: TLSSecretName,
31
Namespace: ctx.Namespace,
32
Labels: common.DefaultLabels(Component),
33
},
34
Spec: certmanagerv1.CertificateSpec{
35
Duration: common.InternalCertDuration,
36
SecretName: TLSSecretName,
37
DNSNames: serverAltNames,
38
IssuerRef: cmmeta.ObjectReference{
39
Name: common.CertManagerCAIssuer,
40
Kind: certmanagerv1.ClusterIssuerKind,
41
Group: "cert-manager.io",
42
},
43
SecretTemplate: &certmanagerv1.CertificateSecretTemplate{
44
Labels: common.DefaultLabels(Component),
45
},
46
},
47
},
48
}, nil
49
}
50
51