Commit 02f37721 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'fix/gb/disable-pages-serverless-proxy' into 'master'

Disable serverless pages domain proxy to kubernetes

See merge request gitlab-org/gitlab!48998
parents 4c606f5c b9b55314
......@@ -32,26 +32,29 @@ module API
requires :host, type: String, desc: 'The host to query for'
end
get "/" do
serverless_domain_finder = ServerlessDomainFinder.new(params[:host])
if serverless_domain_finder.serverless?
# Handle Serverless domains
serverless_domain = serverless_domain_finder.execute
no_content! unless serverless_domain
virtual_domain = Serverless::VirtualDomain.new(serverless_domain)
no_content! unless virtual_domain
present virtual_domain, with: Entities::Internal::Serverless::VirtualDomain
else
# Handle Pages domains
host = Namespace.find_by_pages_host(params[:host]) || PagesDomain.find_by_domain_case_insensitive(params[:host])
no_content! unless host
virtual_domain = host.pages_virtual_domain
no_content! unless virtual_domain
present virtual_domain, with: Entities::Internal::Pages::VirtualDomain
end
##
# Serverless domain proxy has been deprecated and disabled as per
# https://gitlab.com/gitlab-org/gitlab-pages/-/issues/467
#
# serverless_domain_finder = ServerlessDomainFinder.new(params[:host])
# if serverless_domain_finder.serverless?
# # Handle Serverless domains
# serverless_domain = serverless_domain_finder.execute
# no_content! unless serverless_domain
#
# virtual_domain = Serverless::VirtualDomain.new(serverless_domain)
# no_content! unless virtual_domain
#
# present virtual_domain, with: Entities::Internal::Serverless::VirtualDomain
# end
host = Namespace.find_by_pages_host(params[:host]) || PagesDomain.find_by_domain_case_insensitive(params[:host])
no_content! unless host
virtual_domain = host.pages_virtual_domain
no_content! unless virtual_domain
present virtual_domain, with: Entities::Internal::Pages::VirtualDomain
end
end
end
......
......@@ -128,32 +128,38 @@ RSpec.describe API::Internal::Pages do
)
end
it 'responds with proxy configuration' do
it 'responds with 204 because of feature deprecation' do
query_host(serverless_domain.uri.host)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('internal/serverless/virtual_domain')
expect(json_response['certificate']).to eq(pages_domain.certificate)
expect(json_response['key']).to eq(pages_domain.key)
expect(response).to have_gitlab_http_status(:no_content)
expect(response.body).to be_empty
expect(json_response['lookup_paths']).to eq(
[
{
'source' => {
'type' => 'serverless',
'service' => "test-function.#{project.name}-#{project.id}-#{environment.slug}.#{serverless_domain_cluster.knative.hostname}",
'cluster' => {
'hostname' => serverless_domain_cluster.knative.hostname,
'address' => serverless_domain_cluster.knative.external_ip,
'port' => 443,
'cert' => serverless_domain_cluster.certificate,
'key' => serverless_domain_cluster.key
}
}
}
]
)
##
# Serverless serving and reverse proxy to Kubernetes / Knative has
# been deprecated and disabled, as per
# https://gitlab.com/gitlab-org/gitlab-pages/-/issues/467
#
# expect(response).to match_response_schema('internal/serverless/virtual_domain')
# expect(json_response['certificate']).to eq(pages_domain.certificate)
# expect(json_response['key']).to eq(pages_domain.key)
#
# expect(json_response['lookup_paths']).to eq(
# [
# {
# 'source' => {
# 'type' => 'serverless',
# 'service' => "test-function.#{project.name}-#{project.id}-#{environment.slug}.#{serverless_domain_cluster.knative.hostname}",
# 'cluster' => {
# 'hostname' => serverless_domain_cluster.knative.hostname,
# 'address' => serverless_domain_cluster.knative.external_ip,
# 'port' => 443,
# 'cert' => serverless_domain_cluster.certificate,
# 'key' => serverless_domain_cluster.key
# }
# }
# }
# ]
# )
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment