-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #486 from UffizziCloud/feature/485_add_k8s_version…
…_param Feature/485 add k8s version param
- Loading branch information
Showing
20 changed files
with
194 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
core/app/lib/uffizzi_core/concerns/models/kubernetes_distribution.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module UffizziCore::Concerns::Models::KubernetesDistribution | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
self.table_name = UffizziCore.table_names[:kubernetes_distributions] | ||
|
||
has_many :clusters | ||
|
||
def self.default | ||
find_by(default: true) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class UffizziCore::KubernetesDistribution < UffizziCore::ApplicationRecord | ||
include UffizziCore::Concerns::Models::KubernetesDistribution | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
core/app/serializers/uffizzi_core/api/cli/v1/projects/short_cluster_serializer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class UffizziCore::Api::Cli::V1::Projects::ShortClusterSerializer < UffizziCore::BaseSerializer | ||
type :cluster | ||
|
||
attributes :id, :name | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
core/db/migrate/20231009162719_create_uffizzi_core_kubernetes_distributions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
class CreateUffizziCoreKubernetesDistributions < ActiveRecord::Migration[6.1] | ||
def change | ||
create_table :uffizzi_core_kubernetes_distributions do |t| | ||
t.string :version | ||
t.string :distro | ||
t.string :image | ||
t.boolean :default, default: false | ||
t.timestamps | ||
end | ||
end | ||
end |
7 changes: 7 additions & 0 deletions
7
core/db/migrate/20231009182412_add_kubernetes_distribution_id_to_uffizzi_core_clusters.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddKubernetesDistributionIdToUffizziCoreClusters < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column(:uffizzi_core_clusters, :kubernetes_distribution_id, :integer, foreign_key: true) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
FactoryBot.define do | ||
factory :kubernetes_distribution, class: UffizziCore::KubernetesDistribution do | ||
version { generate(:version) } | ||
image { generate(:string) } | ||
distro { generate(:string) } | ||
|
||
trait :default do | ||
default { true } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,4 +121,8 @@ | |
sequence :cluster_name do |n| | ||
"cluster-name-#{n}" | ||
end | ||
|
||
sequence :version do |n| | ||
"#{n}.#{n}#{n}" | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
db/migrate/20231009103942_add_source_to_uffizzi_core_clusters.uffizzi_core.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
# This migration comes from uffizzi_core (originally 20230810140316) | ||
|
||
class AddSourceToUffizziCoreClusters < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column(:uffizzi_core_clusters, :creation_source, :string) | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
db/migrate/20231009163516_create_uffizzi_core_kubernetes_distributions.uffizzi_core.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
# This migration comes from uffizzi_core (originally 20231009162719) | ||
class CreateUffizziCoreKubernetesDistributions < ActiveRecord::Migration[6.1] | ||
def change | ||
create_table :uffizzi_core_kubernetes_distributions do |t| | ||
t.string :version | ||
t.string :distro | ||
t.string :image | ||
t.boolean :default | ||
t.timestamps | ||
end | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
...te/20231009201239_add_kubernetes_distribution_id_to_uffizzi_core_clusters.uffizzi_core.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
# This migration comes from uffizzi_core (originally 20231009182412) | ||
class AddKubernetesDistributionIdToUffizziCoreClusters < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column(:uffizzi_core_clusters, :kubernetes_distribution_id, :integer, foreign_key: true) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
puts 'Creating User' | ||
|
||
user = UffizziCore::User.create!( | ||
email: '[email protected]', | ||
password: 'password', | ||
state: UffizziCore::User::STATE_ACTIVE, | ||
creation_source: UffizziCore::User.creation_source.system, | ||
) | ||
|
||
puts 'Creating Accounts' | ||
|
||
personal_account = UffizziCore::Account.create!( | ||
owner: user, | ||
name: 'personal', | ||
|
@@ -30,3 +34,10 @@ | |
organizational_project = organizational_account.projects.create!(name: 'uffizzi', slug: 'uffizzi', | ||
state: UffizziCore::Project::STATE_ACTIVE) | ||
organizational_project.user_projects.create!(user: user, role: UffizziCore::UserProject.role.admin) | ||
|
||
puts 'Creating Kubernetes Distributions' | ||
|
||
UffizziCore::KubernetesDistribution.create(distro: 'k3s', version: '1.25', image: 'rancher/k3s:v1.25.14-k3s1') | ||
UffizziCore::KubernetesDistribution.create(distro: 'k3s', version: '1.26', image: 'rancher/k3s:v1.26.9-k3s1') | ||
UffizziCore::KubernetesDistribution.create(distro: 'k3s', version: '1.27', default: true, image: 'rancher/k3s:v1.27.6-k3s1') | ||
UffizziCore::KubernetesDistribution.create(distro: 'k3s', version: '1.28', image: 'rancher/k3s:v1.28.2-k3s1') |