Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
v0.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
rimusz committed Dec 31, 2015
1 parent 2bc4e04 commit ddc751d
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/Kube-Solo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
1329DEB81BD526A3008AA719 /* update_k8s.command in Resources */ = {isa = PBXBuildFile; fileRef = 1329DEB71BD526A3008AA719 /* update_k8s.command */; };
1347C2F91C30570D0083CDF9 /* change_sudo_password.command in Resources */ = {isa = PBXBuildFile; fileRef = 1347C2F81C30570D0083CDF9 /* change_sudo_password.command */; };
13BCE1C01BEBC0BD00A1A48E /* update_k8s_version.command in Resources */ = {isa = PBXBuildFile; fileRef = 13BCE1BF1BEBC0BD00A1A48E /* update_k8s_version.command */; };
13D9B8671C35B09B00EBB078 /* restore_update_fleet_units.command in Resources */ = {isa = PBXBuildFile; fileRef = 13D9B8661C35B09B00EBB078 /* restore_update_fleet_units.command */; };
13FE22171C1C40C700F465F1 /* bin in Resources */ = {isa = PBXBuildFile; fileRef = 13FE22161C1C40C700F465F1 /* bin */; };
13FE22191C1C410100F465F1 /* cloud-init in Resources */ = {isa = PBXBuildFile; fileRef = 13FE22181C1C410100F465F1 /* cloud-init */; };
CA4F6FFF1BE1910A00D87763 /* NSURL+KubeSolo.m in Sources */ = {isa = PBXBuildFile; fileRef = CA4F6FFE1BE1910A00D87763 /* NSURL+KubeSolo.m */; };
Expand Down Expand Up @@ -82,6 +83,7 @@
1329DEB71BD526A3008AA719 /* update_k8s.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = update_k8s.command; sourceTree = "<group>"; };
1347C2F81C30570D0083CDF9 /* change_sudo_password.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = change_sudo_password.command; sourceTree = "<group>"; };
13BCE1BF1BEBC0BD00A1A48E /* update_k8s_version.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = update_k8s_version.command; sourceTree = "<group>"; };
13D9B8661C35B09B00EBB078 /* restore_update_fleet_units.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = restore_update_fleet_units.command; sourceTree = "<group>"; };
13FE22161C1C40C700F465F1 /* bin */ = {isa = PBXFileReference; lastKnownFileType = folder; path = bin; sourceTree = SOURCE_ROOT; };
13FE22181C1C410100F465F1 /* cloud-init */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "cloud-init"; sourceTree = SOURCE_ROOT; };
CA4F6FFD1BE1910A00D87763 /* NSURL+KubeSolo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+KubeSolo.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -203,6 +205,7 @@
1329DEA61BD4FB5F008AA719 /* halt.command */,
1329DEA71BD4FB5F008AA719 /* reload.command */,
1329DEA41BD4FB5F008AA719 /* fetch_latest_iso.command */,
13D9B8661C35B09B00EBB078 /* restore_update_fleet_units.command */,
13BCE1BF1BEBC0BD00A1A48E /* update_k8s_version.command */,
1329DEB71BD526A3008AA719 /* update_k8s.command */,
1329DEAB1BD4FB5F008AA719 /* update_osx_clients_files.command */,
Expand Down Expand Up @@ -300,6 +303,7 @@
01E2855418A6C4E300BC630D /* MainMenu.xib in Resources */,
01F0282C1A7C54C8008C37AA /* os_shell.command in Resources */,
1329DEB61BD4FB5F008AA719 /* update_osx_clients_files.command in Resources */,
13D9B8671C35B09B00EBB078 /* restore_update_fleet_units.command in Resources */,
1347C2F91C30570D0083CDF9 /* change_sudo_password.command in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
16 changes: 16 additions & 0 deletions src/Kube-Solo/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,22 @@ - (IBAction)updates:(id)sender {
}
}

- (IBAction)restoreFleetUnits:(id)sender {
VMStatus vmStatus = [self.vmManager checkVMStatus];

switch (vmStatus) {
case VMStatusDown:
[self notifyUserWithText:NSLocalizedString(@"VMStateOff", nil)];
break;

case VMStatusUp:
[self notifyUserWithText:NSLocalizedString(@"RestoreFleetUnitsNotificationMessage", nil)];
[self.vmManager restoreFleetUnits];
break;
}
}


- (IBAction)fetchLatestISO:(id)sender {
[self notifyUserWithText:NSLocalizedString(@"ISOImageWillBeUpdatedNotificationMessage", nil)];
[self.vmManager updateISO];
Expand Down
11 changes: 9 additions & 2 deletions src/Kube-Solo/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,17 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="vyH-FE-ksB"/>
<menuItem title="Fetch latest CoreOS ISO" id="KYE-xq-LpJ" userLabel="Force CoreOS update">
<menuItem title="Restore/update fleet units" id="KYE-xq-LpJ" userLabel="Restore/update fleet units">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="fetchLatestISO:" target="494" id="z9S-Pq-sjA"/>
<action selector="restoreFleetUnits:" target="494" id="e7L-uZ-VLY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="XkV-sa-RCz"/>
<menuItem title="Fetch latest CoreOS ISO" id="1Lj-FO-yQv" userLabel="Force CoreOS update">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="fetchLatestISO:" target="494" id="nGJ-oZ-3ux"/>
</connections>
</menuItem>
</items>
Expand Down
4 changes: 2 additions & 2 deletions src/Kube-Solo/Kube-Solo-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.3.7</string>
<string>0.3.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>127</string>
<string>131</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
1 change: 1 addition & 0 deletions src/Kube-Solo/VMManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ typedef NS_ENUM(NSInteger, VMStatus) {
- (void)updateKubernetes;
- (void)updateKubernetesVersion;
- (void)updateClients;
- (void)restoreFleetUnits;
- (void)updateISO;
- (void)changeReleaseChannel;
- (void)changeSudoPassword;
Expand Down
4 changes: 4 additions & 0 deletions src/Kube-Solo/VMManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ - (void)updateClients {
[self runApp:@"iTerm" arguments:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"update_osx_clients_files.command"]];
}

- (void)restoreFleetUnits {
[self runApp:@"iTerm" arguments:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"restore_update_fleet_units.command"]];
}

- (void)runScript:(NSString *)scriptName arguments:(NSString *)arguments {
NSTask *task = [[NSTask alloc] init];

Expand Down
1 change: 1 addition & 0 deletions src/Kube-Solo/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"KubernetesUpdateNotificationTitle" = "Kube-Solo and";
"KubernetedUpdateNotificationMessage" = "OS X kubectl will be updated";
"KubernetesVersionChangeNotificationMessage" = "OS X kubectl version will be changed";
"RestoreFleetUnitsNotificationMessage" = "fleet units will be restored/upgraded";
"QuittingNotificationTitle" = "Quitting Kube-Solo App";

// Alerts
Expand Down
4 changes: 2 additions & 2 deletions src/fleet/kube-apiserver.service
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ ExecStart=/opt/bin/kube-apiserver \
--service-cluster-ip-range=10.100.0.0/16 \
--etcd_servers=http://127.0.0.1:2379 \
--bind-address=0.0.0.0 \
--logtostderr=true
#--runtime_config=extensions/v1beta1=true,extensions/v1beta1/daemonsets=true
--logtostderr=true \
--runtime_config=extensions/v1beta1=true,extensions/v1beta1/daemonsets=true

Restart=always
RestartSec=10
77 changes: 77 additions & 0 deletions src/restore_update_fleet_units.command
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

# restore_update_fleet_units.command
#

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "${DIR}"/functions.sh

# get App's Resources folder
res_folder=$(cat ~/kube-solo/.env/resouces_path)

# get VM IP
vm_ip=$(cat ~/kube-solo/.env/ip_address)

# path to the bin folder where we store our binary files
export PATH=${HOME}/kube-solo/bin:$PATH

# copy files to ~/kube-solo/bin
cp -f "${res_folder}"/bin/* ~/kube-solo/bin
chmod 755 ~/kube-solo/bin/*
rm -f ~/kube-solo/bin/gen_kubeconfig

# copy fleet units
cp -R "${res_folder}"/fleet/ ~/kube-solo/fleet
#

# restart fleet units
echo "Restarting fleet units:"
# set fleetctl tunnel
export FLEETCTL_ENDPOINT=http://$vm_ip:2379
export FLEETCTL_DRIVER=etcd
export FLEETCTL_STRICT_HOST_KEY_CHECKING=false
cd ~/kube-solo/fleet
~/kube-solo/bin/fleetctl stop kube-apiserver.service
~/kube-solo/bin/fleetctl stop kube-controller-manager.service
~/kube-solo/bin/fleetctl stop kube-scheduler.service
~/kube-solo/bin/fleetctl stop kube-kubelet.service
~/kube-solo/bin/fleetctl stop kube-proxy.service
echo " "
sleep 5
~/kube-solo/bin/fleetctl start kube-apiserver.service
~/kube-solo/bin/fleetctl start kube-controller-manager.service
~/kube-solo/bin/fleetctl start kube-scheduler.service
~/kube-solo/bin/fleetctl start kube-kubelet.service
~/kube-solo/bin/fleetctl start kube-proxy.service
#
sleep 5
echo " "
echo "fleetctl list-units:"
~/kube-solo/bin/fleetctl list-units
echo " "

# set kubernetes master
export KUBERNETES_MASTER=http://$vm_ip:8080
echo Waiting for Kubernetes cluster to be ready. This can take a few minutes...
spin='-\|/'
i=1
until ~/kube-solo/bin/kubectl version | grep 'Server Version' >/dev/null 2>&1; do i=$(( (i+1) %4 )); printf "\b${spin:i++%${#sp}:1}"; sleep .1; done
i=1
until ~/kube-solo/bin/kubectl get nodes | grep $vm_ip >/dev/null 2>&1; do i=$(( (i+1) %4 )); printf "\r${spin:$i:1}"; sleep .1; done
echo " "
#
echo " "
echo "k8s nodes list:"
~/kube-solo/bin/kubectl get nodes
echo " "
#
echo "Cluster info:"
~/kube-solo/bin/kubectl cluster-info
echo " "

echo "Fleet units restored/updated !!!"
pause 'Press [Enter] key to continue...'




1 change: 1 addition & 0 deletions src/update_k8s.command
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export PATH=${HOME}/kube-solo/bin:$PATH

# copy files to ~/kube-solo/bin
cp -f "${res_folder}"/bin/* ~/kube-solo/bin
rm -f ~/kube-solo/bin/gen_kubeconfig
chmod 755 ~/kube-solo/bin/*

# download latest version of k8s files
Expand Down
3 changes: 2 additions & 1 deletion src/update_k8s_version.command
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export PATH=${HOME}/kube-solo/bin:$PATH

# copy files to ~/kube-solo/bin
cp -f "${res_folder}"/bin/* ~/kube-solo/bin
rm -f ~/kube-solo/bin/gen_kubeconfig
chmod 755 ~/kube-solo/bin/*

echo "$1"
Expand All @@ -28,7 +29,7 @@ download_k8s_files_version

# generate kubeconfig file
echo Generate kubeconfig file ...
"${res_folder}"/bin/gen_kubeconfig $vm_ip
"${res_folder}"/bin/gen_kubeconfig $vm_ip
echo " "
#

Expand Down

0 comments on commit ddc751d

Please sign in to comment.