Path: blob/main/install/installer/pkg/components/docker-registry/certificate.go
2501 views
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package dockerregistry56import (7"fmt"89"github.com/gitpod-io/gitpod/installer/pkg/common"10certmanagerv1 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1"11cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1"12metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"13"k8s.io/apimachinery/pkg/runtime"14"k8s.io/utils/pointer"15)1617func certificate(ctx *common.RenderContext) ([]runtime.Object, error) {18if !pointer.BoolDeref(ctx.Config.ContainerRegistry.InCluster, false) {19return nil, nil20}2122return []runtime.Object{&certmanagerv1.Certificate{23TypeMeta: common.TypeMetaCertificate,24ObjectMeta: metav1.ObjectMeta{25Name: BuiltInRegistryCerts,26Namespace: ctx.Namespace,27Labels: common.DefaultLabels(Component),28},29Spec: certmanagerv1.CertificateSpec{30Duration: common.InternalCertDuration,31SecretName: BuiltInRegistryCerts,32IssuerRef: cmmeta.ObjectReference{33Name: common.CertManagerCAIssuer,34Kind: certmanagerv1.ClusterIssuerKind,35Group: "cert-manager.io",36},37DNSNames: []string{38fmt.Sprintf("registry.%s.svc.cluster.local", ctx.Namespace),39},40SecretTemplate: &certmanagerv1.CertificateSecretTemplate{41Labels: common.DefaultLabels(Component),42},43},44}}, nil45}464748