Commit d74228f2 authored by HQ's avatar HQ
Browse files

Bug fixes and performance improvements

parent 60aee67f
......@@ -3,7 +3,7 @@
DocumentRoot /var/www/html
<Location />
deny from all
allow from 127.0.0.1 10.0.0.0/8 #stabile
allow from 127.0.0.1 10.0.0.0/8
</Location>
ErrorLog ${APACHE_LOG_DIR}/error.log
......
......@@ -27,7 +27,7 @@ apt-mark hold kubeadm kubelet kubectl
#perl -pi -e 's/<VirtualHost _default_:443>/<VirtualHost _default_:10002>/;' /etc/apache2/sites-available/kubernetes-ssl.conf
#perl -pi -e 's/(\s+<\/VirtualHost>)/ ProxyPass \/ http:\/\/dashboardip:80\/\n ProxyPassReverse \/ http:\/\/dashboardip:80\/\n Header set Authorization "Bearer \${KUBE_TOKEN}"\n$1/;' /etc/apache2/sites-available/kubernetes-ssl.conf
#perl -pi -e 's/(DocumentRoot \/var\/www\/html)/$1\n <Location \/>\n deny from all\n allow from 127.0.0.1 #stabile\n <\/Location>/;' /etc/apache2/sites-available/kubernetes-ssl.conf
#perl -pi -e 's/(DocumentRoot \/var\/www\/html)/$1\n <Location \/>\n deny from all\n allow from 127.0.0.1\n <\/Location>/;' /etc/apache2/sites-available/kubernetes-ssl.conf
perl -pi -e 's/Listen 443/Listen 443\n Listen 10002/;' /etc/apache2/ports.conf
echo "export KUBE_TOKEN= " >> /etc/apache2/envvars
......
......@@ -13,7 +13,7 @@ sub kubernetes {
my $token = `cat /root/admin-user.token`;
chomp $token;
my $allow = `cat /etc/apache2/sites-available/kubernetes-ssl.conf`;
my $kubelimit = $1 if ($allow =~ /allow from (.+) \#stabile/);
my $kubelimit = $1 if ($allow =~ /allow from (.+)/);
my $curip = qq|<div style="font-size: 13px;">leave empty to disallow all access, your current IP is <a style="text-decoration: none;" href="#" onclick="\$('#limitkube').val('$ENV{HTTP_X_FORWARDED_FOR} ' + \$('#limitkube').val());">$ENV{HTTP_X_FORWARDED_FOR}</a></div>| if ($ENV{HTTP_X_FORWARDED_FOR});
my $kubepwform = <<END
......@@ -409,10 +409,10 @@ END
my ($validlimit, $mess) = validate_limit($limit);
my $conf = "/etc/apache2/sites-available/kubernetes-ssl.conf";
if ($validlimit) {
if (`grep '#stabile' /etc/apache2/sites-available/kubernetes-ssl.conf`)
if (`grep 'allow from' /etc/apache2/sites-available/kubernetes-ssl.conf`)
{
$message = "Kubernetes dashboard access was changed!";
$message .= `perl -pi -e 's/allow from (.*) \#stabile/allow from $validlimit #stabile/;' $conf`;
$message .= `perl -pi -e 's/allow from (.*)/allow from $validlimit/;' $conf`;
} else {
$message = "Unable to process kubernetes-ssl.conf!";
}
......
......@@ -82,6 +82,10 @@ if ($action eq 'mountpools') {
print "resizing $dev $rsize...\n";
print "Unmount partition\n";
my $res = `umount /dev/$dev`;
unless ($res =~ /unmounted/) {
print "Unable to unmount /dev/$dev\n";
exit 1;
}
sleep 1;
print "Detaching image\n";
$res = `curl -k --silent https://$gw/stabile/servers?action=detach`;
......@@ -111,10 +115,10 @@ if ($action eq 'mountpools') {
$blks = `lsblk -f`;
if ($blks =~ /$dev ext/) {
$resizecmd = "resize2fs";
print `umount /dev/$dev`;
print `umount -v /dev/$dev`;
} elsif ($blks =~ /$dev xfs/) {
$resizecmd = "xfs_growfs";
print `mount /dev/$dev`;
print `mount -v /dev/$dev`;
} else {
print "No supported file system found on partition\n",
$dev = '';
......@@ -130,7 +134,7 @@ if ($action eq 'mountpools') {
$res .= `$resizecmd /dev/$dev`;
print $res;
print "Remounting partition /dev/$dev\n";
$res = `mount /dev/$dev`;
$res = `mount -v /dev/$dev`;
print $res;
print "Done.\n";
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment