diff --git a/install/installer/cmd/mirror_list.go b/install/installer/cmd/mirror_list.go index d75a7460ef345d..b5ba93dced44db 100644 --- a/install/installer/cmd/mirror_list.go +++ b/install/installer/cmd/mirror_list.go @@ -139,7 +139,9 @@ func generateMirrorList(cfgVersion string, cfg *configv1.Config) ([]mirrorListRe images = append(images, mirrorListRepo{ Original: img, - Target: target, + Target: common.RepoName("", target, &configv1.Config{ + Repository: targetRepo, + }), }) } diff --git a/install/installer/pkg/common/ca.go b/install/installer/pkg/common/ca.go index 42b5a0202d977c..9e7791079317f5 100644 --- a/install/installer/pkg/common/ca.go +++ b/install/installer/pkg/common/ca.go @@ -39,7 +39,7 @@ func InternalCAContainer(ctx *RenderContext, mod ...func(*corev1.Container)) *co res := &corev1.Container{ Name: "update-ca-certificates", // It's not possible to use images based on alpine due to errors running update-ca-certificates - Image: ImageName(ctx.Config.Repository, "ca-updater", ctx.VersionManifest.Components.CAUpdater.Version), + Image: ImageName(ctx.Config.Repository, "ca-updater", ctx.VersionManifest.Components.CAUpdater.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Command: []string{ "bash", "-c", diff --git a/install/installer/pkg/common/common.go b/install/installer/pkg/common/common.go index 806b81c1b47d5c..d47654cb01898d 100644 --- a/install/installer/pkg/common/common.go +++ b/install/installer/pkg/common/common.go @@ -248,7 +248,7 @@ func DatabaseEnv(cfg *config.Config) (res []corev1.EnvVar) { func DatabaseWaiterContainer(ctx *RenderContext) *corev1.Container { return &corev1.Container{ Name: "database-waiter", - Image: ImageName(ctx.Config.Repository, "service-waiter", ctx.VersionManifest.Components.ServiceWaiter.Version), + Image: ImageName(ctx.Config.Repository, "service-waiter", ctx.VersionManifest.Components.ServiceWaiter.Version, &ctx.Config), Args: []string{ "-v", "database", @@ -266,7 +266,7 @@ func DatabaseWaiterContainer(ctx *RenderContext) *corev1.Container { func MessageBusWaiterContainer(ctx *RenderContext) *corev1.Container { return &corev1.Container{ Name: "msgbus-waiter", - Image: ImageName(ctx.Config.Repository, "service-waiter", ctx.VersionManifest.Components.ServiceWaiter.Version), + Image: ImageName(ctx.Config.Repository, "service-waiter", ctx.VersionManifest.Components.ServiceWaiter.Version, &ctx.Config), Args: []string{ "-v", "messagebus", @@ -284,7 +284,7 @@ func MessageBusWaiterContainer(ctx *RenderContext) *corev1.Container { func KubeRBACProxyContainer(ctx *RenderContext) *corev1.Container { return &corev1.Container{ Name: "kube-rbac-proxy", - Image: ImageName(ThirdPartyContainerRepo(ctx.Config.Repository, KubeRBACProxyRepo), KubeRBACProxyImage, KubeRBACProxyTag), + Image: ImageName(ThirdPartyContainerRepo(ctx.Config.Repository, KubeRBACProxyRepo), KubeRBACProxyImage, KubeRBACProxyTag, &ctx.Config), Args: []string{ "--v=5", "--logtostderr", @@ -339,7 +339,7 @@ func Affinity(orLabels ...string) *corev1.Affinity { } } -func RepoName(repo, name string) string { +func RepoName(repo, name string, cfg *config.Config) string { var ref string if repo == "" { ref = name @@ -350,11 +350,26 @@ func RepoName(repo, name string) string { if err != nil { panic(fmt.Sprintf("cannot parse image repo %s: %v", ref, err)) } - return pref.String() + + prefString := pref.String() + + if cfg.Repository != GitpodContainerRegistry { + // If not in the Gitpod registry, don't use namespaces unless specified in the config. + // This is to match the KOTS registry format of no namespace in the name + s := strings.Split(prefString, "/") + + noNamespace := []string{ + cfg.Repository, + s[len(s)-1], + } + return strings.Join(noNamespace, "/") + } + + return prefString } -func ImageName(repo, name, tag string) string { - ref := fmt.Sprintf("%s:%s", RepoName(repo, name), tag) +func ImageName(repo, name, tag string, cfg *config.Config) string { + ref := fmt.Sprintf("%s:%s", RepoName(repo, name, cfg), tag) pref, err := reference.ParseNamed(ref) if err != nil { panic(fmt.Sprintf("cannot parse image ref %s: %v", ref, err)) diff --git a/install/installer/pkg/common/common_test.go b/install/installer/pkg/common/common_test.go index 8ba4236c47833d..7880d08c52fb82 100644 --- a/install/installer/pkg/common/common_test.go +++ b/install/installer/pkg/common/common_test.go @@ -5,9 +5,11 @@ package common_test import ( - "github.com/gitpod-io/gitpod/installer/pkg/common" "testing" + "github.com/gitpod-io/gitpod/installer/pkg/common" + "github.com/gitpod-io/gitpod/installer/pkg/config/v1" + "github.com/google/go-cmp/cmp" ) @@ -20,6 +22,7 @@ func TestRepoName(t *testing.T) { Repo string Name string Expectation Expectation + CfgRepo string }{ { Name: "gitpod-io/workspace-full", @@ -41,6 +44,54 @@ func TestRepoName(t *testing.T) { Panics: true, }, }, + // Custom repo, no namespace + { + Name: "gitpod-io/workspace-full", + Expectation: Expectation{ + Result: "some.registry.com/workspace-full", + }, + CfgRepo: "some.registry.com", + }, + { + Repo: "some-repo.com", + Name: "some-image", + Expectation: Expectation{ + Result: "some.registry.com/some-image", + }, + CfgRepo: "some.registry.com", + }, + { + Repo: "some-repo", + Name: "not@avalid#image-name", + Expectation: Expectation{ + Panics: true, + }, + CfgRepo: "some.registry.com", + }, + // Custom repo, namespace + { + Name: "gitpod-io/workspace-full", + Expectation: Expectation{ + Result: "some.registry.com/gitpod/workspace-full", + }, + CfgRepo: "some.registry.com/gitpod", + }, + { + Repo: "some-repo.com", + Name: "some-image", + Expectation: Expectation{ + Result: "some.registry.com/gitpod/some-image", + }, + CfgRepo: "some.registry.com/gitpod", + }, + { + Repo: "some-repo", + Name: "not@avalid#image-name", + Expectation: Expectation{ + Panics: true, + }, + CfgRepo: "some.registry.com/gitpod", + }, } for _, test := range tests { @@ -52,7 +103,16 @@ func TestRepoName(t *testing.T) { act.Panics = true } }() - act.Result = common.RepoName(test.Repo, test.Name) + cfg := config.Config{ + Repository: func() string { + if test.CfgRepo == "" { + return common.GitpodContainerRegistry + } + + return test.CfgRepo + }(), + } + act.Result = common.RepoName(test.Repo, test.Name, &cfg) }() if diff := cmp.Diff(test.Expectation, act); diff != "" { diff --git a/install/installer/pkg/components/agent-smith/daemonset.go b/install/installer/pkg/components/agent-smith/daemonset.go index 77feb29829d8c4..f6b5b6dd98374c 100644 --- a/install/installer/pkg/components/agent-smith/daemonset.go +++ b/install/installer/pkg/components/agent-smith/daemonset.go @@ -51,7 +51,7 @@ func daemonset(ctx *common.RenderContext) ([]runtime.Object, error) { TerminationGracePeriodSeconds: pointer.Int64(30), Containers: []corev1.Container{{ Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.AgentSmith.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.AgentSmith.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Args: []string{"run", "--config", "/config/config.json"}, Resources: corev1.ResourceRequirements{ diff --git a/install/installer/pkg/components/blobserve/configmap.go b/install/installer/pkg/components/blobserve/configmap.go index bf63eeec5704c1..caa2e0141c00d4 100644 --- a/install/installer/pkg/components/blobserve/configmap.go +++ b/install/installer/pkg/components/blobserve/configmap.go @@ -35,7 +35,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { Port: ContainerPort, Timeout: util.Duration(time.Second * 5), Repos: map[string]blobserve.Repo{ - common.RepoName(ctx.Config.Repository, ide.CodeIDEImage): { + common.RepoName(ctx.Config.Repository, ide.CodeIDEImage, &ctx.Config): { PrePull: []string{}, Workdir: "/ide", Replacements: []blobserve.StringReplacement{{ @@ -88,7 +88,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { Replacement: "${supervisor}", }}, }, - common.RepoName(ctx.Config.Repository, workspace.SupervisorImage): { + common.RepoName(ctx.Config.Repository, workspace.SupervisorImage, &ctx.Config): { PrePull: []string{}, Workdir: "/.supervisor/frontend", }, diff --git a/install/installer/pkg/components/blobserve/deployment.go b/install/installer/pkg/components/blobserve/deployment.go index dac76e434ca770..b5aec5cad76e1d 100644 --- a/install/installer/pkg/components/blobserve/deployment.go +++ b/install/installer/pkg/components/blobserve/deployment.go @@ -94,7 +94,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { Containers: []corev1.Container{{ Name: Component, Args: []string{"run", "/mnt/config/config.json"}, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.Blobserve.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.Blobserve.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Ports: []corev1.ContainerPort{{ Name: ServicePortName, diff --git a/install/installer/pkg/components/content-service/deployment.go b/install/installer/pkg/components/content-service/deployment.go index e6906ad2768324..3c06374b208105 100644 --- a/install/installer/pkg/components/content-service/deployment.go +++ b/install/installer/pkg/components/content-service/deployment.go @@ -41,7 +41,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { }}, Containers: []corev1.Container{{ Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.ContentService.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.ContentService.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Args: []string{ "run", diff --git a/install/installer/pkg/components/dashboard/deployment.go b/install/installer/pkg/components/dashboard/deployment.go index 270a4bc45ac276..3ff25ac55e4e74 100644 --- a/install/installer/pkg/components/dashboard/deployment.go +++ b/install/installer/pkg/components/dashboard/deployment.go @@ -48,7 +48,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { TerminationGracePeriodSeconds: pointer.Int64(30), Containers: []corev1.Container{{ Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.Dashboard.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.Dashboard.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ diff --git a/install/installer/pkg/components/database/cloudsql/deployment.go b/install/installer/pkg/components/database/cloudsql/deployment.go index 9ed634fd38e18e..fb7c2f499a0569 100644 --- a/install/installer/pkg/components/database/cloudsql/deployment.go +++ b/install/installer/pkg/components/database/cloudsql/deployment.go @@ -65,7 +65,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { Privileged: pointer.Bool(false), RunAsNonRoot: pointer.Bool(false), }, - Image: common.ImageName(ImageRepo, ImageName, ImageVersion), + Image: common.ImageName(ImageRepo, ImageName, ImageVersion, &ctx.Config), Command: []string{ "/cloud_sql_proxy", "-dir=/cloudsql", diff --git a/install/installer/pkg/components/database/incluster/helm.go b/install/installer/pkg/components/database/incluster/helm.go index 8bb44cd1397aab..d0cdfbc0cb6bdd 100644 --- a/install/installer/pkg/components/database/incluster/helm.go +++ b/install/installer/pkg/components/database/incluster/helm.go @@ -34,12 +34,15 @@ var Helm = common.CompositeHelmFunc( helm.KeyValue("mysql.initdbScriptsConfigMap", SQLInitScripts), helm.KeyValue("mysql.serviceAccount.name", Component), helm.ImagePullSecrets("mysql.image.pullSecrets", cfg), - helm.KeyValue("mysql.image.registry", common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL)), + helm.KeyValue("mysql.image.registry", ""), + helm.KeyValue("mysql.image.repository", common.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/mysql", &cfg.Config)), helm.ImagePullSecrets("mysql.metrics.image.pullSecrets", cfg), - helm.KeyValue("mysql.metrics.image.registry", common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL)), + helm.KeyValue("mysql.metrics.image.registry", ""), + helm.KeyValue("mysql.metrics.image.repository", common.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/mysqld-exporter", &cfg.Config)), helm.ImagePullSecrets("mysql.volumePermissions.image.pullSecrets", cfg), helm.KeyValue("mysql.volumePermissions.image.pullPolicy", "IfNotPresent"), - helm.KeyValue("mysql.volumePermissions.image.registry", common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL)), + helm.KeyValue("mysql.volumePermissions.image.registry", ""), + helm.KeyValue("mysql.volumePermissions.image.repository", common.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/bitnami-shell", &cfg.Config)), // improve start time helm.KeyValue("mysql.primary.startupProbe.enabled", "false"), diff --git a/install/installer/pkg/components/database/init/job.go b/install/installer/pkg/components/database/init/job.go index 4feda70b099b1d..54b317c6f8e641 100644 --- a/install/installer/pkg/components/database/init/job.go +++ b/install/installer/pkg/components/database/init/job.go @@ -47,7 +47,7 @@ func job(ctx *common.RenderContext) ([]runtime.Object, error) { InitContainers: []corev1.Container{*common.DatabaseWaiterContainer(ctx)}, Containers: []corev1.Container{{ Name: fmt.Sprintf("%s-session", Component), - Image: common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, ""), dbSessionsImage, dbSessionsTag), + Image: common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, ""), dbSessionsImage, dbSessionsTag, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Env: common.MergeEnv( common.DatabaseEnv(&ctx.Config), diff --git a/install/installer/pkg/components/docker-registry/helm.go b/install/installer/pkg/components/docker-registry/helm.go index dca86783252bf4..3bcf68886ba01f 100644 --- a/install/installer/pkg/components/docker-registry/helm.go +++ b/install/installer/pkg/components/docker-registry/helm.go @@ -23,7 +23,7 @@ var Helm = common.CompositeHelmFunc( return nil, err } - repository := fmt.Sprintf("%s/library/registry", common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL)) + repository := common.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "library/registry", &cfg.Config) registryValues := []string{ helm.KeyValue(fmt.Sprintf("docker-registry.podAnnotations.%s", strings.Replace(common.AnnotationConfigChecksum, ".", "\\.", -1)), secretHash), diff --git a/install/installer/pkg/components/gitpod/cronjob.go b/install/installer/pkg/components/gitpod/cronjob.go index 0dfb8a3e80b545..88b21d2edab638 100644 --- a/install/installer/pkg/components/gitpod/cronjob.go +++ b/install/installer/pkg/components/gitpod/cronjob.go @@ -53,7 +53,7 @@ func cronjob(ctx *common.RenderContext) ([]runtime.Object, error) { Containers: []v1.Container{ { Name: installationTelemetryComponent, - Image: common.ImageName(ctx.Config.Repository, "installation-telemetry", ctx.VersionManifest.Components.InstallationTelemetry.Version), + Image: common.ImageName(ctx.Config.Repository, "installation-telemetry", ctx.VersionManifest.Components.InstallationTelemetry.Version, &ctx.Config), ImagePullPolicy: v1.PullIfNotPresent, Args: []string{ "send", diff --git a/install/installer/pkg/components/ide-proxy/deployment.go b/install/installer/pkg/components/ide-proxy/deployment.go index bf8fd4e50beb1d..150d087466227b 100644 --- a/install/installer/pkg/components/ide-proxy/deployment.go +++ b/install/installer/pkg/components/ide-proxy/deployment.go @@ -48,7 +48,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { TerminationGracePeriodSeconds: pointer.Int64(30), Containers: []corev1.Container{{ Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.IDEProxy.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.IDEProxy.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ diff --git a/install/installer/pkg/components/image-builder-mk3/configmap.go b/install/installer/pkg/components/image-builder-mk3/configmap.go index d8af2a55a2eaa8..00f697252bbbac 100644 --- a/install/installer/pkg/components/image-builder-mk3/configmap.go +++ b/install/installer/pkg/components/image-builder-mk3/configmap.go @@ -49,7 +49,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { PullSecret: secretName, PullSecretFile: PullSecretFile, BaseImageRepository: fmt.Sprintf("%s/base-images", registryName), - BuilderImage: common.ImageName(ctx.Config.Repository, BuilderImage, ctx.VersionManifest.Components.ImageBuilderMk3.BuilderImage.Version), + BuilderImage: common.ImageName(ctx.Config.Repository, BuilderImage, ctx.VersionManifest.Components.ImageBuilderMk3.BuilderImage.Version, &ctx.Config), WorkspaceImageRepository: fmt.Sprintf("%s/workspace-images", registryName), } @@ -58,7 +58,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { RefCache: config.RefCacheConfig{ Interval: util.Duration(time.Hour * 6).String(), Refs: []string{ - common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, ""), workspace.DefaultWorkspaceImage, workspace.DefaultWorkspaceImageVersion), + common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, ""), workspace.DefaultWorkspaceImage, workspace.DefaultWorkspaceImageVersion, &ctx.Config), }, }, Service: config.Service{ diff --git a/install/installer/pkg/components/image-builder-mk3/deployment.go b/install/installer/pkg/components/image-builder-mk3/deployment.go index 8888dd9d869932..b1e7a442661bd7 100644 --- a/install/installer/pkg/components/image-builder-mk3/deployment.go +++ b/install/installer/pkg/components/image-builder-mk3/deployment.go @@ -143,7 +143,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { }, Containers: []corev1.Container{{ Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.ImageBuilderMk3.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.ImageBuilderMk3.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Args: []string{ "run", diff --git a/install/installer/pkg/components/migrations/job.go b/install/installer/pkg/components/migrations/job.go index c96726928bf370..055fb45463455d 100644 --- a/install/installer/pkg/components/migrations/job.go +++ b/install/installer/pkg/components/migrations/job.go @@ -37,7 +37,7 @@ func job(ctx *common.RenderContext) ([]runtime.Object, error) { InitContainers: []corev1.Container{*common.DatabaseWaiterContainer(ctx)}, Containers: []corev1.Container{{ Name: Component, - Image: common.ImageName(ctx.Config.Repository, "db-migrations", ctx.VersionManifest.Components.DBMigrations.Version), + Image: common.ImageName(ctx.Config.Repository, "db-migrations", ctx.VersionManifest.Components.DBMigrations.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Env: common.MergeEnv( common.DatabaseEnv(&ctx.Config), diff --git a/install/installer/pkg/components/minio/helm.go b/install/installer/pkg/components/minio/helm.go index 62b56ae36562e7..11299da759b7d3 100644 --- a/install/installer/pkg/components/minio/helm.go +++ b/install/installer/pkg/components/minio/helm.go @@ -18,9 +18,11 @@ var Helm = common.CompositeHelmFunc( func(cfg *common.RenderContext) ([]string, error) { commonHelmValues := []string{ helm.ImagePullSecrets("minio.image.pullSecrets", cfg), - helm.KeyValue("minio.image.registry", common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL)), + helm.KeyValue("minio.image.registry", ""), + helm.KeyValue("minio.image.repository", common.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/minio", &cfg.Config)), helm.ImagePullSecrets("minio.volumePermissions.image.pullSecrets", cfg), - helm.KeyValue("minio.volumePermissions.image.registry", common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL)), + helm.KeyValue("minio.volumePermissions.image.registry", ""), + helm.KeyValue("minio.volumePermissions.image.repository", common.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/bitnami-shell", &cfg.Config)), } if pointer.BoolDeref(cfg.Config.ObjectStorage.InCluster, false) { diff --git a/install/installer/pkg/components/openvsx-proxy/statefulset.go b/install/installer/pkg/components/openvsx-proxy/statefulset.go index 87b3e1d4a12197..0c0d54e621fa49 100644 --- a/install/installer/pkg/components/openvsx-proxy/statefulset.go +++ b/install/installer/pkg/components/openvsx-proxy/statefulset.go @@ -68,7 +68,7 @@ func statefulset(ctx *common.RenderContext) ([]runtime.Object, error) { }}, Containers: []v1.Container{{ Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.OpenVSXProxy.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.OpenVSXProxy.Version, &ctx.Config), Args: []string{"/config/config.json"}, ReadinessProbe: &v1.Probe{ ProbeHandler: v1.ProbeHandler{ @@ -101,7 +101,7 @@ func statefulset(ctx *common.RenderContext) ([]runtime.Object, error) { ), }, { Name: "redis", - Image: common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, common.DockerRegistryURL), "library/redis", "6.2"), + Image: common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, common.DockerRegistryURL), "library/redis", "6.2", &ctx.Config), Command: []string{ "redis-server", "/config/redis.conf", diff --git a/install/installer/pkg/components/proxy/deployment.go b/install/installer/pkg/components/proxy/deployment.go index 8efd35c7c92857..c1cd7524d17687 100644 --- a/install/installer/pkg/components/proxy/deployment.go +++ b/install/installer/pkg/components/proxy/deployment.go @@ -130,7 +130,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { Volumes: volumes, InitContainers: []corev1.Container{{ Name: "sysctl", - Image: common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, common.DockerRegistryURL), InitContainerImage, InitContainerTag), + Image: common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, common.DockerRegistryURL), InitContainerImage, InitContainerTag, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, SecurityContext: &corev1.SecurityContext{ Privileged: pointer.Bool(true), @@ -143,7 +143,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { }}, Containers: []corev1.Container{{ Name: "kube-rbac-proxy", - Image: common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, KubeRBACProxyRepo), KubeRBACProxyImage, KubeRBACProxyTag), + Image: common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, KubeRBACProxyRepo), KubeRBACProxyImage, KubeRBACProxyTag, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Args: []string{ "--v=10", @@ -178,7 +178,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { }, }, { Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.Proxy.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.Proxy.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ diff --git a/install/installer/pkg/components/public-api-server/deployment.go b/install/installer/pkg/components/public-api-server/deployment.go index dd17a666f431ca..e9b8e2cb2cdc34 100644 --- a/install/installer/pkg/components/public-api-server/deployment.go +++ b/install/installer/pkg/components/public-api-server/deployment.go @@ -61,7 +61,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { TerminationGracePeriodSeconds: pointer.Int64(30), Containers: []corev1.Container{{ Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.PublicAPIServer.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.PublicAPIServer.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ diff --git a/install/installer/pkg/components/rabbitmq/helm.go b/install/installer/pkg/components/rabbitmq/helm.go index 003033ff080792..0268228f79d996 100644 --- a/install/installer/pkg/components/rabbitmq/helm.go +++ b/install/installer/pkg/components/rabbitmq/helm.go @@ -196,9 +196,11 @@ var Helm = common.CompositeHelmFunc( helm.KeyValue(fmt.Sprintf("rabbitmq.extraSecrets.%s.username", InClusterDbSecret), username), helm.KeyValue(fmt.Sprintf("rabbitmq.extraSecrets.%s.password", InClusterDbSecret), password), helm.ImagePullSecrets("rabbitmq.image.pullSecrets", cfg), - helm.KeyValue("rabbitmq.image.registry", common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL)), + helm.KeyValue("rabbitmq.image.registry", ""), + helm.KeyValue("rabbitmq.image.repository", common.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/rabbitmq", &cfg.Config)), helm.ImagePullSecrets("volumePermissions.image.pullSecrets", cfg), - helm.KeyValue("rabbitmq.volumePermissions.image.registry", common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL)), + helm.KeyValue("rabbitmq.volumePermissions.image.registry", ""), + helm.KeyValue("rabbitmq.volumePermissions.image.repository", common.RepoName(common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL), "bitnami/bitnami-shell", &cfg.Config)), helm.KeyValue("rabbitmq.livenessProbe.initialDelaySeconds", "30"), }, diff --git a/install/installer/pkg/components/registry-facade/configmap.go b/install/installer/pkg/components/registry-facade/configmap.go index 2ba9d11924045c..d9041da2ae535f 100644 --- a/install/installer/pkg/components/registry-facade/configmap.go +++ b/install/installer/pkg/components/registry-facade/configmap.go @@ -71,15 +71,15 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { RequireAuth: false, StaticLayer: []regfac.StaticLayerCfg{ { - Ref: common.ImageName(ctx.Config.Repository, SupervisorImage, ctx.VersionManifest.Components.Workspace.Supervisor.Version), + Ref: common.ImageName(ctx.Config.Repository, SupervisorImage, ctx.VersionManifest.Components.Workspace.Supervisor.Version, &ctx.Config), Type: "image", }, { - Ref: common.ImageName(ctx.Config.Repository, WorkspacekitImage, ctx.VersionManifest.Components.Workspace.Workspacekit.Version), + Ref: common.ImageName(ctx.Config.Repository, WorkspacekitImage, ctx.VersionManifest.Components.Workspace.Workspacekit.Version, &ctx.Config), Type: "image", }, { - Ref: common.ImageName(ctx.Config.Repository, DockerUpImage, ctx.VersionManifest.Components.Workspace.DockerUp.Version), + Ref: common.ImageName(ctx.Config.Repository, DockerUpImage, ctx.VersionManifest.Components.Workspace.DockerUp.Version, &ctx.Config), Type: "image", }, }, diff --git a/install/installer/pkg/components/registry-facade/daemonset.go b/install/installer/pkg/components/registry-facade/daemonset.go index d972a69a7dd5ef..673fa8ec311a3c 100644 --- a/install/installer/pkg/components/registry-facade/daemonset.go +++ b/install/installer/pkg/components/registry-facade/daemonset.go @@ -179,7 +179,7 @@ func daemonset(ctx *common.RenderContext) ([]runtime.Object, error) { }, Containers: []corev1.Container{{ Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.RegistryFacade.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.RegistryFacade.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Args: []string{"run", "/mnt/config/config.json"}, Resources: corev1.ResourceRequirements{ diff --git a/install/installer/pkg/components/server/configmap.go b/install/installer/pkg/components/server/configmap.go index 0ed74603497d5a..ca403a068c217f 100644 --- a/install/installer/pkg/components/server/configmap.go +++ b/install/installer/pkg/components/server/configmap.go @@ -32,9 +32,10 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { license = licenseFilePath } - workspaceImage := common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, ""), workspace.DefaultWorkspaceImage, workspace.DefaultWorkspaceImageVersion) + workspaceImage := common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, ""), workspace.DefaultWorkspaceImage, workspace.DefaultWorkspaceImageVersion, &ctx.Config) _ = ctx.WithExperimental(func(cfg *experimental.Config) error { if cfg.WebApp != nil && cfg.WebApp.Server != nil && cfg.WebApp.Server.WorkspaceDefaults.WorkspaceImage != "" { + // @todo(sje): this may not be picked up by an airgapped installation workspaceImage = cfg.WebApp.Server.WorkspaceDefaults.WorkspaceImage } return nil diff --git a/install/installer/pkg/components/server/deployment.go b/install/installer/pkg/components/server/deployment.go index e7e550cba7bf33..c0c2689503e712 100644 --- a/install/installer/pkg/components/server/deployment.go +++ b/install/installer/pkg/components/server/deployment.go @@ -224,7 +224,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { InitContainers: []corev1.Container{*common.DatabaseWaiterContainer(ctx), *common.MessageBusWaiterContainer(ctx)}, Containers: []corev1.Container{{ Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.Server.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.Server.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ diff --git a/install/installer/pkg/components/server/ide/configmap.go b/install/installer/pkg/components/server/ide/configmap.go index 757f85256e10b7..93149f74ead16e 100644 --- a/install/installer/pkg/components/server/ide/configmap.go +++ b/install/installer/pkg/components/server/ide/configmap.go @@ -42,13 +42,13 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { return nil }) if resolveLatest { - return common.ImageName(ctx.Config.Repository, name, tag) + return common.ImageName(ctx.Config.Repository, name, tag, &ctx.Config) } - return common.ImageName(ctx.Config.Repository, name, bundledLatest.Version) + return common.ImageName(ctx.Config.Repository, name, bundledLatest.Version, &ctx.Config) } idecfg := IDEConfig{ - SupervisorImage: common.ImageName(ctx.Config.Repository, workspace.SupervisorImage, ctx.VersionManifest.Components.Workspace.Supervisor.Version), + SupervisorImage: common.ImageName(ctx.Config.Repository, workspace.SupervisorImage, ctx.VersionManifest.Components.Workspace.Supervisor.Version, &ctx.Config), IDEOptions: IDEOptions{ IDEClients: map[string]IDEClient{ "vscode": { @@ -80,7 +80,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { Type: typeBrowser, Label: pointer.String("Browser"), Logo: getIdeLogoPath("vscode"), - Image: common.ImageName(ctx.Config.Repository, ide.CodeIDEImage, ide.CodeIDEImageStableVersion), + Image: common.ImageName(ctx.Config.Repository, ide.CodeIDEImage, ide.CodeIDEImageStableVersion, &ctx.Config), LatestImage: resolveLatestImage(ide.CodeIDEImage, "nightly", ctx.VersionManifest.Components.Workspace.CodeImage), }, codeDesktop: { @@ -88,15 +88,15 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { Title: "VS Code", Type: typeDesktop, Logo: getIdeLogoPath("vscode"), - Image: common.ImageName(ctx.Config.Repository, ide.CodeDesktopIDEImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.CodeDesktopImage.Version), - LatestImage: common.ImageName(ctx.Config.Repository, ide.CodeDesktopInsidersIDEImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.CodeDesktopImageInsiders.Version), + Image: common.ImageName(ctx.Config.Repository, ide.CodeDesktopIDEImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.CodeDesktopImage.Version, &ctx.Config), + LatestImage: common.ImageName(ctx.Config.Repository, ide.CodeDesktopInsidersIDEImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.CodeDesktopImageInsiders.Version, &ctx.Config), }, intellij: { OrderKey: pointer.String("04"), Title: "IntelliJ IDEA", Type: typeDesktop, Logo: getIdeLogoPath("intellijIdeaLogo"), - Image: common.ImageName(ctx.Config.Repository, ide.IntelliJDesktopIDEImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.IntelliJImage.Version), + Image: common.ImageName(ctx.Config.Repository, ide.IntelliJDesktopIDEImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.IntelliJImage.Version, &ctx.Config), LatestImage: resolveLatestImage(ide.IntelliJDesktopIDEImage, "latest", ctx.VersionManifest.Components.Workspace.DesktopIdeImages.IntelliJLatestImage), }, goland: { @@ -104,7 +104,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { Title: "GoLand", Type: typeDesktop, Logo: getIdeLogoPath("golandLogo"), - Image: common.ImageName(ctx.Config.Repository, ide.GoLandDesktopIdeImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.GoLandImage.Version), + Image: common.ImageName(ctx.Config.Repository, ide.GoLandDesktopIdeImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.GoLandImage.Version, &ctx.Config), LatestImage: resolveLatestImage(ide.GoLandDesktopIdeImage, "latest", ctx.VersionManifest.Components.Workspace.DesktopIdeImages.GoLandLatestImage), }, pycharm: { @@ -112,7 +112,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { Title: "PyCharm", Type: typeDesktop, Logo: getIdeLogoPath("pycharmLogo"), - Image: common.ImageName(ctx.Config.Repository, ide.PyCharmDesktopIdeImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.PyCharmImage.Version), + Image: common.ImageName(ctx.Config.Repository, ide.PyCharmDesktopIdeImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.PyCharmImage.Version, &ctx.Config), LatestImage: resolveLatestImage(ide.PyCharmDesktopIdeImage, "latest", ctx.VersionManifest.Components.Workspace.DesktopIdeImages.PyCharmLatestImage), }, phpstorm: { @@ -120,7 +120,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { Title: "PhpStorm", Type: typeDesktop, Logo: getIdeLogoPath("phpstormLogo"), - Image: common.ImageName(ctx.Config.Repository, ide.PhpStormDesktopIdeImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.PhpStormImage.Version), + Image: common.ImageName(ctx.Config.Repository, ide.PhpStormDesktopIdeImage, ctx.VersionManifest.Components.Workspace.DesktopIdeImages.PhpStormImage.Version, &ctx.Config), LatestImage: resolveLatestImage(ide.PhpStormDesktopIdeImage, "latest", ctx.VersionManifest.Components.Workspace.DesktopIdeImages.PhpStormLatestImage), }, }, diff --git a/install/installer/pkg/components/ws-daemon/daemonset.go b/install/installer/pkg/components/ws-daemon/daemonset.go index a6c814fb248d92..d79047ee8e7350 100644 --- a/install/installer/pkg/components/ws-daemon/daemonset.go +++ b/install/installer/pkg/components/ws-daemon/daemonset.go @@ -32,7 +32,7 @@ func daemonset(ctx *common.RenderContext) ([]runtime.Object, error) { initContainers := []corev1.Container{ { Name: "disable-kube-health-monitor", - Image: common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, common.DockerRegistryURL), "library/ubuntu", "20.04"), + Image: common.ImageName(common.ThirdPartyContainerRepo(ctx.Config.Repository, common.DockerRegistryURL), "library/ubuntu", "20.04", &ctx.Config), Command: []string{ "/usr/bin/nsenter", "-t", @@ -61,7 +61,7 @@ fi }, { Name: "seccomp-profile-installer", - Image: common.ImageName(cfg.Repository, "seccomp-profile-installer", ctx.VersionManifest.Components.WSDaemon.UserNamespaces.SeccompProfileInstaller.Version), + Image: common.ImageName(cfg.Repository, "seccomp-profile-installer", ctx.VersionManifest.Components.WSDaemon.UserNamespaces.SeccompProfileInstaller.Version, &ctx.Config), Command: []string{ "/bin/sh", "-c", @@ -75,7 +75,7 @@ fi }, { Name: "sysctl", - Image: common.ImageName(cfg.Repository, "ws-daemon", ctx.VersionManifest.Components.WSDaemon.Version), + Image: common.ImageName(cfg.Repository, "ws-daemon", ctx.VersionManifest.Components.WSDaemon.Version, &ctx.Config), Command: []string{ "sh", "-c", @@ -97,7 +97,7 @@ fi if cfg.Workspace.Runtime.FSShiftMethod == config.FSShiftShiftFS { initContainers = append(initContainers, corev1.Container{ Name: "shiftfs-module-loader", - Image: common.ImageName(cfg.Repository, "shiftfs-module-loader", ctx.VersionManifest.Components.WSDaemon.UserNamespaces.ShiftFSModuleLoader.Version), + Image: common.ImageName(cfg.Repository, "shiftfs-module-loader", ctx.VersionManifest.Components.WSDaemon.UserNamespaces.ShiftFSModuleLoader.Version, &ctx.Config), VolumeMounts: []corev1.VolumeMount{{ Name: "node-linux-src", ReadOnly: true, @@ -190,7 +190,7 @@ fi Containers: []corev1.Container{ { Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.WSDaemon.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.WSDaemon.Version, &ctx.Config), Args: []string{ "run", "--config", diff --git a/install/installer/pkg/components/ws-manager-bridge/deployment.go b/install/installer/pkg/components/ws-manager-bridge/deployment.go index 9a0009e92f9c85..90614bca42a8e1 100644 --- a/install/installer/pkg/components/ws-manager-bridge/deployment.go +++ b/install/installer/pkg/components/ws-manager-bridge/deployment.go @@ -109,7 +109,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { InitContainers: []corev1.Container{*common.DatabaseWaiterContainer(ctx), *common.MessageBusWaiterContainer(ctx)}, Containers: []corev1.Container{{ Name: Component, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.WSManagerBridge.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.WSManagerBridge.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ diff --git a/install/installer/pkg/components/ws-manager/deployment.go b/install/installer/pkg/components/ws-manager/deployment.go index 48fce468c53967..ab6f8ef48f05e0 100644 --- a/install/installer/pkg/components/ws-manager/deployment.go +++ b/install/installer/pkg/components/ws-manager/deployment.go @@ -35,7 +35,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { Containers: []corev1.Container{{ Name: Component, Args: []string{"run", "--config", "/config/config.json"}, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.WSManager.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.WSManager.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ diff --git a/install/installer/pkg/components/ws-proxy/configmap.go b/install/installer/pkg/components/ws-proxy/configmap.go index 0ba07f50faf551..2fc0bd3c230795 100644 --- a/install/installer/pkg/components/ws-proxy/configmap.go +++ b/install/installer/pkg/components/ws-proxy/configmap.go @@ -56,7 +56,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { WorkspacePodConfig: &proxy.WorkspacePodConfig{ TheiaPort: workspace.ContainerPort, SupervisorPort: workspace.SupervisorPort, - SupervisorImage: common.ImageName(ctx.Config.Repository, workspace.SupervisorImage, ctx.VersionManifest.Components.Workspace.Supervisor.Version), + SupervisorImage: common.ImageName(ctx.Config.Repository, workspace.SupervisorImage, ctx.VersionManifest.Components.Workspace.Supervisor.Version, &ctx.Config), }, BuiltinPages: proxy.BuiltinPagesConfig{ Location: "/app/public", diff --git a/install/installer/pkg/components/ws-proxy/deployment.go b/install/installer/pkg/components/ws-proxy/deployment.go index 216f2a2bbaf9ed..990e6251713bfc 100644 --- a/install/installer/pkg/components/ws-proxy/deployment.go +++ b/install/installer/pkg/components/ws-proxy/deployment.go @@ -116,7 +116,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) { Containers: []corev1.Container{{ Name: Component, Args: []string{"run", "/config/config.json"}, - Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.WSProxy.Version), + Image: common.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.WSProxy.Version, &ctx.Config), ImagePullPolicy: corev1.PullIfNotPresent, Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{