Skip to content
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

[ws-proxy] Decouple ws-proxy from ws-manager #6462

Merged
merged 8 commits into from
Nov 5, 2021
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
12 changes: 1 addition & 11 deletions chart/templates/ws-proxy-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,12 @@ metadata:
data:
config.json: |-
{
"namespace": {{ .Release.Namespace | quote }},
"ingress": {
"httpAddress": ":{{- $comp.ports.httpProxy.containerPort -}}",
"httpsAddress": ":{{- $comp.ports.httpsProxy.containerPort -}}",
"header": "{{- $comp.hostHeader -}}"
},
"workspaceInfoProviderConfig": {
"wsManagerAddr": "ws-manager:8080",
"reconnectInterval": "3s",
"tls": {
"ca": "/ws-manager-client-tls-certs/ca.crt",
"crt": "/ws-manager-client-tls-certs/tls.crt",
"key": "/ws-manager-client-tls-certs/tls.key"
}
},
"proxy": {
"https": {
"crt": "/mnt/certificates/tls.crt",
Expand All @@ -53,8 +45,6 @@ data:
"workspaceHostSuffixRegex": {{ ($comp.workspaceHostSuffixRegex | default (printf "%s%s" "\\.ws[^\\.]*\\." ($.Values.hostname | replace "." "\\."))) | quote }}
},
"workspacePodConfig": {
"serviceTemplate": "http://ws-{{"{{ .workspaceID }}"}}-theia.{{- .Release.Namespace -}}.svc.cluster.local:{{"{{ .port }}"}}",
"portServiceTemplate": "http://ws-{{"{{ .workspaceID }}"}}-ports.{{- .Release.Namespace -}}.svc.cluster.local:{{"{{ .port }}"}}",
"theiaPort": {{ .Values.components.workspace.ports.http.containerPort }},
"supervisorPort": {{ .Values.components.workspace.ports.http.supervisorPort }},
"supervisorImage": "{{ template "gitpod.comp.imageFull" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.supervisor) }}"
Expand Down
9 changes: 3 additions & 6 deletions chart/templates/ws-proxy-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
periodSeconds: 5
failureThreshold: 10
httpGet:
path: /
path: /readyz
port: 60088
livenessProbe:
initialDelaySeconds: 2
Expand All @@ -75,15 +75,12 @@ spec:
successThreshold: 1
timeoutSeconds: 2
httpGet:
path: /
path: /healthz
port: 60088
volumeMounts:
- name: config
mountPath: "/config"
readOnly: true
- mountPath: /ws-manager-client-tls-certs
name: ws-manager-client-tls-certs
readOnly: true
{{- if $.Values.certificatesSecret.secretName }}
- name: config-certificates
mountPath: "/mnt/certificates"
Expand All @@ -93,4 +90,4 @@ spec:
{{ include "gitpod.container.defaultEnv" $this | indent 8 }}
{{ include "gitpod.container.tracingEnv" $this | indent 8 }}
{{ toYaml .Values.defaults | indent 6 }}
{{ end }}
{{ end }}
21 changes: 21 additions & 0 deletions chart/templates/ws-proxy-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2020 Gitpod GmbH. All rights reserved.
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app: {{ template "gitpod.fullname" . }}
component: ws-proxy
kind: role
stage: {{ .Values.installation.stage }}
name: ws-proxy
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- watch
21 changes: 20 additions & 1 deletion chart/templates/ws-proxy-rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,23 @@ roleRef:
kind: ClusterRole
name: {{ .Release.Namespace }}-ns-psp:unprivileged
apiGroup: rbac.authorization.k8s.io
{{ end }}
---

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: ws-proxy-api
labels:
app: {{ template "gitpod.fullname" . }}
component: ws-proxy
kind: role-binding
stage: {{ .Values.installation.stage }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ws-proxy
subjects:
- kind: ServiceAccount
name: ws-proxy

{{ end }}
16 changes: 16 additions & 0 deletions components/common-go/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ const (
// ContainerIsGoneAnnotation is used as workaround for containerd https://github.com/containerd/containerd/pull/4214
// which might cause workspace container status propagation to fail, which in turn would keep a workspace running indefinitely.
ContainerIsGoneAnnotation = "gitpod.io/containerIsGone"

// WorkspaceURLAnnotation is the annotation on the WS pod which contains the public workspace URL.
WorkspaceURLAnnotation = "gitpod/url"

// OwnerTokenAnnotation contains the owner token of the workspace.
OwnerTokenAnnotation = "gitpod/ownerToken"

// WorkspaceAdmissionAnnotation determines the user admission to a workspace, i.e. if it can be accessed by everyone without token.
WorkspaceAdmissionAnnotation = "gitpod/admission"

// WorkspaceImageSpecAnnotation contains the protobuf serialized image spec in base64 encoding. We need to keep this around post-request
// to provide this information to the registry facade later in the workspace's lifecycle.
WorkspaceImageSpecAnnotation = "gitpod/imageSpec"

// WorkspaceExposedPorts contains the exposed ports in the workspace
WorkspaceExposedPorts = "gitpod/exposedPorts"
)

// WorkspaceSupervisorEndpoint produces the supervisor endpoint of a workspace.
Expand Down
2 changes: 1 addition & 1 deletion components/content-service-api/go/blobs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/content-service-api/go/content.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/content-service-api/go/headless-log.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/content-service-api/go/ideplugin.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/content-service-api/go/initializer.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/content-service-api/go/workspace.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion components/content-service-api/typescript/src/blobs_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));

goog.exportSymbol('proto.contentservice.DeleteRequest', null, global);
goog.exportSymbol('proto.contentservice.DeleteRequest.NameCase', null, global);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));

