Skip to content

Commit 15d59d9

Browse files
[werft] Add flag gcp-storage to use GCP storage instead of MinIO
1 parent 7c5153c commit 15d59d9

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

.werft/build.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ async function build(context, version) {
106106
const withInstaller = "with-installer" in buildConfig || masterBuild;
107107
const noPreview = "no-preview" in buildConfig || publishRelease;
108108
const registryFacadeHandover = "registry-facade-handover" in buildConfig;
109+
const gcpStorage = "gcp-storage" in buildConfig;
109110
werft.log("job config", JSON.stringify({
110111
buildConfig,
111112
version,
@@ -117,6 +118,7 @@ async function build(context, version) {
117118
dynamicCPULimits,
118119
noPreview,
119120
registryFacadeHandover,
121+
gcpStorage,
120122
}));
121123

122124
/**
@@ -161,15 +163,15 @@ async function build(context, version) {
161163
werft.phase("deploy", "not deploying");
162164
console.log("no-preview or publish-release is set");
163165
} else {
164-
await deployToDev(version, workspaceFeatureFlags, dynamicCPULimits, registryFacadeHandover);
166+
await deployToDev(version, workspaceFeatureFlags, dynamicCPULimits, registryFacadeHandover, gcpStorage);
165167
}
166168
}
167169

168170

169171
/**
170172
* Deploy dev
171173
*/
172-
async function deployToDev(version, workspaceFeatureFlags, dynamicCPULimits, registryFacadeHandover) {
174+
async function deployToDev(version, workspaceFeatureFlags, dynamicCPULimits, registryFacadeHandover, gcpStorage) {
173175
werft.phase("deploy", "deploying to dev");
174176
const destname = version.split(".")[0];
175177
const namespace = `staging-${destname}`;
@@ -284,6 +286,12 @@ async function deployToDev(version, workspaceFeatureFlags, dynamicCPULimits, reg
284286
try {
285287
shell.cd("chart");
286288
werft.log('helm', 'installing Gitpod');
289+
290+
if (gcpStorage) {
291+
flags+=` -f ../.werft/values.dev.gcp-storage.yaml`
292+
// Here we could also add the secret 'remote-storage-gcloud' to access the GCP bucket.
293+
// For now, one had to create the secret with `kubectl apply ...` by hand after deployment.
294+
}
287295

288296
exec(`helm dependencies up`);
289297
exec(`/usr/local/bin/helm3 upgrade --install --timeout 10m -f ../.werft/values.dev.yaml ${flags} gitpod .`);

.werft/values.dev.gcp-storage.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
components:
2+
contentService:
3+
remoteStorage:
4+
kind: gcloud
5+
backupTrail:
6+
enabled: true
7+
maxLength: 2
8+
gcloud:
9+
credentialsFileUpload: true
10+
credentialsFile: /credentials/service-account.json
11+
projectId: gitpod-dev
12+
region: europe-west1
13+
tmpdir: /mnt/sync-tmp
14+
parallelUpload: 6
15+
volumes:
16+
- name: gcloud-creds
17+
secret:
18+
secretName: remote-storage-gcloud
19+
volumeMounts:
20+
- mountPath: /credentials
21+
name: gcloud-creds
22+
wsManager:
23+
volumes:
24+
- name: gcloud-creds
25+
secret:
26+
secretName: remote-storage-gcloud
27+
volumeMounts:
28+
- mountPath: /credentials
29+
name: gcloud-creds
30+
wsDaemon:
31+
volumes:
32+
- name: gcloud-creds
33+
secret:
34+
secretName: remote-storage-gcloud
35+
volumeMounts:
36+
- mountPath: /credentials
37+
name: gcloud-creds
38+
39+
minio:
40+
enabled: false

0 commit comments

Comments
 (0)