Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-06-21 09:13:59 +0300
committerThong Kuah <tkuah@gitlab.com>2019-06-21 09:13:59 +0300
commit18344feb74c521ae887f8ceae0215c260a508c87 (patch)
treea59fb83d8f676abe4239f438a51c42fda177c709
parentc92a1e537e006f506354b018e64db3df2ee4180c (diff)
parentd5a0ee924a6c85c75d5394567de41ed1425926f4 (diff)
Merge branch 'remove-kubernetes-service-deployment-platform' into 'master'
Remove Kubernetes service from deployment platform See merge request gitlab-org/gitlab-ce!29786
-rw-r--r--app/models/concerns/deployment_platform.rb39
-rw-r--r--app/models/project_services/kubernetes_service.rb9
-rw-r--r--changelogs/unreleased/remove-kubernetes-service-deployment-platform.yml5
-rw-r--r--locale/gitlab.pot7
-rw-r--r--spec/models/concerns/deployment_platform_spec.rb53
-rw-r--r--spec/models/project_services/kubernetes_service_spec.rb8
6 files changed, 15 insertions, 106 deletions
diff --git a/app/models/concerns/deployment_platform.rb b/app/models/concerns/deployment_platform.rb
index 9ac0d612db3..1bd8a799f0d 100644
--- a/app/models/concerns/deployment_platform.rb
+++ b/app/models/concerns/deployment_platform.rb
@@ -14,9 +14,7 @@ module DeploymentPlatform
def find_deployment_platform(environment)
find_cluster_platform_kubernetes(environment: environment) ||
find_group_cluster_platform_kubernetes_with_feature_guard(environment: environment) ||
- find_instance_cluster_platform_kubernetes_with_feature_guard(environment: environment) ||
- find_kubernetes_service_integration ||
- build_cluster_and_deployment_platform
+ find_instance_cluster_platform_kubernetes_with_feature_guard(environment: environment)
end
# EE would override this and utilize environment argument
@@ -48,39 +46,4 @@ module DeploymentPlatform
Clusters::Instance.new.clusters.enabled.default_environment
.first&.platform_kubernetes
end
-
- def find_kubernetes_service_integration
- services.deployment.reorder(nil).find_by(active: true)
- end
-
- def build_cluster_and_deployment_platform
- return unless kubernetes_service_template
-
- cluster = ::Clusters::Cluster.create(cluster_attributes_from_service_template)
- cluster.platform_kubernetes if cluster.persisted?
- end
-
- def kubernetes_service_template
- @kubernetes_service_template ||= KubernetesService.active.find_by_template
- end
-
- def cluster_attributes_from_service_template
- {
- name: 'kubernetes-template',
- projects: [self],
- cluster_type: :project_type,
- provider_type: :user,
- platform_type: :kubernetes,
- platform_kubernetes_attributes: platform_kubernetes_attributes_from_service_template
- }
- end
-
- def platform_kubernetes_attributes_from_service_template
- {
- api_url: kubernetes_service_template.api_url,
- ca_pem: kubernetes_service_template.ca_pem,
- token: kubernetes_service_template.token,
- namespace: kubernetes_service_template.namespace
- }
- end
end
diff --git a/app/models/project_services/kubernetes_service.rb b/app/models/project_services/kubernetes_service.rb
index edf7e886e77..27b7827d55e 100644
--- a/app/models/project_services/kubernetes_service.rb
+++ b/app/models/project_services/kubernetes_service.rb
@@ -170,12 +170,11 @@ class KubernetesService < Service
def deprecation_message
content = if project
- _("Kubernetes service integration has been deprecated. %{deprecated_message_content} your Kubernetes clusters using the new <a href=\"%{url}\"/>Kubernetes Clusters</a> page") % {
- deprecated_message_content: deprecated_message_content,
+ _("Kubernetes service integration has been disabled. Fields on this page are not used by GitLab, you can configure your Kubernetes clusters using the new <a href=\"%{url}\"/>Kubernetes Clusters</a> page") % {
url: Gitlab::Routing.url_helpers.project_clusters_path(project)
}
else
- _("The instance-level Kubernetes service integration is deprecated. Your data has been migrated to an <a href=\"%{url}\"/>instance-level cluster</a>.") % {
+ _("The instance-level Kubernetes service integration is disabled. Your data has been migrated to an <a href=\"%{url}\"/>instance-level cluster</a>.") % {
url: Gitlab::Routing.url_helpers.admin_clusters_path
}
end
@@ -260,8 +259,4 @@ class KubernetesService < Service
errors[:base] << deprecation_message
end
end
-
- def deprecated_message_content
- _("Fields on this page are now uneditable, you can configure")
- end
end
diff --git a/changelogs/unreleased/remove-kubernetes-service-deployment-platform.yml b/changelogs/unreleased/remove-kubernetes-service-deployment-platform.yml
new file mode 100644
index 00000000000..17421fca234
--- /dev/null
+++ b/changelogs/unreleased/remove-kubernetes-service-deployment-platform.yml
@@ -0,0 +1,5 @@
+---
+title: Remove Kubernetes service integration and Kubernetes service template from available deployment platforms
+merge_request: 29786
+author:
+type: removed
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index e89b1e754f2..8f010b2184c 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -4408,9 +4408,6 @@ msgstr ""
msgid "February"
msgstr ""
-msgid "Fields on this page are now uneditable, you can configure"
-msgstr ""
-
msgid "File"
msgid_plural "Files"
msgstr[0] ""
@@ -5645,7 +5642,7 @@ msgstr ""
msgid "Kubernetes error: %{error_code}"
msgstr ""
-msgid "Kubernetes service integration has been deprecated. %{deprecated_message_content} your Kubernetes clusters using the new <a href=\"%{url}\"/>Kubernetes Clusters</a> page"
+msgid "Kubernetes service integration has been disabled. Fields on this page are not used by GitLab, you can configure your Kubernetes clusters using the new <a href=\"%{url}\"/>Kubernetes Clusters</a> page"
msgstr ""
msgid "LFS"
@@ -10002,7 +9999,7 @@ msgstr ""
msgid "The import will time out after %{timeout}. For repositories that take longer, use a clone/push combination."
msgstr ""
-msgid "The instance-level Kubernetes service integration is deprecated. Your data has been migrated to an <a href=\"%{url}\"/>instance-level cluster</a>."
+msgid "The instance-level Kubernetes service integration is disabled. Your data has been migrated to an <a href=\"%{url}\"/>instance-level cluster</a>."
msgstr ""
msgid "The invitation could not be accepted."
diff --git a/spec/models/concerns/deployment_platform_spec.rb b/spec/models/concerns/deployment_platform_spec.rb
index 0e34d8fccf3..96465a51db2 100644
--- a/spec/models/concerns/deployment_platform_spec.rb
+++ b/spec/models/concerns/deployment_platform_spec.rb
@@ -8,40 +8,7 @@ describe DeploymentPlatform do
describe '#deployment_platform' do
subject { project.deployment_platform }
- context 'with no Kubernetes configuration on CI/CD, no Kubernetes Service and a Kubernetes template configured' do
- let!(:kubernetes_service) { create(:kubernetes_service, template: true) }
-
- it 'returns a platform kubernetes' do
- expect(subject).to be_a_kind_of(Clusters::Platforms::Kubernetes)
- end
-
- it 'creates a cluster and a platform kubernetes' do
- expect { subject }
- .to change { Clusters::Cluster.count }.by(1)
- .and change { Clusters::Platforms::Kubernetes.count }.by(1)
- end
-
- it 'includes appropriate attributes for Cluster' do
- cluster = subject.cluster
- expect(cluster.name).to eq('kubernetes-template')
- expect(cluster.project).to eq(project)
- expect(cluster.provider_type).to eq('user')
- expect(cluster.platform_type).to eq('kubernetes')
- end
-
- it 'creates a platform kubernetes' do
- expect { subject }.to change { Clusters::Platforms::Kubernetes.count }.by(1)
- end
-
- it 'copies attributes from Clusters::Platform::Kubernetes template into the new Cluster::Platforms::Kubernetes' do
- expect(subject.api_url).to eq(kubernetes_service.api_url)
- expect(subject.ca_pem).to eq(kubernetes_service.ca_pem)
- expect(subject.token).to eq(kubernetes_service.token)
- expect(subject.namespace).to eq(kubernetes_service.namespace)
- end
- end
-
- context 'with no Kubernetes configuration on CI/CD, no Kubernetes Service and no Kubernetes template configured' do
+ context 'with no Kubernetes configuration on CI/CD, no Kubernetes Service' do
it { is_expected.to be_nil }
end
@@ -126,23 +93,5 @@ describe DeploymentPlatform do
end
end
end
-
- context 'when user configured kubernetes integration from project services' do
- let!(:kubernetes_service) { create(:kubernetes_service, project: project) }
-
- it 'returns the Kubernetes service' do
- expect(subject).to eq(kubernetes_service)
- end
- end
-
- context 'when the cluster creation fails' do
- let!(:kubernetes_service) { create(:kubernetes_service, template: true) }
-
- before do
- allow_any_instance_of(Clusters::Cluster).to receive(:persisted?).and_return(false)
- end
-
- it { is_expected.to be_nil }
- end
end
end
diff --git a/spec/models/project_services/kubernetes_service_spec.rb b/spec/models/project_services/kubernetes_service_spec.rb
index 34ee1eafd5c..5d7d6c34e67 100644
--- a/spec/models/project_services/kubernetes_service_spec.rb
+++ b/spec/models/project_services/kubernetes_service_spec.rb
@@ -7,7 +7,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
include ReactiveCachingHelpers
let(:project) { create(:kubernetes_project) }
- let(:service) { project.deployment_platform }
+ let(:service) { create(:kubernetes_service, project: project) }
describe 'Associations' do
it { is_expected.to belong_to :project }
@@ -78,7 +78,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
it 'includes an error with a deprecation message' do
kubernetes_service.valid?
- expect(kubernetes_service.errors[:base].first).to match(/Kubernetes service integration has been deprecated/)
+ expect(kubernetes_service.errors[:base].first).to match(/Kubernetes service integration has been disabled/)
end
end
@@ -383,13 +383,13 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
let(:kubernetes_service) { create(:kubernetes_service) }
it 'indicates the service is deprecated' do
- expect(kubernetes_service.deprecation_message).to match(/Kubernetes service integration has been deprecated/)
+ expect(kubernetes_service.deprecation_message).to match(/Kubernetes service integration has been disabled/)
end
context 'if the service is not active' do
it 'returns a message' do
kubernetes_service.update_attribute(:active, false)
- expect(kubernetes_service.deprecation_message).to match(/Fields on this page are now uneditable/)
+ expect(kubernetes_service.deprecation_message).to match(/Fields on this page are not used by GitLab/)
end
end
end