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 / 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
@rleap-m
rleap-m / manage_source_registry_db.sh
Last active July 8, 2025 15:08
Copy and expose the source registry databases (MKE auth store and MSR DB store) to the MSR 4 migration tool.
#!/bin/bash
set -euo pipefail
# Default ports
ENZI_RETHINKDB_PORT=28015
ENZI_CLUSTER_PORT=29015
MSR_RETHINKDB_PORT=28016
MSR_CLUSTER_PORT=29016
SCRIPT_NAME=$(basename "$0")
@rleap-m
rleap-m / assign_team_permissions_to_org_repos.ps1
Last active May 6, 2025 15:42
Script to assign team's permissions to organizational repositories in MSR registry.
<#
.SYNOPSIS
Script to assign team's permissions to organizational repositories in MSR registry.
.PARAMETER MkeUrl
The URL of the MKE server.
.PARAMETER MkrCred
The credentials for the MKE server.
.PARAMETER MsrRegistryHost
The MSR Registry hostname.
.PARAMETER MsrAccessToken
@rleap-m
rleap-m / populate_msr_orgs_with_images.ps1
Last active April 30, 2025 18:09
Script to populate each MSR org with one or more repositories
<#
.SYNOPSIS
Script to populate each MSR org with one or more repositories
.DESCRIPTION
This script will take a list of local images and push them to the MSR registry for each MKE organization.
It will create a new repository for each image in the MSR registry and push the image to that repository.
.PARAMETER MkeUrl
The URL of the MKE server.
.PARAMETER MkrCred
The credentials for the MKE server.
@rleap-m
rleap-m / link_ad_resources_to_mke.ps1
Last active May 6, 2025 20:36
Scripts to build out a large OU/Group/User infrastructure in Active Directory for MKE and MSR testing purposes
@rleap-m
rleap-m / release-matrix.json
Last active January 8, 2025 16:33
Custom MKE4 Release matrix
[
{
"mkeReleaseVersion": "v4.0.1-alpha.2",
"blueprintOperatorVersion": "v1.0.18",
"mkeOperatorVersion": "v1.2.1",
"k0sVersion": "v1.31.1+k0s.1",
"isLatest": true,
"minimumMkectlVersion": ""
},
{