Skip to content

Commit

Permalink
refs
Browse files Browse the repository at this point in the history
  • Loading branch information
abdotaskies committed Aug 27, 2024
1 parent 28bee87 commit f82b5e3
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 19 deletions.
8 changes: 6 additions & 2 deletions attach-disk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ function Write-Log {
)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
if ($level -eq "ERR") {
Write-Err "$timestamp [$level] $message"
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Red
write-host $message
}else{
Write-Log "$timestamp [$level] $message"
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Green
write-host $message
}
}
function Write-Err {
Expand Down
10 changes: 9 additions & 1 deletion configure-k3s.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ function Write-Log {
[string]$level = "INFO"
)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Write-Output "$timestamp [$level] $message"
if ($level -eq "ERR") {
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Red
write-host $message
}else{
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Green
write-host $message
}
}

$serviceFilePath = "/etc/systemd/system/k3s.service"
Expand Down
10 changes: 9 additions & 1 deletion firewalls.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ function Write-Log {
[string]$level = "INFO"
)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Write-Output "$timestamp [$level] $message"
if ($level -eq "ERR") {
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Red
write-host $message
}else{
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Green
write-host $message
}
}
# install firewall-cmd top open ports
apt update
Expand Down
8 changes: 6 additions & 2 deletions k3s-server.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ function Write-Log {
)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
if ($level -eq "ERR") {
Write-Err "$timestamp [$level] $message"
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Red
write-host $message
}else{
Write-Output "$timestamp [$level] $message"
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Green
write-host $message
}
}
function Write-Err {
Expand Down
15 changes: 6 additions & 9 deletions k3s-worker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ function Write-Log {
)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
if ($level -eq "ERR") {
Write-Error "$timestamp [$level] $message"
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Red
write-host $message
}else{
Write-Output "$timestamp [$level] $message"
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Green
write-host $message
}
}
function Write-Err {
Expand Down Expand Up @@ -49,13 +53,6 @@ if (-not $?) {
Write-Err "Failed to join the k3s cluster: $_"
exit 1
}
# verify the cluster
Write-Log "Verifying the cluster..."
kubectl get nodes
if (-not $?) {
Write-Err "Failed to verify the cluster: $_"
exit 1
}

# open firewall ports
$command = "iex '& ([scriptblock]::Create((iwr $firewall_script)))'"
Expand Down
8 changes: 6 additions & 2 deletions mysql.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ function Write-Log {
)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
if ($level -eq "ERR") {
Write-Err "$timestamp [$level] $message"
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Red
write-host $message
}else{
Write-Output "$timestamp [$level] $message"
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Green
write-host $message
}
}
function Write-Err {
Expand Down
12 changes: 10 additions & 2 deletions nerdctl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ function Write-Log {
[string]$message,
[string]$level = "INFO"
)
$timestamp = Get-Date -FoRemove-Itemat "yyyy-MM-dd HH:mm:ss"
Write-Output "$timestamp [$level] $message"
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
if ($level -eq "ERR") {
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Red
write-host $message
}else{
Write-Host -NoNewline "$timestamp "
Write-Host -NoNewline "[$level] " -ForegroundColor Green
write-host $message
}
}
# sudo pwsh -Command "iex '& ([scriptblock]::Create((iwr https://raw.githubusercontent.com/abdullahfarook/kube/main/nerdctl.ps1)))'"
# download and extract containerd
Expand Down

0 comments on commit f82b5e3

Please sign in to comment.