Skip to content

Configure registry-facade secrets without using external dependencies #17027

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
Mar 27, 2023
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
17 changes: 6 additions & 11 deletions install/installer/pkg/components/registry-facade/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ import (
)

func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
var tls regfac.TLS
if ctx.Config.Certificate.Name != "" {
tls = regfac.TLS{
Certificate: "/mnt/certificates/tls.crt",
PrivateKey: "/mnt/certificates/tls.key",
}
}

var (
ipfsCache *regfac.IPFSCacheConfig
redisCache *regfac.RedisCacheConfig
Expand Down Expand Up @@ -86,9 +78,12 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
Registry: regfac.Config{
Port: ServicePort,
RemoteSpecProvider: remoteSpecProviders,
TLS: &tls,
Store: "/mnt/cache/registry",
RequireAuth: false,
TLS: &regfac.TLS{
Certificate: "/mnt/certificates/tls.crt",
PrivateKey: "/mnt/certificates/tls.key",
},
Store: "/mnt/cache/registry",
RequireAuth: false,
StaticLayer: []regfac.StaticLayerCfg{
{
Ref: ctx.ImageName(ctx.Config.Repository, SupervisorImage, ctx.VersionManifest.Components.Workspace.Supervisor.Version),
Expand Down
33 changes: 15 additions & 18 deletions install/installer/pkg/components/registry-facade/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,23 @@ func daemonset(ctx *common.RenderContext) ([]runtime.Object, error) {
}

var (
volumes []corev1.Volume
volumeMounts []corev1.VolumeMount
)

if ctx.Config.Certificate.Name != "" {
name := "config-certificates"
volumes = append(volumes, corev1.Volume{
Name: name,
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: ctx.Config.Certificate.Name,
volumes = []corev1.Volume{
{
Name: "config-certificates",
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: "builtin-registry-facade-cert",
},
},
},
})

volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: name,
MountPath: "/mnt/certificates",
})
}
}
volumeMounts = []corev1.VolumeMount{
{
Name: "config-certificates",
MountPath: "/mnt/certificates",
},
}
)

if objs, err := common.DockerRegistryHash(ctx); err != nil {
return nil, err
Expand Down
16 changes: 8 additions & 8 deletions install/installer/pkg/components/ws-proxy/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
return nil, err
}

var volumes []corev1.Volume
var volumeMounts []corev1.VolumeMount
if ctx.Config.Certificate.Name != "" {
volumes = append(volumes, corev1.Volume{
volumes := []corev1.Volume{
{
Name: "config-certificates",
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: ctx.Config.Certificate.Name,
},
},
})
},
}

volumeMounts = append(volumeMounts, corev1.VolumeMount{
volumeMounts := []corev1.VolumeMount{
{
Name: "config-certificates",
MountPath: "/mnt/certificates",
})
MountPath: "/mnt/certificates"},
}

if ctx.Config.SSHGatewayHostKey != nil {
volumes = append(volumes, corev1.Volume{
Name: "host-key",
Expand Down