This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Courtesy Dmitrii in a Slack channel | |
NAME=admin | |
NEW_PASSWORD=mke4mke4mke4 | |
export HASHED=$(htpasswd -nbBC 10 '' "$NEW_PASSWORD" | tr -d ':\n' | base64) | |
alias km="kubectl -n mke --kubeconfig ~/.mke/mke.kubeconf" | |
km get password $(km get password -o jsonpath="{.items[?(@.email=='$NAME')].metadata.name}") -oyaml | yq '.hash = strenv(HASHED)' | km -n mke apply -f - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function verboseLog { | |
Write-Verbose "$args" | |
} | |
function getContainerdVer { | |
if (Get-Command "ctr.exe" -ErrorAction SilentlyContinue) | |
{ | |
$tmp = ctr -v|Out-String | |
if ($LASTEXITCODE -eq 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$true)] | |
[ValidateScript({Test-Path -Path $_ -PathType Leaf})] | |
[string] | |
$ReportPath, | |
[Parameter(Mandatory=$false)] | |
[int] | |
$EntryCount = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
show_help() { | |
echo "Usage: $0 [--expires-in-days <days> | -e <days>] [--output-dir <directory> | -o <directory>] [-h|--help]" | |
echo "" | |
echo "Purpose: This script creates kubeconfig files for MKE (Mirantis Kubernetes Engine) admin users" | |
echo " based on their clusterrolebinding to the 'cluster-admin' role." | |
echo "" | |
echo "Options:" | |
echo " -h, --help Show this help message" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Host "`$MyInvocationInvocationName value is [$($MyInvocation.InvocationName)]" | |
Write-Host "`$MyInvocation.Line value is [$($MyInvocation.Line)]" | |
Write-Host "`$MyInvocation.Line is null? [$($null -eq $MyInvocation.Line)]" | |
Write-Host "`$MyInvocation.Line is empty string? [$('' -eq $MyInvocation.Line)]" | |
Write-Host | |
if (-Not ($MyInvocation.InvocationName -eq '.' -or $MyInvocation.Line -eq '')) { | |
Write-Host "I'm gonna run the installer!" | |
} | |
else { | |
Write-Host "Not going to run the installer. :-(" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env pwsh | |
# | |
# This script is meant for quick & easy install on Windows via an elevated command prompt: | |
# | |
# PS>Invoke-WebRequest -Uri get.mirantis.com/install.ps1 | |
# PS>Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process | |
# PS>.\install.ps1 | |
# | |
# To obtain explicit versions of the script, append version number after replacing | |
# '.' and '-' characters in version with '_': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Wrapper script for 'genUrlFromVersionAndChannel' function with support for v25 versioning and resolving to latest | |
pre-release build | |
.PARAMETER DownloadUrl | |
Specify the URL from which to obtain the package | |
.PARAMETER Channel | |
Specify the release channel like 'test' or 'stable', etc. | |
.PARAMETER DockerVersion | |
Specify the docker version you intend to install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Port Checker Script | |
# This Bash script checks the status of specified network ports on a system. | |
# It utilizes the `ss` command to determine if each port is being listened to | |
# and retrieves associated process information, including the protocol (Netid), | |
# local address, process name, and PID. The output is formatted in a columnar | |
# structure for easy reading. The script requires elevated privileges to access | |
# process information. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$mke4WarnPortsMsg = 'WRN The following MKE3 ports are no longer used by MKE4 and (unless otherwise needed) may be made unavailable on all nodes: [2377,6444,7946,12376,12378,12381,12382,12383,12384,12385,12386,12387,12388,12389,12391,12392,179,12390,2376,443]' | |
$mke4PortsNotUsed = [regex]::matches($mke4WarnPortsMsg, '(?<=\[)[^\]]+(?=\])').Value -split ',' | ForEach-Object { [int] $_ } | Sort-Object | |
$mke3PortList = @" | |
[ | |
{ | |
"Role":["manager","worker"], | |
"Port": "179", | |
"Protocol": "TCP", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Gets the labels associated with each node | |
.PARAMETER NodeName | |
Specify a single node (if not provided all nodes returned) | |
.PARAMETER Flatten | |
Flattens out the labels such that there is a node object returned per label | |
#> | |
[CmdletBinding()] | |
param ( |
NewerOlder