Commit b9b55314 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Disable serverless pages domain proxy to kubernetes

Serverless serving has been deprecated and disabled as per
https://gitlab.com/gitlab-org/gitlab-pages/-/issues/467.
parent 5704c69e
...@@ -32,18 +32,22 @@ module API ...@@ -32,18 +32,22 @@ module API
requires :host, type: String, desc: 'The host to query for' requires :host, type: String, desc: 'The host to query for'
end end
get "/" do get "/" do
serverless_domain_finder = ServerlessDomainFinder.new(params[:host]) ##
if serverless_domain_finder.serverless? # Serverless domain proxy has been deprecated and disabled as per
# Handle Serverless domains # https://gitlab.com/gitlab-org/gitlab-pages/-/issues/467
serverless_domain = serverless_domain_finder.execute #
no_content! unless serverless_domain # 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
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]) host = Namespace.find_by_pages_host(params[:host]) || PagesDomain.find_by_domain_case_insensitive(params[:host])
no_content! unless host no_content! unless host
...@@ -56,5 +60,4 @@ module API ...@@ -56,5 +60,4 @@ module API
end end
end end
end end
end
end end
...@@ -128,32 +128,38 @@ RSpec.describe API::Internal::Pages do ...@@ -128,32 +128,38 @@ RSpec.describe API::Internal::Pages do
) )
end end
it 'responds with proxy configuration' do it 'responds with 204 because of feature deprecation' do
query_host(serverless_domain.uri.host) query_host(serverless_domain.uri.host)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:no_content)
expect(response).to match_response_schema('internal/serverless/virtual_domain') expect(response.body).to be_empty
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( ##
[ # Serverless serving and reverse proxy to Kubernetes / Knative has
{ # been deprecated and disabled, as per
'source' => { # https://gitlab.com/gitlab-org/gitlab-pages/-/issues/467
'type' => 'serverless', #
'service' => "test-function.#{project.name}-#{project.id}-#{environment.slug}.#{serverless_domain_cluster.knative.hostname}", # expect(response).to match_response_schema('internal/serverless/virtual_domain')
'cluster' => { # expect(json_response['certificate']).to eq(pages_domain.certificate)
'hostname' => serverless_domain_cluster.knative.hostname, # expect(json_response['key']).to eq(pages_domain.key)
'address' => serverless_domain_cluster.knative.external_ip, #
'port' => 443, # expect(json_response['lookup_paths']).to eq(
'cert' => serverless_domain_cluster.certificate, # [
'key' => serverless_domain_cluster.key # {
} # '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 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