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,26 +32,29 @@ module API ...@@ -32,26 +32,29 @@ 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?
virtual_domain = Serverless::VirtualDomain.new(serverless_domain) # # Handle Serverless domains
no_content! unless virtual_domain # serverless_domain = serverless_domain_finder.execute
# no_content! unless serverless_domain
present virtual_domain, with: Entities::Internal::Serverless::VirtualDomain #
else # virtual_domain = Serverless::VirtualDomain.new(serverless_domain)
# Handle Pages domains # no_content! unless virtual_domain
host = Namespace.find_by_pages_host(params[:host]) || PagesDomain.find_by_domain_case_insensitive(params[:host]) #
no_content! unless host # present virtual_domain, with: Entities::Internal::Serverless::VirtualDomain
# end
virtual_domain = host.pages_virtual_domain
no_content! unless virtual_domain host = Namespace.find_by_pages_host(params[:host]) || PagesDomain.find_by_domain_case_insensitive(params[:host])
no_content! unless host
present virtual_domain, with: Entities::Internal::Pages::VirtualDomain
end virtual_domain = host.pages_virtual_domain
no_content! unless virtual_domain
present virtual_domain, with: Entities::Internal::Pages::VirtualDomain
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