-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[installer, ws-manager]: Use installation shortname in URL templates #10152
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
[installer, ws-manager]: Use installation shortname in URL templates #10152
Conversation
/hold |
@meysholdt how do you deploy gitpod in preview env? |
@gitpod-io/platform for comment above. can you provide insight before we will merge this. |
@andrew-farries @sagor999 The Werft job uses the Gitpod Installer to generate a config for the installer and then modifies it quite heavily for preview environments. The implementation is here. The metadata.shortname is set to
So the change you want to make (if you just want to remove diff --git a/.werft/jobs/build/installer/installer.ts b/.werft/jobs/build/installer/installer.ts
index 52edde6f6..ea2a83671 100644
--- a/.werft/jobs/build/installer/installer.ts
+++ b/.werft/jobs/build/installer/installer.ts
@@ -58,6 +58,7 @@ export class Installer {
this.options.werft.log(slice, "Adding extra configuration");
try {
this.getDevCustomValues(slice)
+ this.configureMetadata(slice)
this.configureContainerRegistry(slice)
this.configureDomain(slice)
this.configureWorkspaces(slice)
@@ -92,6 +93,10 @@ export class Installer {
exec(`yq m -i ${this.options.installerConfigPath} ${WORKSPACE_SIZE_CONFIG_PATH}`, { slice: slice });
}
+ private configureMetadata(slice: string): void {
+ exec(`yq d -i ${this.options.installerConfigPath} metadata.shortname `, { slice: slice });
+ }
+
private configureContainerRegistry(slice: string): void {
exec(`yq w -i ${this.options.installerConfigPath} certificate.name ${this.options.proxySecretName}`, { slice: slice });
exec(`yq w -i ${this.options.installerConfigPath} containerRegistry.inCluster false`, { slice: slice }); |
Thanks @mads-hartmann. I'm more concerned about the consequences of removing the installation shortname rather than the mechanics of how to do it, given the comment here from @geropl:
But I guess we can leave it as the default in the installer and remove it specifically for preview environments. |
Yeah I think that's the best option, and that is what the TypeScript diff above should do |
52a10c2
to
f4fa140
Compare
a3fb0aa
to
1800f7b
Compare
I've removed the |
/werft run with-clean-slate-deployment=true 👍 started the job as gitpod-build-af-installer-append-shortname-to-url-template.17 |
@andrew-farries can you rebase your PR? There is a breaking change without which build fails now :( |
1800f7b
to
e9b4b40
Compare
/werft run with-clean-slate-deployment=true 👍 started the job as gitpod-build-af-installer-append-shortname-to-url-template.19 |
Tests failing due to this: #10243. Will rebase again when that's resolved. |
@sagor999 could you test the installer asset produced by this build in an ephemeral cluster? I'm worried this could impact our post processing for |
e9b4b40
to
d0a8c58
Compare
@kylos101 tested ephemeral cluster creation using installer from this branch. All worked fine. Was able to start workspace in that cluster. |
Domain: "example.com", | ||
InstallationShortname: "eu02", | ||
ExpectedWorkspaceUrlTemplate: "https://{{ .Prefix }}.ws-eu02.example.com", | ||
ExpectedWorkspacePortURLTemplate: "https://{{ .WorkspacePort }}-{{ .Prefix }}.ws-eu02.example.com", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Domain: "example.com", | ||
InstallationShortname: "", | ||
ExpectedWorkspaceUrlTemplate: "https://{{ .Prefix }}.ws.example.com", | ||
ExpectedWorkspacePortURLTemplate: "https://{{ .WorkspacePort }}-{{ .Prefix }}.ws.example.com", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrew-farries We need a test case "with 'default' as installation shortname" to cover all existing self-hosted installations out there I think. That will lead us to the comment above I think.
@andrew-farries I added that line when making The problem is that whatever we put into
💯 This is what I would have done as well. |
@@ -113,6 +113,11 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { | |||
return nil, err | |||
} | |||
|
|||
installationShortNameSuffix := "" | |||
if ctx.Config.Metadata.InstallationShortname != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrew-farries IMO we need to check for `!= "" && != "default", no? (cmp test cases below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches how these URLs were constructed in the old helm chart: https://github.com/gitpod-io/gitpod/blob/2f988c93499926bd34d6728defbd9d9c0964797e/chart/templates/ws-manager-configmap.yaml#L74-L75
Use `yq -m` to merge an inline config rather than `yq -w` because the old version of `yq` we have installed does not support setting fields to the empty string literal.
14e2287
to
3bd7592
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes (my own) complaint with this commit.
/unhold |
Description
ℹ️ ℹ️ ℹ️ ℹ️
This is a second attempt at #10127, which was reverted (#10143) as it broke preview environments. See this comment in #9875. The last commit on the branch is a workaround for the preview environment issue.
ℹ️ ℹ️ ℹ️ ℹ️
As described in #9875, failing image builds currently fail to produce any useful output. A possible cause, as described in this comment, is that the format of the
ws-manager
WorkspaceURLTemplate
strings is wrong.When we deployed with the old helm chart, these values were set in the relevant configmap like this:
gitpod/chart/templates/ws-manager-configmap.yaml
Lines 74 to 75 in 2f988c9
ie, they included a suffix after the
ws
.This PR tailors the installer output to produce these URLs in the same way the old helm chart did. Installation short name suffixes like
eu-02
are set here:https://github.com/gitpod-io/ops/blob/main/deploy/production/meta-eu02/app/installer-config.yaml#L6
so the URLs will now look like
https://{{ .Prefix }}.ws-eu02.example.com
.Related Issue(s)
Fixes #9875
How to test
I've tested this change in staging by editing the
ws-manager
configmap in staging to contain the correct URLs, restartingws-manager
and running an image build. I was able to see image build logs as expected:Release Notes
Documentation
None