Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[505] added node selector to cluster #506

Merged
merged 3 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading