Skip to content

Commit cb2c148

Browse files
authored
Configure registry-facade secrets without using external dependencies (#17027)
Signed-off-by: Manuel de Brito Fontes <[email protected]>
1 parent 691e856 commit cb2c148

File tree

3 files changed

+29
-37
lines changed

3 files changed

+29
-37
lines changed

install/installer/pkg/components/registry-facade/configmap.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ import (
2020
)
2121

2222
func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
23-
var tls regfac.TLS
24-
if ctx.Config.Certificate.Name != "" {
25-
tls = regfac.TLS{
26-
Certificate: "/mnt/certificates/tls.crt",
27-
PrivateKey: "/mnt/certificates/tls.key",
28-
}
29-
}
30-
3123
var (
3224
ipfsCache *regfac.IPFSCacheConfig
3325
redisCache *regfac.RedisCacheConfig
@@ -86,9 +78,12 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
8678
Registry: regfac.Config{
8779
Port: ServicePort,
8880
RemoteSpecProvider: remoteSpecProviders,
89-
TLS: &tls,
90-
Store: "/mnt/cache/registry",
91-
RequireAuth: false,
81+
TLS: &regfac.TLS{
82+
Certificate: "/mnt/certificates/tls.crt",
83+
PrivateKey: "/mnt/certificates/tls.key",
84+
},
85+
Store: "/mnt/cache/registry",
86+
RequireAuth: false,
9287
StaticLayer: []regfac.StaticLayerCfg{
9388
{
9489
Ref: ctx.ImageName(ctx.Config.Repository, SupervisorImage, ctx.VersionManifest.Components.Workspace.Supervisor.Version),

install/installer/pkg/components/registry-facade/daemonset.go

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,23 @@ func daemonset(ctx *common.RenderContext) ([]runtime.Object, error) {
3636
}
3737

3838
var (
39-
volumes []corev1.Volume
40-
volumeMounts []corev1.VolumeMount
41-
)
42-
43-
if ctx.Config.Certificate.Name != "" {
44-
name := "config-certificates"
45-
volumes = append(volumes, corev1.Volume{
46-
Name: name,
47-
VolumeSource: corev1.VolumeSource{
48-
Secret: &corev1.SecretVolumeSource{
49-
SecretName: ctx.Config.Certificate.Name,
39+
volumes = []corev1.Volume{
40+
{
41+
Name: "config-certificates",
42+
VolumeSource: corev1.VolumeSource{
43+
Secret: &corev1.SecretVolumeSource{
44+
SecretName: "builtin-registry-facade-cert",
45+
},
5046
},
5147
},
52-
})
53-
54-
volumeMounts = append(volumeMounts, corev1.VolumeMount{
55-
Name: name,
56-
MountPath: "/mnt/certificates",
57-
})
58-
}
48+
}
49+
volumeMounts = []corev1.VolumeMount{
50+
{
51+
Name: "config-certificates",
52+
MountPath: "/mnt/certificates",
53+
},
54+
}
55+
)
5956

6057
if objs, err := common.DockerRegistryHash(ctx); err != nil {
6158
return nil, err

install/installer/pkg/components/ws-proxy/deployment.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
2828
return nil, err
2929
}
3030

31-
var volumes []corev1.Volume
32-
var volumeMounts []corev1.VolumeMount
33-
if ctx.Config.Certificate.Name != "" {
34-
volumes = append(volumes, corev1.Volume{
31+
volumes := []corev1.Volume{
32+
{
3533
Name: "config-certificates",
3634
VolumeSource: corev1.VolumeSource{
3735
Secret: &corev1.SecretVolumeSource{
3836
SecretName: ctx.Config.Certificate.Name,
3937
},
4038
},
41-
})
39+
},
40+
}
4241

43-
volumeMounts = append(volumeMounts, corev1.VolumeMount{
42+
volumeMounts := []corev1.VolumeMount{
43+
{
4444
Name: "config-certificates",
45-
MountPath: "/mnt/certificates",
46-
})
45+
MountPath: "/mnt/certificates"},
4746
}
47+
4848
if ctx.Config.SSHGatewayHostKey != nil {
4949
volumes = append(volumes, corev1.Volume{
5050
Name: "host-key",

0 commit comments

Comments
 (0)