diff --git a/db/migrate/20250910043105_add_workspaces_proxy_options_in_agent_config.rb b/db/migrate/20250910043105_add_workspaces_proxy_options_in_agent_config.rb new file mode 100644 index 0000000000000000000000000000000000000000..47368970ea2dd1ff4ec74aa97f6cb305d8e9887b --- /dev/null +++ b/db/migrate/20250910043105_add_workspaces_proxy_options_in_agent_config.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddWorkspacesProxyOptionsInAgentConfig < Gitlab::Database::Migration[2.3] + milestone '18.4' + + def up + add_column :workspaces_agent_configs, :gitlab_workspaces_proxy_http_enabled, :boolean, + null: false, default: true, if_not_exists: true + add_column :workspaces_agent_configs, :gitlab_workspaces_proxy_ssh_enabled, :boolean, + null: false, default: true, if_not_exists: true + end + + def down + remove_column :workspaces_agent_configs, :gitlab_workspaces_proxy_http_enabled, if_exists: true + remove_column :workspaces_agent_configs, :gitlab_workspaces_proxy_ssh_enabled, if_exists: true + end +end diff --git a/db/schema_migrations/20250910043105 b/db/schema_migrations/20250910043105 new file mode 100644 index 0000000000000000000000000000000000000000..9aaef2d424f8eb6608a96f627261fc8dc23706bf --- /dev/null +++ b/db/schema_migrations/20250910043105 @@ -0,0 +1 @@ +fdc1bfe88367a59efaadf8c2dd66b626531d65bc6c9f9e4fdbf404d7cf9b8ce8 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index a3e79d1ff2643339b98b1d31fe5edcbc6f49fb22..8925c3eaa6dc7fa5398dd217e2ffa0c1e7393a8c 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -27604,6 +27604,8 @@ CREATE TABLE workspaces_agent_configs ( max_active_hours_before_stop smallint DEFAULT 36 NOT NULL, max_stopped_hours_before_termination smallint DEFAULT 744 NOT NULL, shared_namespace text DEFAULT ''::text NOT NULL, + gitlab_workspaces_proxy_http_enabled boolean DEFAULT true NOT NULL, + gitlab_workspaces_proxy_ssh_enabled boolean DEFAULT true NOT NULL, CONSTRAINT check_2de67a7a76 CHECK ((char_length(shared_namespace) <= 63)), CONSTRAINT check_557e75a230 CHECK ((max_stopped_hours_before_termination > 0)), CONSTRAINT check_58759a890a CHECK ((char_length(dns_zone) <= 256)), diff --git a/ee/app/models/remote_development/workspaces_agent_config.rb b/ee/app/models/remote_development/workspaces_agent_config.rb index 522f8bc08a9d5666af2936f990dbc5aa7857088b..908e45dd1dd7df79f4b442c3bb6f01bb6e7de325 100644 --- a/ee/app/models/remote_development/workspaces_agent_config.rb +++ b/ee/app/models/remote_development/workspaces_agent_config.rb @@ -43,6 +43,8 @@ class WorkspacesAgentConfig < ApplicationRecord validates :shared_namespace, 'remote_development/shared_namespace': true validates :annotations, 'remote_development/annotations': true validates :labels, 'remote_development/labels': true + validates :gitlab_workspaces_proxy_http_enabled, inclusion: { in: [true, false] } + validates :gitlab_workspaces_proxy_ssh_enabled, inclusion: { in: [true, false] } validates :image_pull_secrets, json_schema: { diff --git a/ee/lib/remote_development/settings/default_settings.rb b/ee/lib/remote_development/settings/default_settings.rb index b0139eee28afcc1b4e62ed347db0119702b446a1..ba47809a90994a4d0972cb7fe635b3356293b0c6 100644 --- a/ee/lib/remote_development/settings/default_settings.rb +++ b/ee/lib/remote_development/settings/default_settings.rb @@ -26,7 +26,9 @@ def self.default_settings default_runtime_class: ["", String], full_reconciliation_interval_seconds: [3600, Integer], gitlab_kas_external_url: ["", String], + gitlab_workspaces_proxy_http_enabled: [true, :Boolean], gitlab_workspaces_proxy_namespace: ["gitlab-workspaces", String], + gitlab_workspaces_proxy_ssh_enabled: [true, :Boolean], image_pull_secrets: [[], Array], labels: [{}, Hash], max_active_hours_before_stop: [36, Integer], diff --git a/ee/spec/lib/remote_development/settings/settings_initializer_spec.rb b/ee/spec/lib/remote_development/settings/settings_initializer_spec.rb index ca5230f9fec6e36f89959fb321ea69f401a6f5be..161ed2db34df812a4a4b409f5545e9d03372312b 100644 --- a/ee/spec/lib/remote_development/settings/settings_initializer_spec.rb +++ b/ee/spec/lib/remote_development/settings/settings_initializer_spec.rb @@ -35,7 +35,9 @@ :default_runtime_class, :full_reconciliation_interval_seconds, :gitlab_kas_external_url, + :gitlab_workspaces_proxy_http_enabled, :gitlab_workspaces_proxy_namespace, + :gitlab_workspaces_proxy_ssh_enabled, :image_pull_secrets, :labels, :max_active_hours_before_stop, @@ -60,7 +62,9 @@ default_runtime_class: "", full_reconciliation_interval_seconds: 3600, gitlab_kas_external_url: "", + gitlab_workspaces_proxy_http_enabled: true, gitlab_workspaces_proxy_namespace: "gitlab-workspaces", + gitlab_workspaces_proxy_ssh_enabled: true, image_pull_secrets: [], labels: {}, max_active_hours_before_stop: 36, @@ -88,7 +92,9 @@ default_resources_per_workspace_container: Hash, default_runtime_class: String, full_reconciliation_interval_seconds: Integer, + gitlab_workspaces_proxy_http_enabled: :Boolean, gitlab_kas_external_url: String, + gitlab_workspaces_proxy_ssh_enabled: :Boolean, gitlab_workspaces_proxy_namespace: String, image_pull_secrets: Array, labels: Hash, diff --git a/ee/spec/models/remote_development/workspaces_agent_config_spec.rb b/ee/spec/models/remote_development/workspaces_agent_config_spec.rb index 9119ed818ef54cfe4ea158af151520ea2a2d169c..e1e77b4a5bc6920b34b452cfb009f9d5a8ca4888 100644 --- a/ee/spec/models/remote_development/workspaces_agent_config_spec.rb +++ b/ee/spec/models/remote_development/workspaces_agent_config_spec.rb @@ -35,7 +35,9 @@ annotations default_resources_per_workspace_container default_runtime_class + gitlab_workspaces_proxy_http_enabled gitlab_workspaces_proxy_namespace + gitlab_workspaces_proxy_ssh_enabled labels max_active_hours_before_stop max_resources_per_workspace @@ -337,7 +339,9 @@ default_runtime_class dns_zone enabled + gitlab_workspaces_proxy_http_enabled gitlab_workspaces_proxy_namespace + gitlab_workspaces_proxy_ssh_enabled id image_pull_secrets labels