goog.exportSymbol('proto.contentservice.DeleteUserContentRequest', null, global);
goog.exportSymbol('proto.contentservice.DeleteUserContentResponse', null, global);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));

goog.exportSymbol('proto.contentservice.ListLogsRequest', null, global);
goog.exportSymbol('proto.contentservice.ListLogsResponse', null, global);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));

goog.exportSymbol('proto.ideplugin.PluginDownloadURLRequest', null, global);
goog.exportSymbol('proto.ideplugin.PluginDownloadURLResponse', null, global);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));

goog.exportSymbol('proto.contentservice.CloneTargetMode', null, global);
goog.exportSymbol('proto.contentservice.CompositeInitializer', null, global);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));

goog.exportSymbol('proto.contentservice.DeleteWorkspaceRequest', null, global);
goog.exportSymbol('proto.contentservice.DeleteWorkspaceResponse', null, global);
Expand Down
2 changes: 0 additions & 2 deletions components/gitpod-protocol/go/gitpod-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,6 @@ type WorkspaceInstanceConditions struct {
FirstUserActivity string `json:"firstUserActivity,omitempty"`
NeededImageBuild bool `json:"neededImageBuild,omitempty"`
PullingImages bool `json:"pullingImages,omitempty"`
ServiceExists bool `json:"serviceExists,omitempty"`
Timeout string `json:"timeout,omitempty"`
}

Expand Down Expand Up @@ -1795,7 +1794,6 @@ type GetWorkspaceTimeoutResult struct {
// WorkspaceInstancePort is the WorkspaceInstancePort message type
type WorkspaceInstancePort struct {
Port float64 `json:"port,omitempty"`
TargetPort float64 `json:"targetPort,omitempty"`
URL string `json:"url,omitempty"`
Visibility string `json:"visibility,omitempty"`
}
Expand Down
6 changes: 0 additions & 6 deletions components/gitpod-protocol/src/workspace-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ export interface WorkspaceInstanceConditions {
// PullingImages marks if the workspace is currently pulling its images. This condition can only be set during PhaseCreating
pullingImages?: boolean

// ServiceExists denotes if the workspace theia-/ports- services exist. This condition will be true if either of the two services exist.
serviceExists?: boolean

// deployed marks that a workspace instance was sent/deployed at a workspace manager
deployed?: boolean;

Expand Down Expand Up @@ -164,9 +161,6 @@ export interface WorkspaceInstancePort {
// The outward-facing port number
port: number;

// An optional inward-facing port number. If not present we'll use port.
targetPort?: number;

// The visiblity of this port. Optional for backwards compatibility.
visibility?: PortVisibility;

Expand Down
2 changes: 1 addition & 1 deletion components/gitpod-protocol/src/wsready.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* See License-AGPL.txt in the project root for license information.
*/

// generated using github.com/32leaves/bel on 2021-10-28 22:18:05.015278404 +0000 UTC m=+0.005187484
// generated using github.com/32leaves/bel on 2021-11-04 12:16:53.917570766 +0000 UTC m=+0.006002884
// DO NOT MODIFY

export enum WorkspaceInitSource {
Expand Down
2 changes: 1 addition & 1 deletion components/image-builder-api/go/imgbuilder.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));

var content$service$api_initializer_pb = require('@gitpod/content-service/lib');
goog.object.extend(proto, content$service$api_initializer_pb);
Expand Down
2 changes: 1 addition & 1 deletion components/local-app-api/go/localapp.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/registry-facade-api/go/imagespec.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/registry-facade-api/go/provider.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions components/server/ee/src/graphql/graphql-gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,6 @@ export type WorkspaceInstanceConditions = {
* condition can only be set during PhaseCreating
*/
pullingImages?: Maybe<Scalars['Boolean']>;
/**
* ServiceExists denotes if the workspace theia-/ports- services exist. This
* condition will be true if either of the two services exist.
*/
serviceExists?: Maybe<Scalars['Boolean']>;
/** deployed marks that a workspace instance was sent/deployed at a workspace manager */
deployed?: Maybe<Scalars['Boolean']>;
/** Whether the workspace start triggered an image build */
Expand Down Expand Up @@ -401,7 +396,6 @@ export type WorkspaceInstanceConditionsResolvers<ContextType = Context, ParentTy
failed?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>,
timeout?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>,
pullingImages?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>,
serviceExists?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>,
deployed?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>,
neededImageBuild?: Resolver<Maybe<ResolversTypes['Boolean']>, ParentType, ContextType>,
firstUserActivity?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>,
Expand Down
Loading