Showing with 8,731 additions and 2,136 deletions.
  1. +3 −0 .github/ISSUE_TEMPLATE/bug_report.md
  2. +1 −1 .gitpod.yml
  3. +27 −8 .werft/build.js
  4. +1 −1 .werft/build.yaml
  5. +1 −1 .werft/wipe-devstaging.yaml
  6. +8 −0 README.md
  7. +2 −2 chart/config/proxy/vhost.server.conf
  8. +2 −1 chart/templates/cluster-restricted-root-podsecuritypolicy.yaml
  9. +20 −0 chart/templates/registry-facade-clusterrole.yaml
  10. +9 −1 chart/templates/registry-facade-configmap.yaml
  11. +35 −2 chart/templates/registry-facade-daemonset.yaml
  12. +65 −0 chart/templates/registry-facade-podsecuritypolicy.yaml
  13. +1 −1 chart/templates/registry-facade-rolebinding.yaml
  14. +9 −2 chart/values.yaml
  15. +1 −0 components/BUILD.yaml
  16. +30 −22 components/blobserve/go.mod
  17. +264 −31 components/blobserve/go.sum
  18. +32 −35 components/common-go/go.mod
  19. +287 −41 components/common-go/go.sum
  20. +28 −20 components/content-service-api/go/go.mod
  21. +1 −1 components/content-service-api/typescript/util/go.mod
  22. +0 −59 components/content-service-api/typescript/util/go.sum
  23. +29 −22 components/content-service/go.mod
  24. +78 −35 components/content-service/go.sum
  25. +60 −7 components/dashboard/ee/src/components/admin/user-view.tsx
  26. +3 −0 components/dashboard/src/components/access-control/access-control.tsx
  27. +3 −0 components/dashboard/src/components/create/create-workspace.tsx
  28. +3 −0 components/dashboard/src/components/create/index.tsx
  29. +74 −74 components/dashboard/src/components/delete-account-view.tsx
  30. +3 −0 components/dashboard/src/components/github/install-github-app.tsx
  31. +0 −5 components/dashboard/src/components/repositories.tsx
  32. +9 −3 components/dashboard/src/components/settings/index.tsx
  33. +3 −0 components/dashboard/src/components/start-workspace.tsx
  34. +3 −0 components/dashboard/src/components/workspaces.tsx
  35. +24 −0 components/docker-up/slirp-docker-proxy/main.go
  36. +28 −20 components/ee/cerc/go.mod
  37. +270 −31 components/ee/cerc/go.sum
  38. +6 −5 components/ee/ws-scheduler/cmd/test-cluster-scaleup.go
  39. +3 −2 components/ee/ws-scheduler/cmd/test-scheduling-pressure.go
  40. +36 −34 components/ee/ws-scheduler/go.mod
  41. +376 −91 components/ee/ws-scheduler/go.sum
  42. +7 −7 components/ee/ws-scheduler/pkg/scheduler/scheduler.go
  43. +6 −4 components/ee/ws-scheduler/pkg/scheduler/state.go
  44. +16 −0 components/gitpod-protocol/go/BUILD.yaml
  45. +9 −9 components/{supervisor/pkg/gitpod → gitpod-protocol/go}/gitpod-config-types.go
  46. +1 −1 components/{supervisor/pkg/gitpod → gitpod-protocol/go}/gitpod-config.go
  47. +1 −1 components/{supervisor/pkg/gitpod → gitpod-protocol/go}/gitpod-config_test.go
  48. +1 −1 components/{supervisor/pkg/gitpod → gitpod-protocol/go}/gitpod-service.go
  49. +64 −0 components/gitpod-protocol/go/go.mod
  50. +459 −0 components/gitpod-protocol/go/go.sum
  51. +1 −1 components/{supervisor/pkg/gitpod → gitpod-protocol/go}/mock.go
  52. +1 −1 components/{supervisor/pkg/gitpod → gitpod-protocol/go}/reconnecting-ws.go
  53. +1 −0 components/gitpod-protocol/src/admin-protocol.ts
  54. +4 −0 components/gitpod-protocol/src/util/gitpod-host-url.ts
  55. +1 −0 components/ide/code/BUILD.yaml
  56. +2 −0 components/ide/code/bin/code
  57. +2 −0 components/ide/code/bin/gitpod-code
  58. +2 −0 components/ide/code/bin/open
  59. +15 −2 components/ide/code/leeway.Dockerfile
  60. +0 −2 components/ide/code/startup.sh
  61. +28 −20 components/image-builder-api/go/go.mod
  62. +29 −21 components/image-builder/go.mod
  63. +80 −42 components/image-builder/go.sum
  64. +6 −3 components/image-builder/workspace-image-layer/gitpod-layer/alpine/gitpod/.bashrc-prepend
  65. +6 −3 components/image-builder/workspace-image-layer/gitpod-layer/amazon/gitpod/.bashrc-prepend
  66. +6 −3 components/image-builder/workspace-image-layer/gitpod-layer/debian/gitpod/.bashrc-prepend
  67. +65 −0 components/registry-facade/cmd/handover.go
  68. +10 −2 components/registry-facade/cmd/run.go
  69. +30 −23 components/registry-facade/go.mod
  70. +264 −33 components/registry-facade/go.sum
  71. +140 −0 components/registry-facade/pkg/handover/handover.go
  72. +49 −0 components/registry-facade/pkg/handover/handover_test.go
  73. +51 −0 components/registry-facade/pkg/registry/fixtures/layersrc_code_envs.golden
  74. +9 −0 components/registry-facade/pkg/registry/fixtures/layersrc_code_envs.json
  75. +2 −1 components/registry-facade/pkg/registry/fixtures/layersrc_skipN-10.golden
  76. +2 −1 components/registry-facade/pkg/registry/fixtures/layersrc_skipN1.golden
  77. +2 −1 components/registry-facade/pkg/registry/fixtures/layersrc_skipN10.golden
  78. +2 −1 components/registry-facade/pkg/registry/fixtures/layersrc_skipNotANumber.golden
  79. +75 −0 components/registry-facade/pkg/registry/fixtures/layersrc_theia_envs.golden
  80. +9 −0 components/registry-facade/pkg/registry/fixtures/layersrc_theia_envs.json
  81. +12 −0 components/registry-facade/pkg/registry/imagecfg.go
  82. +169 −8 components/registry-facade/pkg/registry/layersource.go
  83. +10 −4 components/registry-facade/pkg/registry/layersource_test.go
  84. +137 −6 components/registry-facade/pkg/registry/registry.go
  85. +19 −0 components/server/ee/src/workspace/gitpod-server-impl.ts
  86. +1 −0 components/server/src/auth/auth-provider.ts
  87. +1 −1 components/server/src/auth/authenticator.ts
  88. +12 −4 components/server/src/auth/bearer-authenticator.ts
  89. +1 −1 components/server/src/auth/generic-auth-provider.ts
  90. +1 −1 components/server/src/github/github-context-parser.ts
  91. +3 −2 components/server/src/gitlab/gitlab-auth-provider.ts
  92. +13 −1 components/server/src/storage/gcloud-storage-client.ts
  93. +9 −0 components/server/src/user/user-controller.ts
  94. +4 −0 components/server/src/workspace/gitpod-server-impl.ts
  95. +28 −20 components/service-waiter/go.mod
  96. +272 −31 components/service-waiter/go.sum
  97. +0 −1 components/supervisor-api/go/go.mod
  98. +3 −9 components/supervisor-api/go/go.sum
  99. +5 −0 components/supervisor/BUILD.yaml
  100. +1 −1 components/supervisor/cmd/call-server.go
  101. +11 −18 components/supervisor/cmd/rings.go
  102. +34 −26 components/supervisor/go.mod
  103. +81 −43 components/supervisor/go.sum
  104. +1 −1 components/supervisor/pkg/ports/exposed-ports.go
  105. +1 −1 components/supervisor/pkg/ports/ports-config.go
  106. +1 −1 components/supervisor/pkg/ports/ports-config_test.go
  107. +1 −1 components/supervisor/pkg/ports/ports.go
  108. +1 −1 components/supervisor/pkg/ports/ports_test.go
  109. +1 −1 components/supervisor/pkg/supervisor/git.go
  110. +1 −1 components/supervisor/pkg/supervisor/supervisor.go
  111. +1 −0 components/theia/app/BUILD.yaml
  112. +2 −0 components/theia/app/bin/code
  113. +2 −0 components/theia/app/bin/open
  114. +13 −0 components/theia/app/leeway.Dockerfile
  115. +28 −20 components/theia/static-server/go.mod
  116. +269 −31 components/theia/static-server/go.sum
  117. +28 −21 components/ws-daemon-api/go/go.mod
  118. +0 −11 components/ws-daemon-api/go/go.sum
  119. +33 −26 components/ws-daemon/go.mod
  120. +95 −51 components/ws-daemon/go.sum
  121. +3 −1 components/ws-daemon/pkg/daemon/containerd4214.go
  122. +6 −2 components/ws-daemon/pkg/diskguard/guard.go
  123. +0 −39 components/ws-daemon/pkg/hosts/config.go
  124. +0 −297 components/ws-daemon/pkg/hosts/kubernetes.go
  125. +0 −141 components/ws-daemon/pkg/hosts/proxy.go
  126. +0 −118 components/ws-daemon/pkg/hosts/tcpproxy.go
  127. +1 −0 components/ws-daemon/seccomp-profile-installer/go.mod
  128. +17 −3 components/ws-daemon/seccomp-profile-installer/go.sum
  129. +28 −20 components/ws-manager-api/go/go.mod
  130. +1 −1 components/ws-manager/cmd/debug-headless-log.go
  131. +4 −2 components/ws-manager/cmd/integrationtest-patch-nodes.go
  132. +32 −24 components/ws-manager/go.mod
  133. +96 −43 components/ws-manager/go.sum
  134. +8 −5 components/ws-manager/pkg/manager/annotations.go
  135. +5 −3 components/ws-manager/pkg/manager/annotations_test.go
  136. +1 −1 components/ws-manager/pkg/manager/headless.go
  137. +1 −1 components/ws-manager/pkg/manager/imagespec.go
  138. +9 −2 components/ws-manager/pkg/manager/ingress-allocator.go
  139. +5 −2 components/ws-manager/pkg/manager/integration_test.go
  140. +39 −33 components/ws-manager/pkg/manager/manager.go
  141. +6 −6 components/ws-manager/pkg/manager/manager_ee.go
  142. +5 −2 components/ws-manager/pkg/manager/manager_test.go
  143. +4 −1 components/ws-manager/pkg/manager/metrics.go
  144. +35 −27 components/ws-manager/pkg/manager/monitor.go
  145. +2 −2 components/ws-manager/pkg/manager/monitor_test.go
  146. +8 −7 components/ws-manager/pkg/manager/status.go
  147. +6 −3 components/ws-manager/pkg/test/client.go
  148. +29 −21 components/ws-proxy/go.mod
  149. +269 −34 components/ws-proxy/go.sum
  150. +30 −22 dev/gpctl/go.mod
  151. +285 −47 dev/gpctl/go.sum
  152. +1 −1 dev/gpctl/pkg/util/kubernetes.go
  153. +1 −1 dev/image/Dockerfile
  154. +28 −20 dev/loadgen/go.mod
  155. +30 −24 dev/poolkeeper/go.mod
  156. +191 −39 dev/poolkeeper/go.sum
  157. +6 −4 dev/poolkeeper/pkg/poolkeeper/task-keep-nodes-alive.go
  158. +3 −2 dev/poolkeeper/pkg/poolkeeper/task-patch-affinity.go
  159. +14 −9 docs/self-hosted/install/configure-ingress.md
  160. +1 −1 docs/self-hosted/install/database.md
  161. +1 −1 docs/self-hosted/install/install-on-aws-script.md
  162. +3 −7 docs/self-hosted/install/install-on-gcp-script.md
  163. +37 −20 docs/self-hosted/install/install-on-kubernetes.md
  164. +20 −9 docs/self-hosted/install/troubleshooting.md
  165. +4 −2 gitpod-ws.theia-workspace
  166. +0 −1 install/gcp-terraform/environment/full/main.tf
  167. +7 −0 install/installer/BUILD.yaml
  168. +1 −0 test/.gitignore
  169. +38 −0 test/BUILD.yaml
  170. +18 −0 test/README.md
  171. +82 −0 test/go.mod
  172. +657 −0 test/go.sum
  173. +15 −0 test/leeway-build.sh
  174. +10 −0 test/leeway.Dockerfile
  175. +74 −0 test/pkg/integration/agent.go
  176. +446 −0 test/pkg/integration/apis.go
  177. +541 −0 test/pkg/integration/integration.go
  178. +402 −0 test/pkg/integration/workspace.go
  179. +35 −0 test/tests/examples/db_test.go
  180. +69 −0 test/tests/examples/server_test.go
  181. +27 −0 test/tests/examples/wsmanager_test.go
  182. +13 −0 test/tests/storage/daemon_agent/api/api.go
  183. +66 −0 test/tests/storage/daemon_agent/main.go
  184. +34 −0 test/tests/storage/storage_test.go
  185. +85 −0 test/tests/workspace/content_test.go
  186. +44 −0 test/tests/workspace/example_test.go
  187. +118 −0 test/tests/workspace/tasks_test.go
  188. +28 −0 test/tests/workspace/workspace_agent/api/api.go
  189. +45 −0 test/tests/workspace/workspace_agent/main.go
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ about: Create a report to help us improve

