Hello community, here is the log from the commit of package velum for openSUSE:Factory checked in at 2018-02-01 21:31:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/velum (Old) and /work/SRC/openSUSE:Factory/.velum.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "velum" Thu Feb 1 21:31:04 2018 rev:3 rq:571724 version:3.0.0+dev+git_r633_b8e974fd577e29eb7be871a0cbb661bacb511dc7 Changes: -------- --- /work/SRC/openSUSE:Factory/velum/velum.changes 2018-01-30 15:46:06.169845539 +0100 +++ /work/SRC/openSUSE:Factory/.velum.new/velum.changes 2018-02-01 21:31:46.826359768 +0100 @@ -1,0 +2,21 @@ +Thu Feb 1 15:53:58 UTC 2018 - [email protected] + +- Commit 8017753 by VĂtor Avelino [email protected] + js: added unique hostnames validation + + Velum now validates if selected nodes to bootstrap and be added to the + cluster have unique hostnames. The error message appears in an error alert. + + +------------------------------------------------------------------- +Thu Feb 1 10:31:59 UTC 2018 - [email protected] + +- Commit 5a64a71 by Maximilian Meister [email protected] + bump uglifier + + it got updated in factory + + Signed-off-by: Maximilian Meister <[email protected]> + + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ velum.spec ++++++ --- /var/tmp/diff_new_pack.97CvCw/_old 2018-02-01 21:31:47.330336191 +0100 +++ /var/tmp/diff_new_pack.97CvCw/_new 2018-02-01 21:31:47.330336191 +0100 @@ -23,7 +23,7 @@ # Version: 1.0.0 # %%define branch 1.0.0 -Version: 3.0.0+dev+git_r629_307ef40804ab6fb6da4f650dace1b49846d37605 +Version: 3.0.0+dev+git_r633_b8e974fd577e29eb7be871a0cbb661bacb511dc7 Release: 0 %define branch master Summary: Dashboard for CaasP @@ -216,14 +216,14 @@ BuildRequires: %{rubygem slim = 3.0.9} -BuildRequires: %{rubygem uglifier = 4.1.3} +BuildRequires: %{rubygem uglifier = 4.1.5} BuildRoot: %{_tmppath}/%{name}-%{version}-build %description velum is the dashboard for CaasP to manage and deploy kubernetes clusters on top of MicroOS -This package has been built with commit 307ef40804ab6fb6da4f650dace1b49846d37605 from branch master on date Tue, 30 Jan 2018 13:35:01 +0000 +This package has been built with commit b8e974fd577e29eb7be871a0cbb661bacb511dc7 from branch master on date Thu, 01 Feb 2018 15:53:20 +0000 %prep %setup -q -n velum-%{branch} ++++++ master.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/Gemfile.lock new/velum-master/Gemfile.lock --- old/velum-master/Gemfile.lock 2018-01-30 14:35:52.000000000 +0100 +++ new/velum-master/Gemfile.lock 2018-02-01 16:54:49.000000000 +0100 @@ -272,7 +272,7 @@ timecop (0.8.1) tzinfo (1.2.4) thread_safe (~> 0.1) - uglifier (4.1.3) + uglifier (4.1.5) execjs (>= 0.3.0, < 3) unicode-display_width (1.3.0) url_safe_base64 (0.2.2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/assets/javascripts/dashboard/dashboard.js new/velum-master/app/assets/javascripts/dashboard/dashboard.js --- old/velum-master/app/assets/javascripts/dashboard/dashboard.js 2018-01-30 14:35:52.000000000 +0100 +++ new/velum-master/app/assets/javascripts/dashboard/dashboard.js 2018-02-01 16:54:49.000000000 +0100 @@ -324,7 +324,7 @@ <tr> \ <td class="status">' + statusHtml + '</td>\ <td><strong>' + minion.minion_id + '</strong></td>\ - <td>' + minion.fqdn + '</td>\ + <td class="minion-hostname">' + minion.fqdn + '</td>\ <td>' + masterHtml + minion.role + '</td>\ </tr>'; }, @@ -369,7 +369,7 @@ return '\ <tr class="minion_' + minion.id + '"> \ <td>' + minion.minion_id + '</td>\ - <td>' + minion.fqdn + '</td>' + + <td class="minion-hostname">' + minion.fqdn + '</td>' + roleHtml + '</tr>'; }, @@ -389,7 +389,7 @@ <tr> \ <td>" + minionHtml + "</td>\ <td>" + minion.minion_id + "</td>\ - <td>" + minion.fqdn + "</td>\ + <td class=\"minion-hostname\">" + minion.fqdn + "</td>\ </tr>"; } }; @@ -508,11 +508,38 @@ }); }; +function handleUnassignedErrors() { + if (State.addNodesClicked && !hasUniqueHostnames()) { + State.addNodesEnabled = false; + $('.unique-hostnames-alert').fadeIn(100); + $('.add-nodes-btn').prop('disabled', true); + } else { + State.addNodesEnabled = true; + $('.unique-hostnames-alert').fadeOut(100); + $('.add-nodes-btn').prop('disabled', false); + } +} + +$('body').on('click', '.add-nodes-btn', function(e) { + State.addNodesClicked = true; + + e.preventDefault(); + handleUnassignedErrors(); + + if (State.addNodesEnabled) { + $('form').submit(); + } +}); + // enable/disable Add nodes button to assign nodes function toggleAddNodesButton() { - var selectedNodes = $("input[name='roles[worker][]']:checked").length; + var selectedNodesLength = $("input[name='roles[worker][]']:checked").length; + + $('.add-nodes-btn').prop('disabled', selectedNodesLength === 0); - $('.add-nodes-btn').prop('disabled', selectedNodes === 0); + if (selectedNodesLength > 0) { + handleUnassignedErrors(); + } }; // unassigned nodes page @@ -528,6 +555,26 @@ return $('input[name="roles[master][]"]:checked').length; } +function hasUniqueHostnames() { + var i = 0; + var $newHostnames = $('input[name="roles[worker][]"]:checked, input[name="roles[master][]"]:checked').closest('tr').find('.minion-hostname'); + var newHostnames = $newHostnames.map(function (i, el) { return $(el).text() }).toArray() || []; + var currentHostnames = $('.new-nodes-container').data('current-hostnames') || []; + var hostnames = newHostnames.concat(currentHostnames); + var obj = {}; + + for (; i < hostnames.length; i++) { + var hostname = hostnames[i]; + + if (obj[hostname] === 0) { + return false; + } + + obj[hostname] = 0; + } + + return true; +} function isBootstrappable() { var errors = []; @@ -547,6 +594,11 @@ errors.push('The number of masters has to be an odd number'); } + // We need unique hostnames + if (!hasUniqueHostnames()) { + errors.push("All nodes must have unique hostnames"); + } + State.bootstrapErrors = errors; return errors.length === 0; @@ -558,7 +610,7 @@ return (selectedWorkersLength() + selectedMastersLength()) >= 3; } -// handle bootstra button title +// handle bootstrap button title function handleBootstrapErrors() { var nextClicked = State.nextClicked; var title; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/controllers/dashboard_controller.rb new/velum-master/app/controllers/dashboard_controller.rb --- old/velum-master/app/controllers/dashboard_controller.rb 2018-01-30 14:35:52.000000000 +0100 +++ new/velum-master/app/controllers/dashboard_controller.rb 2018-02-01 16:54:49.000000000 +0100 @@ -63,6 +63,7 @@ # GET /assign_nodes def unassigned_nodes @unassigned_minions = Minion.unassigned_role + @assigned_minions_hostnames = Minion.assigned_role.map(&:fqdn) end # POST /assign_nodes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/views/dashboard/unassigned_nodes.html.slim new/velum-master/app/views/dashboard/unassigned_nodes.html.slim --- old/velum-master/app/views/dashboard/unassigned_nodes.html.slim 2018-01-30 14:35:52.000000000 +0100 +++ new/velum-master/app/views/dashboard/unassigned_nodes.html.slim 2018-02-01 16:54:49.000000000 +0100 @@ -6,6 +6,12 @@ span | After choosing the nodes and clicking "Add nodes" all the selected nodes will be set to the worker role +.alert.alert-danger.unique-hostnames-alert role="alert" hidden="true" + i.fa.fa-4x.pull-left aria-hidden="true" + span + strong Unable to add nodes: + | All nodes must have unique hostnames + h1 Unassigned Nodes .row @@ -13,7 +19,7 @@ p#node-count #{@unassigned_minions.count} nodes found = form_tag(assign_nodes_url, method: "post") - .nodes-container.new-nodes-container data-url=authenticated_root_path + <div class="nodes-container new-nodes-container" data-url="#{authenticated_root_path}" data-current-hostnames='#{@assigned_minions_hostnames}'> table.table thead tr @@ -30,13 +36,13 @@ = check_box_tag "roles[worker][]", m.id td | #{m.minion_id} - td + td.minion-hostname | #{m.fqdn} - .clearfix.text-right.steps-container = link_to "Back", authenticated_root_path, class: "btn btn-default" | = submit_tag "Add nodes", class: "btn btn-primary add-nodes-btn", disabled: true + </div> = content_for :page_javascript do javascript: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/spec/features/add_unassigned_nodes_feature_spec.rb new/velum-master/spec/features/add_unassigned_nodes_feature_spec.rb --- old/velum-master/spec/features/add_unassigned_nodes_feature_spec.rb 2018-01-30 14:35:52.000000000 +0100 +++ new/velum-master/spec/features/add_unassigned_nodes_feature_spec.rb 2018-02-01 16:54:49.000000000 +0100 @@ -1,6 +1,6 @@ require "rails_helper" -# rubocop:disable RSpec/AnyInstance +# rubocop:disable RSpec/AnyInstance, RSpec/ExampleLength describe "Add unassigned nodes" do let!(:user) { create(:user) } let!(:minions) do @@ -36,6 +36,29 @@ expect(page).to have_content(minions[2].fqdn).and have_no_content(minions[3].fqdn) end + it "A user cannot add nodes with conflicting hostnames", js: true do + minion = Minion.create!(minion_id: SecureRandom.hex, fqdn: "minion1.k8s.local") + + # select duplicated node minion1.k8s.local + find("#roles_minion_#{minion.id}").click + + click_button "Add nodes" + expect(page).to have_content("All nodes must have unique hostnames") + expect(page).to have_button(value: "Add nodes", disabled: true) + end + + it "A user cannot add nodes with conflicting hostnames [2]", js: true do + minion = Minion.create!(minion_id: SecureRandom.hex, fqdn: "minion2.k8s.local") + + # select duplicated new nodes minion2.k8s.local + find("#roles_minion_#{minion.id}").click + find("#roles_minion_#{minions[minions.length - 2].id}").click + + click_button "Add nodes" + expect(page).to have_content("All nodes must have unique hostnames") + expect(page).to have_button(value: "Add nodes", disabled: true) + end + it "A user check all nodes at once to be added", js: true do # wait for all minions to be there expect(page).to have_content(minions[2].fqdn) @@ -54,4 +77,4 @@ expect(page).to have_content("minion4.k8s.local") end end -# rubocop:enable RSpec/AnyInstance +# rubocop:enable RSpec/AnyInstance, RSpec/ExampleLength diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/spec/features/bootstrap_cluster_feature_spec.rb new/velum-master/spec/features/bootstrap_cluster_feature_spec.rb --- old/velum-master/spec/features/bootstrap_cluster_feature_spec.rb 2018-01-30 14:35:52.000000000 +0100 +++ new/velum-master/spec/features/bootstrap_cluster_feature_spec.rb 2018-02-01 16:54:49.000000000 +0100 @@ -175,6 +175,19 @@ expect(page).to have_content(minions[4].fqdn) end + it "A user cannot bootstrap nodes with conflicting hostnames", js: true do + duplicated = Minion.create! [{ minion_id: SecureRandom.hex, fqdn: "minion99.k8s.local" }, + { minion_id: SecureRandom.hex, fqdn: "minion99.k8s.local" }] + # select nodes minion99.k8s.local + find(".minion_#{duplicated[0].id} .worker-btn").click + find(".minion_#{duplicated[1].id} .worker-btn").click + + click_on_when_enabled "#set-roles" + + expect(page).to have_content("All nodes must have unique hostnames") + expect(page).to have_button(value: "Next", disabled: true) + end + it "A user cannot bootstrap an even multiple master configuration", js: true do # select master minion0.k8s.local find(".minion_#{minions[0].id} .master-btn").click
