Skip to content

Instantly share code, notes, and snippets.

View rleap-m's full-sized avatar

Ryan Leap rleap-m

  • Mirantis
  • Raleigh, NC
View GitHub Profile
@rleap-m
rleap-m / fix-mke4-gateway-lb.sh
Created June 12, 2026 19:23
Use this after qa-infra built cluster migrated from MKE3 to MKE4 to get the LB working w/Gateway API in the mix
#!/usr/bin/env bash
#
# fix-mke4-gateway-lb.sh
#
# After an MKE 3 -> MKE 4 migration, the MKE 4 NLB's :443 listener can end up
# pointed at the wrong gateway HTTPS NodePort. Symptom: the dashboard login
# succeeds in Dex but every API call returns 401 (OIDC issuer mismatch), and/or
# https://<lb-hostname>/ refuses the connection. Root cause: terraform wired the
# :443 listener to one NodePort (e.g. 33001) while mkectl deployed the envoy
# gateway on another (e.g. 33433, via --gateway-https-node-port).
@rleap-m
rleap-m / windows-node-setup-steps.md
Created May 8, 2026 17:46
Windows node setup on MKE4

mkectl apply — Windows Node Setup Sequence

MKE 4.2.0, WS2022.

# Action Observed
1 SSH connection established HashKnownHosts=yes, keys hashed on connect
2 OS detection uname | grep Linux, uname | grep Darwin both fail; falls through to Windows check
3 Windows confirmed Get-CimInstance Win32_OperatingSystemMicrosoft Windows Server 2022 Datacenter 10.0.20348
4 Identity confirmed whoamiip-172-31-0-18\administrator; hostnameip-172-31-0-18
@rleap-m
rleap-m / GenerateCredentialSpecResource.ps1
Created April 16, 2026 20:10
GenerateCredentialSpecResource.ps1 but with bad SHA for testing
<#
.Synopsis
Renders a GMSA kubernetes resource manifest.
.DESCRIPTION
This is me messing up the SHA value with a comment
#>
Param(
[Parameter(Position = 0, Mandatory = $true)] [String] $AccountName,
[Parameter(Position = 1, Mandatory = $true)] [String] $ResourceName,
[Parameter(Position = 2, Mandatory = $false)] [String] $ManifestFile,
#!/usr/bin/env bash
#
# Mirantis Container Runtime installer
#
# Script build information:
# COMMIT_SHA=thisisafakeshamadebyrleap
# COMMIT_SHA_PVAL=thisisa
# SEMVER_VERSION=1.0.25
# PUBLISH_STRING=test
@rleap-m
rleap-m / mke-rbac-artifacts.sh
Last active February 13, 2026 15:07
Inspect Kubernetes RBAC artifacts generated by MKE4 to represent orgs, teams, and grants
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_NAME="$(basename "$0")"
VERSION="1.0.0"
usage() {
cat <<EOF
Usage:
${SCRIPT_NAME} <command> [options]
@rleap-m
rleap-m / Copy-QaInfra.ps1
Created December 5, 2025 16:07
Utility script to create a Terraform working directory from a repository
<#
.SYNOPSIS
Utility script to create a Terraform working directory from a repository
.EXAMPLE
Copy-QaInfra.ps1 -VariablePath ./mke_412_rc1 -DestinationPath ./mke_412_ga -Verbose
#>
[CmdletBinding()]
param (
# Path to the items to copy
[ValidateScript({Test-Path $_ -PathType Container})]
@rleap-m
rleap-m / Get-EC2VpcPeering.ps1
Created December 5, 2025 15:27
PowerShell script which will return AWS EC2 VPC Peering objects for a given region
<#
.SYNOPSIS
Gets AWS VPC peering connections
.DESCRIPTION
Sometimes we use peering connections to connect VPCs (especially convenient to allow an MKE
cluster to reach an LDAP server
.PARAMETER Region
AWS region where the VPCs reside
.NOTES
Author - rleap@mirantis.com
@rleap-m
rleap-m / get_mke_token.sh
Created November 13, 2025 18:41
Script which will obtain access and refresh tokens to interact with MKE4 /api/auth/v1/accounts endpoints
#!/usr/bin/env bash
set -euo pipefail
# ============================================
# MKE / Dex OAuth2 PKCE token fetcher (bash-only)
# - Auth Code + PKCE: interactive (copy/paste code)
# - Refresh grant: non-interactive
#
# deps: bash, curl, openssl, base64, tr, sed
# (jq optional; script falls back to sed)
@rleap-m
rleap-m / migration_replication_status.sh
Last active July 2, 2025 18:07
Fetch and report MSR 4 replication executions for rules matching a prefix
#!/bin/bash
# Defaults (can be overridden by CLI flags)
HARBOR_URL="${HARBOR_URL:-}"
HARBOR_USER="${HARBOR_USER:-}"
HARBOR_PWD="${HARBOR_PWD:-}"
PREFIX="migration-rule-"
PAGE_SIZE=100
MODE="all"
LATEST_ONLY="false"
@rleap-m
rleap-m / delete_msr4_projects_and_repos.sh
Created July 2, 2025 15:44
Script to delete MSR4 project and the repos they contain.
#!/bin/bash
set -euo pipefail
PAGE_SIZE=100
# Default values from environment, can be overridden via CLI
HARBOR_URL="${HARBOR_URL:-}"
HARBOR_USER="${HARBOR_USER:-}"
HARBOR_PWD="${HARBOR_PWD:-}"
DRY_RUN=false