Guarantee functions are not lost after Knative update
What does this MR do?
This MR not only renames Cluster::Concerns::ApplicationStatus.installed
to Cluster::Concerns::ApplicationStatus.available
but also include applications with the state udpated
to it, so that functions are properly found for Knative installed and updated apps. Explanation below:
After updating Knative, the app state will be updated
instead of installed
.
In our FunctionsController
we find our functions with the Projects::Serverless::FunctionsFinder
:
def finder
Projects::Serverless::FunctionsFinder.new(project.clusters)
end
This finder will try to find the functions for clusters that are included in the Clusters::Cluster.with_knative_installed
:
def execute
knative_services.flatten.compact
end
def knative_service(environment_scope, name)
clusters_with_knative_installed.preload_knative.map do |cluster|
...
end
def clusters_with_knative_installed
@clusters.with_knative_installed
end
ultimately, with_knative_installed
clusters scope will query clusters that have knative applications that are included in the Clusters::Applications::Knative.installed
scope.
scope :with_knative_installed, -> { joins(:application_knative).merge(Clusters::Applications::Knative.installed) }
This change could also fix our Gitlab::UsageData.system_usage_data
which also makes use of the above scope to count the number of installed Knative apps.
What are the relevant issue numbers?
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process. -
Security reports checked/validated by reviewer