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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-31 00:09:38 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-31 00:09:38 +0300
commitdd8c199e989482245c58ee49b5f7169bdd9073eb (patch)
treef70b1255763d003e855f9ea3dd73a6c14e2010ff /app/models/clusters
parentcd99e8611a6df11975c227517892606440ad3ff6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/clusters')
-rw-r--r--app/models/clusters/applications/cert_manager.rb129
-rw-r--r--app/models/clusters/cluster.rb2
2 files changed, 0 insertions, 131 deletions
diff --git a/app/models/clusters/applications/cert_manager.rb b/app/models/clusters/applications/cert_manager.rb
deleted file mode 100644
index 11f84940c38..00000000000
--- a/app/models/clusters/applications/cert_manager.rb
+++ /dev/null
@@ -1,129 +0,0 @@
-# frozen_string_literal: true
-
-module Clusters
- module Applications
- # DEPRECATED for removal in %14.0
- # See https://gitlab.com/groups/gitlab-org/-/epics/4280
- class CertManager < ApplicationRecord
- VERSION = 'v0.10.1'
- CRD_VERSION = '0.10'
-
- self.table_name = 'clusters_applications_cert_managers'
-
- include ::Clusters::Concerns::ApplicationCore
- include ::Clusters::Concerns::ApplicationStatus
- include ::Clusters::Concerns::ApplicationVersion
- include ::Clusters::Concerns::ApplicationData
-
- attribute :version, default: VERSION
- after_initialize :set_default_email, if: :new_record?
-
- validates :email, presence: true
-
- def chart
- 'certmanager/cert-manager'
- end
-
- def repository
- 'https://charts.jetstack.io'
- end
-
- def install_command
- helm_command_module::InstallCommand.new(
- name: 'certmanager',
- repository: repository,
- version: VERSION,
- rbac: cluster.platform_kubernetes_rbac?,
- chart: chart,
- files: files.merge(cluster_issuer_file),
- preinstall: pre_install_script,
- postinstall: post_install_script
- )
- end
-
- def uninstall_command
- helm_command_module::DeleteCommand.new(
- name: 'certmanager',
- rbac: cluster.platform_kubernetes_rbac?,
- files: files,
- postdelete: post_delete_script
- )
- end
-
- private
-
- def set_default_email
- self.email ||= self.cluster&.user&.email
- end
-
- def pre_install_script
- [
- apply_file("https://raw.githubusercontent.com/jetstack/cert-manager/release-#{CRD_VERSION}/deploy/manifests/00-crds.yaml"),
- "kubectl label --overwrite namespace #{Gitlab::Kubernetes::Helm::NAMESPACE} certmanager.k8s.io/disable-validation=true"
- ]
- end
-
- def post_install_script
- [retry_command(apply_file('/data/helm/certmanager/config/cluster_issuer.yaml'))]
- end
-
- def retry_command(command)
- Gitlab::Kubernetes::PodCmd.retry_command(command, times: 90)
- end
-
- def post_delete_script
- [
- delete_private_key,
- delete_crd('certificates.certmanager.k8s.io'),
- delete_crd('certificaterequests.certmanager.k8s.io'),
- delete_crd('challenges.certmanager.k8s.io'),
- delete_crd('clusterissuers.certmanager.k8s.io'),
- delete_crd('issuers.certmanager.k8s.io'),
- delete_crd('orders.certmanager.k8s.io')
- ].compact
- end
-
- def private_key_name
- @private_key_name ||= cluster_issuer_content.dig('spec', 'acme', 'privateKeySecretRef', 'name')
- end
-
- def delete_private_key
- return unless private_key_name.present?
-
- args = %W(secret -n #{Gitlab::Kubernetes::Helm::NAMESPACE} #{private_key_name} --ignore-not-found)
-
- Gitlab::Kubernetes::KubectlCmd.delete(*args)
- end
-
- def delete_crd(definition)
- Gitlab::Kubernetes::KubectlCmd.delete("crd", definition, "--ignore-not-found")
- end
-
- def apply_file(filename)
- Gitlab::Kubernetes::KubectlCmd.apply_file(filename)
- end
-
- def cluster_issuer_file
- {
- 'cluster_issuer.yaml': cluster_issuer_yaml_content
- }
- end
-
- def cluster_issuer_yaml_content
- YAML.dump(cluster_issuer_content.deep_merge(cluster_issue_overlay))
- end
-
- def cluster_issuer_content
- YAML.safe_load(File.read(cluster_issuer_file_path))
- end
-
- def cluster_issue_overlay
- { "spec" => { "acme" => { "email" => self.email } } }
- end
-
- def cluster_issuer_file_path
- Rails.root.join('vendor', 'cert_manager', 'cluster_issuer.yaml')
- end
- end
- end
-end
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb
index 55dbaf9c6b7..a35ea6ddb46 100644
--- a/app/models/clusters/cluster.rb
+++ b/app/models/clusters/cluster.rb
@@ -14,7 +14,6 @@ module Clusters
APPLICATIONS = {
Clusters::Applications::Helm.application_name => Clusters::Applications::Helm,
Clusters::Applications::Ingress.application_name => Clusters::Applications::Ingress,
- Clusters::Applications::CertManager.application_name => Clusters::Applications::CertManager,
Clusters::Applications::Crossplane.application_name => Clusters::Applications::Crossplane,
Clusters::Applications::Prometheus.application_name => Clusters::Applications::Prometheus,
Clusters::Applications::Runner.application_name => Clusters::Applications::Runner,
@@ -57,7 +56,6 @@ module Clusters
has_one_cluster_application :helm
has_one_cluster_application :ingress
- has_one_cluster_application :cert_manager
has_one_cluster_application :crossplane
has_one_cluster_application :prometheus
has_one_cluster_application :runner