---

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please search existing issues to avoid creating duplicates. -->

### Describe the bug
<!-- A clear and concise description of what the bug is -->

Expand Down
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:gpl-update-docs.6
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:cw-supervisor-execve-ring3.25
workspaceLocation: gitpod/gitpod-ws.theia-workspace
checkoutLocation: gitpod
ports:
Expand Down
35 changes: 27 additions & 8 deletions .werft/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ async function build(context, version) {
* Prepare
*/
werft.phase("prepare");

const werftImg = shell.exec("cat .werft/build.yaml | grep dev-environment").trim().split(": ")[1];
const devImg = shell.exec("yq r .gitpod.yml image").trim();
if (werftImg !== devImg) {
werft.fail('prep', `Werft job image (${werftImg}) and Gitpod dev image (${devImg}) do not match`);
}

let buildConfig = context.Annotations || {};
try {
exec(`gcloud auth activate-service-account --key-file "${GCLOUD_SERVICE_ACCOUNT_PATH}"`);
Expand All @@ -49,6 +56,7 @@ async function build(context, version) {
const dynamicCPULimits = "dynamic-cpu-limits" in buildConfig;
const withInstaller = "with-installer" in buildConfig || masterBuild;
const noPreview = "no-preview" in buildConfig || publishRelease;
const registryFacadeHandover = "registry-facade-handover" in buildConfig;
werft.log("job config", JSON.stringify({
buildConfig,
version,
Expand All @@ -60,6 +68,7 @@ async function build(context, version) {
workspaceFeatureFlags,
dynamicCPULimits,
noPreview,
registryFacadeHandover,
}));

/**
Expand All @@ -71,7 +80,7 @@ async function build(context, version) {
"HTTP_PROXY": "http://dev-http-cache:3129",
"HTTPS_PROXY": "http://dev-http-cache:3129",
};
const imageRepo = publishRelease ? "eu.gcr.io/gitpod-io/self-hosted" : "eu.gcr.io/gitpod-core-dev/build";
const imageRepo = publishRelease ? "gcr.io/gitpod-io/self-hosted" : "eu.gcr.io/gitpod-core-dev/build";

exec(`leeway vet --ignore-warnings`);
exec(`leeway build --werft=true -c ${cacheLevel} ${dontTest ? '--dont-test':''} -Dversion=${version} -DimageRepoBase=eu.gcr.io/gitpod-core-dev/dev dev:all`, buildEnv);
Expand All @@ -83,7 +92,8 @@ async function build(context, version) {
}
exec(`leeway build --werft=true -Dversion=${version} -DremoveSources=false -DimageRepoBase=${imageRepo}`, buildEnv);
if (publishRelease) {
publishHelmChart("eu.gcr.io/gitpod-io/self-hosted");
publishHelmChart("gcr.io/gitpod-io/self-hosted");
exec(`leeway run --werft=true install/installer:publish-as-latest -Dversion=${version} -DimageRepoBase=${imageRepo}`)
exec(`gcloud auth activate-service-account --key-file "${GCLOUD_SERVICE_ACCOUNT_PATH}"`);
}
// gitTag(`build/${version}`);
Expand All @@ -103,15 +113,15 @@ async function build(context, version) {
werft.phase("deploy", "not deploying");
console.log("no-preview or publish-release is set");
} else {
await deployToDev(version, previewWithHttps, workspaceFeatureFlags, dynamicCPULimits);
await deployToDev(version, previewWithHttps, workspaceFeatureFlags, dynamicCPULimits, registryFacadeHandover);
}
}


/**
* Deploy dev
*/
async function deployToDev(version, previewWithHttps, workspaceFeatureFlags, dynamicCPULimits) {
async function deployToDev(version, previewWithHttps, workspaceFeatureFlags, dynamicCPULimits, registryFacadeHandover) {
werft.phase("deploy", "deploying to dev");
const destname = version.split(".")[0];
const namespace = `staging-${destname}`;
Expand Down Expand Up @@ -145,7 +155,7 @@ async function deployToDev(version, previewWithHttps, workspaceFeatureFlags, dyn

werft.log("secret", "copy secret into namespace")
try {
const auth = exec(`echo -n "_json_key:$(kubectl get secret gcp-sa-registry-auth --namespace=keys --export -o yaml \
const auth = exec(`echo -n "_json_key:$(kubectl get secret gcp-sa-registry-auth --namespace=keys -o yaml \
| yq r - data['.dockerconfigjson'] \
| base64 -d)" | base64 -w 0`, {silent: true}).stdout.trim();
fs.writeFileSync("chart/gcp-sa-registry-auth",
Expand All @@ -163,7 +173,7 @@ async function deployToDev(version, previewWithHttps, workspaceFeatureFlags, dyn

werft.log("authProviders", "copy authProviders")
try {
exec(`kubectl get secret preview-envs-authproviders --namespace=keys --export -o yaml \
exec(`kubectl get secret preview-envs-authproviders --namespace=keys -o yaml \
| yq r - data.authProviders \
| base64 -d -w 0 \
> authProviders`, {silent: true}).stdout.trim();
Expand All @@ -186,7 +196,7 @@ async function deployToDev(version, previewWithHttps, workspaceFeatureFlags, dyn
exec(`/usr/local/bin/helm3 delete jaeger-${destname} || echo jaeger-${destname} was not installed yet`, {slice: 'predeploy cleanup'});

let objs = [];
["ws-scheduler", "node-daemon", "cluster", "workspace", "jaeger", "jaeger-agent", "ws-sync", "ws-manager-node", "ws-daemon"].forEach(comp =>
["ws-scheduler", "node-daemon", "cluster", "workspace", "jaeger", "jaeger-agent", "ws-sync", "ws-manager-node", "ws-daemon", "registry-facade"].forEach(comp =>
["ClusterRole", "ClusterRoleBinding", "PodSecurityPolicy"].forEach(kind =>
shell
.exec(`kubectl get ${kind} -l component=${comp} --no-headers -o=custom-columns=:metadata.name | grep ${namespace}-ns`)
Expand Down Expand Up @@ -231,6 +241,11 @@ async function deployToDev(version, previewWithHttps, workspaceFeatureFlags, dyn
if (dynamicCPULimits) {
flags+=` -f ../.werft/values.variant.cpuLimits.yaml`;
}
if (registryFacadeHandover) {
flags+=` --set components.registryFacade.handover.enabled=true`;
flags+=` --set components.registryFacade.handover.socket=/var/lib/gitpod/registry-facade-${namespace}`;
}

// const pathToVersions = `${shell.pwd().toString()}/versions.yaml`;
// if (fs.existsSync(pathToVersions)) {
// flags+=` -f ${pathToVersions}`;
Expand Down Expand Up @@ -303,7 +318,11 @@ async function issueAndInstallCertficate(namespace, domain) {

werft.log('certificate', `copying certificate from "certs/${namespace}" to "${namespace}/proxy-config-certificates"`);
// certmanager is configured to create a secret in the namespace "certs" with the name "${namespace}".
exec(`kubectl get secret ${namespace} --namespace=certs --export -o yaml \
exec(`kubectl get secret ${namespace} --namespace=certs -o yaml \
| yq d - 'metadata.namespace' \
| yq d - 'metadata.uid' \
| yq d - 'metadata.resourceVersion' \
| yq d - 'metadata.creationTimestamp' \
| sed 's/${namespace}/proxy-config-certificates/g' \
| kubectl apply --namespace=${namespace} -f -`);
}
Expand Down
2 changes: 1 addition & 1 deletion .werft/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pod:
- name: MYSQL_TCP_PORT
value: 23306
- name: build
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:as-add-golangci-lint.6
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:cw-supervisor-execve-ring3.25
workingDir: /workspace
imagePullPolicy: Always
volumeMounts:
Expand Down
2 changes: 1 addition & 1 deletion .werft/wipe-devstaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pod:
secretName: gcp-sa-gitpod-dev-deployer
containers:
- name: wipe-devstaging
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:as-add-golangci-lint.6
image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:cw-supervisor-execve-ring3.25
workingDir: /workspace
imagePullPolicy: Always
volumeMounts:
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ The issue tracker is used for tracking **bug reports** and **feature requests**

You can upvote [popular feature requests](https://github.com/gitpod-io/gitpod/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc) or [create a new one](https://github.com/gitpod-io/gitpod/issues/new?template=feature_request.md).

## Development Process

We work with quarterly roadmaps in monthly iterations.

- [Development Process](https://www.notion.so/gitpod/Development-Process-2b105f72847440ec8f4a1d87ac25801b)
- [Product Roadmap](https://www.notion.so/gitpod/Product-Roadmap-b9b5eac0a15147ac8d2dd25cf0519203)
- [Architectural Roadmap](https://www.notion.so/gitpod/Architecture-Roadmap-4669b58fc9cc45488a0a094d2a596886)

## Related Projects

During the development of Gitpod we also developed some our own infrastructure tooling to make development easier and more efficient.
Expand Down
4 changes: 2 additions & 2 deletions chart/config/proxy/vhost.server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ server {
# - (webview-|browser-)?+ foreign content prefix including UUID (optional). This must be possesive (?+) to not confuse "webview-8000-a1231-..." with a valid UUID
# - (?<wsid>[a-z][0-9a-z\-]+) workspace Id or blobserve
# - \.ws(-[a-z0-9]+)? workspace base domain
server_name ~^(webview-|browser-)?+(?<wsid>[a-z][0-9a-z\-]+)\.ws(-[a-z0-9]+)?\.${PROXY_DOMAIN_REGEX}$;
server_name ~^(webview-|browser-)?+(?<wsid>[a-z0-9][0-9a-z\-]+)\.ws(-[a-z0-9]+)?\.${PROXY_DOMAIN_REGEX}$;

{{- if $useHttps }}
{{- if eq .Values.ingressMode "pathAndHost" }}
Expand All @@ -133,7 +133,7 @@ server {
# - (?<wsid>[a-z][0-9a-z\-]+) workspace Id
# - \.ws(-[a-z0-9]+)? workspace base domain
# "" needed because of {} (nginx syntax wart)
server_name "~^(webview-|browser-)?+(?<port>[0-9]{2,5})-(?<wsid>[a-z][0-9a-z\-]+)\.ws(-[a-z0-9]+)?\.${PROXY_DOMAIN_REGEX}$";
server_name "~^(webview-|browser-)?+(?<port>[0-9]{2,5})-(?<wsid>[a-z0-9][0-9a-z\-]+)\.ws(-[a-z0-9]+)?\.${PROXY_DOMAIN_REGEX}$";

{{- if $useHttps }}
{{- if eq .Values.ingressMode "pathAndHost" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ spec:
- 'secret'
- 'emptyDir'
- 'persistentVolumeClaim'
hostNetwork: false
- 'hostPath'
hostNetwork: true
hostIPC: false
hostPID: false
hostPorts:
Expand Down
20 changes: 20 additions & 0 deletions chart/templates/registry-facade-clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) 2020 Gitpod GmbH. All rights reserved.
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.

{{ if .Values.installPodSecurityPolicies -}}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: {{ .Release.Namespace }}-ns-registry-facade
labels:
app: {{ template "gitpod.fullname" . }}
component: cluster
kind: clusterrole
stage: {{ .Values.installation.stage }}
rules:
- apiGroups: ["policy"]
resources: ["podsecuritypolicies"]
verbs: ["use"]
resourceNames:
- {{ .Release.Namespace }}-ns-registry-facade
{{- end -}}
10 changes: 9 additions & 1 deletion chart/templates/registry-facade-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ data:
{
{{ if .Values.components.workspace.pullSecret.secretName -}}"dockerAuth": "/mnt/pull-secret.json",{{- end }}
"registry": {
{{- if $comp.handover.enabled }}
"port": {{ $comp.ports.registry.servicePort }},
{{- else }}
"port": {{ $comp.ports.registry.containerPort }},
{{- end }}
{{- if (or .Values.certificatesSecret.secretName $comp.certificatesSecret.secretName) }}
{{- if (or .Values.certificatesSecret.certManager $comp.certificatesSecret.certManager) }}
"tls": {
Expand Down Expand Up @@ -45,7 +49,11 @@ data:
"ref": "{{ template "gitpod.comp.imageFull" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.dockerUp) }}",
"type": "image"
}
]
],
"handover": {
"enabled": {{ $comp.handover.enabled }},
"sockets": "/mnt/handover"
}
},
"pprofAddr": ":6060",
"prometheusAddr": ":9500"
Expand Down
37 changes: 35 additions & 2 deletions chart/templates/registry-facade-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ spec:
spec:
{{ include "gitpod.workspaceAffinity" $this | indent 6 }}
serviceAccountName: registry-facade
{{- if $comp.handover.enabled }}
initContainers:
- name: handover-ownership
image: {{ template "gitpod.comp.imageFull" $this }}
command:
- "/bin/sh"
- "-c"
- "chown -R 1000:1000 /mnt/handover"
volumeMounts:
- name: handover
mountPath: "/mnt/handover"
securityContext:
privileged: false
runAsUser: 0
{{- end }}
{{- if $comp.handover.enabled }}
hostNetwork: true
{{- end }}
containers:
- name: registry-facade
image: {{ template "gitpod.comp.imageFull" $this }}
Expand All @@ -46,21 +64,30 @@ spec:
{{ include "gitpod.container.resources" $this | indent 8 }}
ports:
- name: registry
{{- if $comp.handover.enabled }}
# if hostNetwork == true then containerPort == hostPort
containerPort: {{ $comp.ports.registry.servicePort }}
{{- else }}
containerPort: {{ $comp.ports.registry.containerPort }}
hostPort: {{ $comp.ports.registry.servicePort }}
- name: metrics
containerPort: 9500
{{- end }}
securityContext:
privileged: false
runAsUser: 1000
{{ include "gitpod.container.defaultEnv" $this | indent 8 }}
{{ include "gitpod.container.tracingEnv" $this | indent 8 }}
volumeMounts:
- name: cache
mountPath: "/mnt/cache"
- name: config
mountPath: "/mnt/config"
readOnly: true
- name: cache
mountPath: "/mnt/cache"
{{- if $comp.handover.enabled }}
- name: handover
mountPath: "/mnt/handover"
{{- end }}
{{- if .Values.components.workspace.pullSecret.secretName }}
- name: pull-secret
mountPath: /mnt/pull-secret.json
Expand All @@ -76,6 +103,12 @@ spec:
- name: config
configMap:
name: {{ template "gitpod.comp.configMap" $this }}
{{- if $comp.handover.enabled }}
- name: handover
hostPath:
path: {{ $comp.handover.socket | quote }}
type: DirectoryOrCreate
{{- end }}
{{- if .Values.components.workspace.pullSecret.secretName }}
- name: pull-secret
secret:
Expand Down
65 changes: 65 additions & 0 deletions chart/templates/registry-facade-podsecuritypolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright (c) 2020 Gitpod GmbH. All rights reserved.
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.

{{ if .Values.installPodSecurityPolicies -}}
# Taken from the examples here:
# Examples: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#example-policies
# File: https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/policy/restricted-psp.yaml
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ .Release.Namespace }}-ns-registry-facade
labels:
app: {{ template "gitpod.fullname" . }}
component: cluster
kind: podsecuritypolicy
stage: {{ .Values.installation.stage }}
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'runtime/default'
apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default'
seccomp.security.alpha.kubernetes.io/defaultProfileName: 'runtime/default'
apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default'
spec:
#####
# The nginx master process (currently?) runs as root, thus we have to turn some safe things off
#####
### TODO root proxy
# privileged: false
# # Required to prevent escalations to root.
# allowPrivilegeEscalation: false
# # This is redundant with non-root + disallow privilege escalation,
# # but we can provide it for defense in depth.
# requiredDropCapabilities:
# - ALL
### TODO root proxy
# Allow core volume types.
volumes:
- 'configMap'
- 'secret'
- 'emptyDir'
- 'hostPath'
hostNetwork: true
hostIPC: false
hostPID: false
hostPorts:
- min: 30000
max: 33000
runAsUser:
rule: 'RunAsAny'
seLinux:
# This policy assumes the nodes are using AppArmor rather than SELinux.
rule: 'RunAsAny'
supplementalGroups:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
fsGroup:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
readOnlyRootFilesystem: false
{{- end -}}
2 changes: 1 addition & 1 deletion chart/templates/registry-facade-rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ subjects:
name: registry-facade
roleRef:
kind: ClusterRole
name: {{ .Release.Namespace }}-ns-psp:restricted-root-user
name: {{ .Release.Namespace }}-ns-registry-facade
apiGroup: rbac.authorization.k8s.io
Loading