Skip to content

Commit

Permalink
Merge pull request #506 from UffizziCloud/feature/505-add-node-select…
Browse files Browse the repository at this point in the history
…or-to-cluster

[505] added node selector to cluster
  • Loading branch information
moklidia authored Mar 2, 2024
2 parents af61631 + f2f03f0 commit 6c7245d
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ In order to add a new migration do the following steps:
2. Run the command inside the `web` container

```bash
rake app:uffizzi_core:install
rake uffizzi_core:install:migrations
```

This command copies the new migration to the `db/migrate` folder
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class UffizziCore::Api::Cli::V1::Cluster::CreateForm < UffizziCore::Cluster
include UffizziCore::ApplicationForm

permit :name, :manifest, :creation_source
permit :name, :manifest, :creation_source, :node_selector

validate :check_manifest, if: -> { manifest.present? }

Expand Down
1 change: 1 addition & 0 deletions core/app/lib/uffizzi_core/concerns/models/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module UffizziCore::Concerns::Models::Cluster
validates :name, presence: true, format: { with: /\A[a-zA-Z0-9-]*\z/ }

enumerize :creation_source, in: UffizziCore.cluster_creation_sources, scope: true, predicates: true
enumerize :node_selector, in: [:gvisor, :vanilla]
attribute :creation_source, :string, default: :manual
validates :creation_source, presence: true
belongs_to :kubernetes_distribution, optional: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class UffizziCore::Controller::CreateCluster::ClusterSerializer < UffizziCore::B
include UffizziCore::DependencyInjectionConcern
include_module_if_exists('UffizziCore::Controller::CreateCluster::ClusterSerializerModule')

attributes :name, :manifest, :base_ingress_host, :distro, :image
attributes :name, :manifest, :base_ingress_host, :distro, :image, :node_selector

def base_ingress_host
managed_dns_zone = controller_settings_service.vcluster_settings_by_vcluster(object).managed_dns_zone
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class AddNodeSelectorToCluster < ActiveRecord::Migration[6.1]
def change
add_column(:uffizzi_core_clusters, :node_selector, :string)
end
end
3 changes: 2 additions & 1 deletion core/test/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_10_09_182412) do
ActiveRecord::Schema.define(version: 2024_03_01_200235) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -85,6 +85,7 @@
t.string "host"
t.string "creation_source"
t.integer "kubernetes_distribution_id"
t.string "node_selector"
t.index ["project_id"], name: "index_cluster_on_project_id"
end

Expand Down
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 20240301200235)
class AddNodeSelectorToCluster < ActiveRecord::Migration[6.1]
def change
add_column(:uffizzi_core_clusters, :node_selector, :string)
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_10_09_163516) do
ActiveRecord::Schema.define(version: 2024_03_01_200916) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -84,6 +84,8 @@
t.datetime "updated_at", precision: 6, null: false
t.string "host"
t.string "creation_source"
t.integer "kubernetes_distribution_id"
t.string "node_selector"
t.index ["project_id"], name: "index_cluster_on_project_id"
end

Expand Down

0 comments on commit 6c7245d

Please sign in to comment.