Commit 1d07b548 authored by Reuben Pereira's avatar Reuben Pereira Committed by Thong Kuah

Remove the pod_logs_reactive_cache feature flag

Now that the frontend polls the pod logs API, we can enable reactive
caching for the API, which was behind the feature flag.
parent 7009eca0
---
title: Fix pod logs failure when pod contains more than 1 container
merge_request: 18574
author:
type: fixed
......@@ -27,7 +27,6 @@ module EE
end
def read_pod_logs(pod_name, namespace, container: nil)
if ::Feature.enabled?(:pod_logs_reactive_cache)
with_reactive_cache(
'get_pod_log',
'pod_name' => pod_name,
......@@ -36,9 +35,6 @@ module EE
) do |result|
result
end
else
pod_logs(pod_name, namespace, container: container)
end
end
def calculate_reactive_cache(request, opts)
......@@ -59,14 +55,12 @@ module EE
private
def pod_logs(pod_name, namespace, container: nil)
handle_exceptions(_('Pod not found')) do
logs = kubeclient.get_pod_log(
pod_name, namespace, container: container, tail_lines: LOGS_LIMIT
).body
{ logs: logs, status: :success }
end
end
def handle_exceptions(resource_not_found_error_message, &block)
yield
......
......@@ -16,21 +16,18 @@ describe 'Environment > Pod Logs', :js do
before do
stub_licensed_features(pod_logs: true)
# We're setting this feature flag to false since the FE does not support it
# as yet.
stub_feature_flags(pod_logs_reactive_cache: false)
create(:cluster, :provided_by_gcp, environment_scope: '*', projects: [project])
create(:deployment, :success, environment: environment)
stub_kubeclient_logs(pod_name, environment.deployment_namespace, container: nil)
stub_kubeclient_pod_details(pod_name, environment.deployment_namespace)
stub_kubeclient_logs(pod_name, environment.deployment_namespace, container: 'container-0')
allow_any_instance_of(EE::Environment).to receive(:pod_names).and_return(pod_names)
sign_in(project.owner)
end
context 'with logs' do
context 'with logs', :use_clean_rails_memory_store_caching do
it "shows pod logs" do
visit logs_project_environment_path(environment.project, environment, pod_name: pod_name)
......
......@@ -150,7 +150,11 @@ describe Clusters::Platforms::Kubernetes do
end
end
shared_examples 'k8s responses' do
context 'with reactive cache' do
before do
synchronous_reactive_cache(service)
end
context 'when kubernetes responds with valid logs' do
before do
stub_kubeclient_logs(pod_name, namespace, container: container)
......@@ -201,34 +205,6 @@ describe Clusters::Platforms::Kubernetes do
it_behaves_like 'resource not found error', 'Pod not found'
end
end
context 'without pod_logs_reactive_cache feature flag' do
before do
stub_feature_flags(pod_logs_reactive_cache: false)
end
it_behaves_like 'k8s responses'
context 'when container name is not specified' do
subject { service.read_pod_logs(pod_name, namespace) }
before do
stub_kubeclient_logs(pod_name, namespace, container: nil)
end
include_examples 'successful log request'
end
end
context 'with pod_logs_reactive_cache feature flag' do
before do
stub_feature_flags(pod_logs_reactive_cache: true)
synchronous_reactive_cache(service)
end
it_behaves_like 'k8s responses'
context 'when container name is not specified' do
subject { service.read_pod_logs(pod_name, namespace) }
......@@ -247,10 +223,6 @@ describe Clusters::Platforms::Kubernetes do
['get_pod_log', { 'pod_name' => pod_name, 'namespace' => namespace, 'container' => container }]
end
before do
stub_feature_flags(pod_logs_reactive_cache: true)
end
context 'result is cacheable' do
before do
stub_kubeclient_logs(pod_name, namespace, container: container)
......
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