uffizzi_core 2.2.23 → 2.2.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/uffizzi_core/api/cli/v1/projects/clusters_controller.rb +18 -1
- data/app/lib/uffizzi_core/concerns/models/cluster.rb +1 -0
- data/app/lib/uffizzi_core/concerns/models/kubernetes_distribution.rb +15 -0
- data/app/models/uffizzi_core/kubernetes_distribution.rb +5 -0
- data/app/serializers/uffizzi_core/api/cli/v1/projects/cluster_serializer.rb +5 -1
- data/app/serializers/uffizzi_core/api/cli/v1/projects/short_cluster_serializer.rb +7 -0
- data/app/serializers/uffizzi_core/controller/create_cluster/cluster_serializer.rb +15 -1
- data/config/locales/en.yml +3 -0
- data/db/migrate/20231009162719_create_uffizzi_core_kubernetes_distributions.rb +13 -0
- data/db/migrate/20231009182412_add_kubernetes_distribution_id_to_uffizzi_core_clusters.rb +7 -0
- data/lib/uffizzi_core/version.rb +1 -1
- data/lib/uffizzi_core.rb +1 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d8112c651358e76a331ea2e85d1562ecd15724adaf89eeebc10146958ef9550
|
4
|
+
data.tar.gz: fbc115075ccb252fbc6446b51fccd93c8571d3b106a83376b173b63c7de25fd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55f7fb96c94e8dfca56310456bc3202764d1e16173fe57e96c027609748ae10bd758af06c355682c2c8ef2634b10402ce899778efb7467a99f16bd5aa4745a7f
|
7
|
+
data.tar.gz: 8d323b2dff07e8d9d03918e5642cd10093a9e2decc0f2cbf3a9e017b2ad99e8165bd447ea210a28a0497153b955244ebd68ce0d9d8db20424ed9cb05cfbf3273
|
@@ -11,13 +11,18 @@ class UffizziCore::Api::Cli::V1::Projects::ClustersController < UffizziCore::Api
|
|
11
11
|
clusters = resource_project.clusters.enabled
|
12
12
|
return respond_with clusters if request_by_admin? || valid_request_from_ci_workflow?
|
13
13
|
|
14
|
-
respond_with clusters.deployed_by_user(current_user)
|
14
|
+
respond_with clusters.deployed_by_user(current_user), each_serializer: UffizziCore::Api::Cli::V1::Projects::ShortClusterSerializer
|
15
15
|
end
|
16
16
|
|
17
17
|
def create
|
18
|
+
version = cluster_params[:k8s_version]
|
19
|
+
kubernetes_distribution = find_kubernetes_distribution(version)
|
20
|
+
return render_distribution_version_error(version) if kubernetes_distribution.blank?
|
21
|
+
|
18
22
|
cluster_form = UffizziCore::Api::Cli::V1::Cluster::CreateForm.new(cluster_params)
|
19
23
|
cluster_form.project = resource_project
|
20
24
|
cluster_form.deployed_by = current_user
|
25
|
+
cluster_form.kubernetes_distribution = kubernetes_distribution
|
21
26
|
return respond_with cluster_form unless cluster_form.save
|
22
27
|
|
23
28
|
UffizziCore::ClusterService.start_deploy(cluster_form)
|
@@ -57,4 +62,16 @@ class UffizziCore::Api::Cli::V1::Projects::ClustersController < UffizziCore::Api
|
|
57
62
|
def cluster_params
|
58
63
|
params.require(:cluster)
|
59
64
|
end
|
65
|
+
|
66
|
+
def find_kubernetes_distribution(version)
|
67
|
+
return UffizziCore::KubernetesDistribution.default if version.blank?
|
68
|
+
|
69
|
+
UffizziCore::KubernetesDistribution.find_by(version: version)
|
70
|
+
end
|
71
|
+
|
72
|
+
def render_distribution_version_error(version)
|
73
|
+
available_versions = UffizziCore::KubernetesDistribution.pluck(:version).join(', ')
|
74
|
+
message = I18n.t('kubernetes_distribution.not_available', version: version, available_versions: available_versions)
|
75
|
+
render json: { errors: { kubernetes_distribution: [message] } }, status: :unprocessable_entity
|
76
|
+
end
|
60
77
|
end
|
@@ -20,6 +20,7 @@ module UffizziCore::Concerns::Models::Cluster
|
|
20
20
|
enumerize :creation_source, in: UffizziCore.cluster_creation_sources, scope: true, predicates: true
|
21
21
|
attribute :creation_source, :string, default: :manual
|
22
22
|
validates :creation_source, presence: true
|
23
|
+
belongs_to :kubernetes_distribution, optional: true
|
23
24
|
|
24
25
|
aasm(:state) do
|
25
26
|
state :deploying_namespace, initial: true
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module UffizziCore::Concerns::Models::KubernetesDistribution
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
self.table_name = UffizziCore.table_names[:kubernetes_distributions]
|
8
|
+
|
9
|
+
has_many :clusters
|
10
|
+
|
11
|
+
def self.default
|
12
|
+
find_by(default: true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -3,5 +3,9 @@
|
|
3
3
|
class UffizziCore::Api::Cli::V1::Projects::ClusterSerializer < UffizziCore::BaseSerializer
|
4
4
|
type :cluster
|
5
5
|
|
6
|
-
attributes :id, :name, :state, :kubeconfig, :created_at, :host
|
6
|
+
attributes :id, :name, :state, :kubeconfig, :created_at, :host, :k8s_version
|
7
|
+
|
8
|
+
def k8s_version
|
9
|
+
object.kubernetes_distribution&.version || UffizziCore::KubernetesDistribution.default.version
|
10
|
+
end
|
7
11
|
end
|
@@ -4,11 +4,25 @@ class UffizziCore::Controller::CreateCluster::ClusterSerializer < UffizziCore::B
|
|
4
4
|
include UffizziCore::DependencyInjectionConcern
|
5
5
|
include_module_if_exists('UffizziCore::Controller::CreateCluster::ClusterSerializerModule')
|
6
6
|
|
7
|
-
attributes :name, :manifest, :base_ingress_host
|
7
|
+
attributes :name, :manifest, :base_ingress_host, :distro, :image
|
8
8
|
|
9
9
|
def base_ingress_host
|
10
10
|
managed_dns_zone = controller_settings_service.vcluster(object).managed_dns_zone
|
11
11
|
|
12
12
|
[object.namespace, managed_dns_zone].join('.')
|
13
13
|
end
|
14
|
+
|
15
|
+
def image
|
16
|
+
kubernetes_distribution.image
|
17
|
+
end
|
18
|
+
|
19
|
+
def distro
|
20
|
+
kubernetes_distribution.distro
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def kubernetes_distribution
|
26
|
+
@kubernetes_distribution ||= object.kubernetes_distribution
|
27
|
+
end
|
14
28
|
end
|
data/config/locales/en.yml
CHANGED
@@ -88,6 +88,9 @@ en:
|
|
88
88
|
unsupported_login_type: This type of login is not supported
|
89
89
|
unauthorized: Unauthorized
|
90
90
|
|
91
|
+
kubernetes_distribution:
|
92
|
+
not_available: "The k8s version %{version} is not supported. Available version are: %{available_versions}."
|
93
|
+
|
91
94
|
enumerize:
|
92
95
|
credential:
|
93
96
|
type:
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateUffizziCoreKubernetesDistributions < ActiveRecord::Migration[6.1]
|
4
|
+
def change
|
5
|
+
create_table :uffizzi_core_kubernetes_distributions do |t|
|
6
|
+
t.string :version
|
7
|
+
t.string :distro
|
8
|
+
t.string :image
|
9
|
+
t.boolean :default, default: false
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/uffizzi_core/version.rb
CHANGED
data/lib/uffizzi_core.rb
CHANGED
@@ -66,6 +66,7 @@ module UffizziCore
|
|
66
66
|
host_volume_files: :uffizzi_core_host_volume_files,
|
67
67
|
container_host_volume_files: :uffizzi_core_container_host_volume_files,
|
68
68
|
deployment_events: :uffizzi_core_deployment_events,
|
69
|
+
kubernetes_distributions: :uffizzi_core_kubernetes_distributions,
|
69
70
|
}
|
70
71
|
mattr_accessor :user_creation_sources, default: [:system, :online_registration, :google, :sso]
|
71
72
|
mattr_accessor :user_project_roles, default: [:admin, :developer, :viewer]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uffizzi_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Thurman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-10-
|
12
|
+
date: 2023-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aasm
|
@@ -865,6 +865,7 @@ files:
|
|
865
865
|
- app/lib/uffizzi_core/concerns/models/deployment_event.rb
|
866
866
|
- app/lib/uffizzi_core/concerns/models/event.rb
|
867
867
|
- app/lib/uffizzi_core/concerns/models/host_volume_file.rb
|
868
|
+
- app/lib/uffizzi_core/concerns/models/kubernetes_distribution.rb
|
868
869
|
- app/lib/uffizzi_core/concerns/models/membership.rb
|
869
870
|
- app/lib/uffizzi_core/concerns/models/payment.rb
|
870
871
|
- app/lib/uffizzi_core/concerns/models/price.rb
|
@@ -909,6 +910,7 @@ files:
|
|
909
910
|
- app/models/uffizzi_core/deployment_event.rb
|
910
911
|
- app/models/uffizzi_core/event.rb
|
911
912
|
- app/models/uffizzi_core/host_volume_file.rb
|
913
|
+
- app/models/uffizzi_core/kubernetes_distribution.rb
|
912
914
|
- app/models/uffizzi_core/membership.rb
|
913
915
|
- app/models/uffizzi_core/payment.rb
|
914
916
|
- app/models/uffizzi_core/price.rb
|
@@ -982,6 +984,7 @@ files:
|
|
982
984
|
- app/serializers/uffizzi_core/api/cli/v1/projects/deployments_serializer.rb
|
983
985
|
- app/serializers/uffizzi_core/api/cli/v1/projects/deployments_serializer/user_serializer.rb
|
984
986
|
- app/serializers/uffizzi_core/api/cli/v1/projects/secret_serializer.rb
|
987
|
+
- app/serializers/uffizzi_core/api/cli/v1/projects/short_cluster_serializer.rb
|
985
988
|
- app/serializers/uffizzi_core/api/cli/v1/short_project_serializer.rb
|
986
989
|
- app/serializers/uffizzi_core/api/cli/v1/user_serializer.rb
|
987
990
|
- app/serializers/uffizzi_core/api/cli/v1/user_serializer/account_serializer.rb
|
@@ -1088,6 +1091,8 @@ files:
|
|
1088
1091
|
- db/migrate/20230711101901_add_host_to_clusters.rb
|
1089
1092
|
- db/migrate/20230810140316_add_source_to_uffizzi_core_clusters.rb
|
1090
1093
|
- db/migrate/20230824150022_update_name_constraint_to_projects.rb
|
1094
|
+
- db/migrate/20231009162719_create_uffizzi_core_kubernetes_distributions.rb
|
1095
|
+
- db/migrate/20231009182412_add_kubernetes_distribution_id_to_uffizzi_core_clusters.rb
|
1091
1096
|
- db/seeds.rb
|
1092
1097
|
- lib/tasks/uffizzi_core_tasks.rake
|
1093
1098
|
- lib/uffizzi_core.rb
|