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 - containers-bugowner@suse.de
+
+- Commit 8017753 by Vítor Avelino contact@vitoravelino.me
+ 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 - containers-bugowner@suse.de
+
+- Commit 5a64a71 by Maximilian Meister mmeister@suse.de
+ bump uglifier
+
+ it got updated in factory
+
+ Signed-off-by: Maximilian Meister " + 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