Skip to content

Instantly share code, notes, and snippets.

View juanbrny's full-sized avatar

Juan Herrera Utande juanbrny

View GitHub Profile
@juanbrny
juanbrny / getclustergroupmembers.py
Created January 9, 2024 21:22
Python script to get all members of a given fleet clustergroup
import json
import subprocess
import sys
# fleet clustergroup membership is dynamic based on the rules in the clustergroup definition
# Those rules are either a matchExpressions selector, a matchLabels selector or a combination of both.
# This script gets the clustergroup name as parameter and get's the rule definition in json format.
# Those rules are then formated to be used in kubectl command that finds all the fleet clustergroup
# members that match those rules and show the in the standard out put.