Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved kubestronauts ambassadors handling scripts #35

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ dist
.vscode-test

# CNCF Elements
Kubestronaut.tsv
Coupons.csv
Ambassadors.tsv
*-service-file.json
python_venv/
python_env_cncfpeople
python_venv_ambassadors
credentials.json
token.json
**/*.tsv
**/*.csv
**/*.svg
**/*.png
**/*.json
**/token
Copy link
Contributor

@RobertKielty RobertKielty Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@huats I was looking at this list of file types working thru it to consider if they had any impact on the external GHA work and I was thinking that it would probably be fine.

But then I noticed that there is a json file in this PR (suggestions.json) are you sure you want to **/*.json files in .gitgnore moving forward?

Kubestronauts/Kubestronauts_ToBe_Annotated.txt
32 changes: 21 additions & 11 deletions Ambassadors/CNCF-Project-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ Argo
Armada
Artifact Hub
Athenz
Atlantis
Backstage
Bank-Vaults
BFE
bpfman
Brigade
Buildpacks
Capsule
Carina
Cartography
Carvel
CDK for Kubernetes (CDK8s)
cert-manager
Expand All @@ -37,7 +41,6 @@ CubeFS
Curiefense
Curve
Dapr
Dapr (Serverless)
Devfile
DevSpace
DevStream
Expand All @@ -52,11 +55,13 @@ etcd
external-secrets
FabEdge
Falco
Flatcar Container Linux
Fluentd
Fluid
Flux
Fonio
gRPC
hami
Harbor
Headlamp
Helm
Expand All @@ -77,20 +82,20 @@ Karmada
KCL
kcp
KEDA
KEDA (Serverless)
Kepler
Keptn
Keycloak
Keylime
Kmesh
Knative
Knative (Serverless)
ko
Konveyor
Koordinator
kpt
Krator
Krkn
Krustlet
Krustlet (Wasm)
Kuadrant
Kuasar
Kube-burner
Kube-OVN
Expand All @@ -104,7 +109,6 @@ KubeEdge
Kubeflow
Kuberhealthy
Kubernetes
Kubernetes
Kubescape
KubeSlice
KubeStellar
Expand All @@ -114,12 +118,14 @@ Kubewarden
KUDO
Kuma
Kured
KusionStack
Kyverno
Lima
Linkerd
Litmus
Logging Operator (Kube Logging)
Longhorn
LoxiLB
Merbridge
Meshery
MetalLB
Expand All @@ -128,7 +134,7 @@ Microcks
NATS
Network Service Mesh
Nocalhost
Notary
Notary Project
Open Cluster Management
Open Policy Agent (OPA)
Open Policy Containers
Expand All @@ -139,7 +145,7 @@ OpenELB
OpenFeature
OpenFGA
OpenFunction
OpenFunction (Serverless)
openGemini
OpenGitOps
OpenKruise
OpenMetrics
Expand All @@ -148,30 +154,36 @@ OpenTracing
OpenYurt
Operator Framework
ORAS
OSCAL-COMPASS
Paralus
Parsec
Perses
PipeCD
Piraeus Datastore
Pixie
Porter
Pravega
Prometheus
Radius
Ratify
rkt
Rook
SchemaHero
Score
sealer
Sermant
Serverless Devs
Serverless Devs (Serverless)
Serverless Workflow
Service Mesh Interface (SMI)
Service Mesh Performance
Shipwright
Skooner
SlimToolkit
SOPS
Spiderpool
SPIFFE
SPIRE
Stacker
Strimzi
Submariner
SuperEdge
Expand All @@ -185,14 +197,12 @@ Tremor
Trickster
Vineyard
Virtual Kubelet
Virtual Kubelet (Serverless)
Visual Studio Code Kubernetes Tools
Vitess
Volcano
wasmCloud
WasmEdge (Wasm)
WasmEdge Runtime
WasmEdge Runtime
werf
Xline
youki
zot
22 changes: 14 additions & 8 deletions Ambassadors/CNCFInsertAmbassadorInPeople_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
from googleapiclient.discovery import build
from googleapiclient.http import MediaIoBaseDownload
from google.auth.transport.requests import Request
from dotenv import load_dotenv


# Constants
GDRIVE_URL = "https://drive.google.com/drive/folders/XXXXXXXX"
load_dotenv()
GDRIVE_URL= os.getenv('GDRIVE_URL')
PROJECT_LIST_PATH = 'CNCF-Project-list.txt'
PEOPLE_JSON_PATH = '../../people/people.json'
SUGGESTIONS_FILE = 'suggestions.json'
Expand Down Expand Up @@ -158,14 +161,15 @@ def download_file_from_drive(folder_url, filename, outputname):
print(f'Download complete for {filename}')

class People:
def __init__(self, firstName, lastName, bio, company, pronouns, location, twitter, github, projects, image):
def __init__(self, firstName, lastName, bio, company, pronouns, location, twitter, github, projects, image, slack):
self.name = f"{firstName} {lastName}"
self.bio = f"<p>{bio.replace(' ', '<p/><p>')}</p>" if bio else ""
self.company = company if company != "Individual - No Account" else ""
self.pronouns = pronouns if pronouns != "Prefer not to answer" else ""
self.location = location
self.twitter = self.format_twitter(twitter)
self.github = self.format_github(github)
self.slack_id = slack
self.category = ["Ambassadors"]
self.projects = self.parse_and_confirm_projects(projects)
self.image = self.handle_image(image, firstName, lastName)
Expand All @@ -190,14 +194,14 @@ def handle_image(self, image, firstName, lastName):
download_file_from_drive(GDRIVE_URL, image, "imageTemp" + file_extension)
return f"{firstName.lower().replace(' ', '-')}-{lastName.lower().replace(' ', '-')}{file_extension}"
else:
shutil.copy("phippy.jpg", "imageTemp.jpg")
shutil.copy("../../people/images/phippy.jpg", "imageTemp.jpg")
return "phippy.jpg"

def parse_and_confirm_projects(self, raw_string):
project_names = load_project_names(PROJECT_LIST_PATH)
project_dict = {project.lower(): project for project in project_names}
identified_projects = parse_projects(raw_string, project_names)

# Confirm and add any missing projects interactively
remaining_words = raw_string.lower()
for project in identified_projects:
Expand Down Expand Up @@ -235,7 +239,7 @@ def parse_and_confirm_projects(self, raw_string):
else:
suggestions[word_sequence] = None
save_suggestions(suggestions)

remaining_words = [word for word in remaining_words if word]

for word in remaining_words:
Expand Down Expand Up @@ -263,8 +267,10 @@ def process_entries(firstLine, lastLine):
csv_reader = csv.reader(csv_file, delimiter='\t')
for lineCount, row in enumerate(csv_reader, start=1):
if firstLine <= lineCount <= lastLine:
newPerson = People(firstName=row[0], lastName=row[1], bio=row[7], company=row[3], pronouns=row[4],
location=row[2], twitter=row[6], github=row[5], projects=row[8], image=row[9])
# newPerson = People(firstName=row[0], lastName=row[1], bio=row[7], company=row[3], pronouns=row[4],
# location=row[2], twitter=row[6], github=row[5], projects=row[8], image=row[9])
newPerson = People(firstName=row[0], lastName=row[1], bio=row[9], company=row[3], pronouns=row[4],
location=row[2], twitter=row[7], github=row[5], projects=row[8], image=row[10], slack=row[6])
print(newPerson.toJSON())

# Load existing data
Expand All @@ -283,7 +289,7 @@ def process_entries(firstLine, lastLine):
else:
data.insert(indexPeople, json.JSONDecoder(object_pairs_hook=OrderedDict).decode(newPerson.toJSON()))
split_tup = os.path.splitext(newPerson.image)
os.rename("imageTemp" + split_tup[1], "people/images/" + newPerson.image)
os.rename("imageTemp" + split_tup[1], "../../people/images/" + newPerson.image)
break

# Write updated data back to file
Expand Down
5 changes: 5 additions & 0 deletions Ambassadors/README.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Projects list
wget https://landscape.cncf.io/api/projects/all.json
jq '.[] | select(.accepted_at) | .name' all.json | cut -d'"' -f2 > CNCF-Project-list.txt


# Get the secrets from https://console.cloud.google.com/auth/clients/, store it under credentials.json and run the script
python3 CNCFInsertAmbassadorInPeople_json.py -fl 2 -ll 45
# You will be prompted to login
6 changes: 6 additions & 0 deletions Ambassadors/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pygsheets
gdown
pandas
urllib3==1.26.6
pygsheets==2.0.6
python-dotenv
6 changes: 5 additions & 1 deletion Ambassadors/suggestions.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,9 @@
"gloo": null,
"- open policy agent": "Open Policy Agent (OPA)",
"ceph": null,
"rollouts": "Argo"
"rollouts": "Argo",
"notary": "Notary Project",
"litmusery": "Litmus",
"ery": null,
"tensorflow": null
}
58 changes: 58 additions & 0 deletions Kubestronaut/AckKubestronautsReceived.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import csv
import json
import os
from collections import OrderedDict
import argparse
import shutil
import pygsheets
import pandas as pd
from dotenv import load_dotenv



parser = argparse.ArgumentParser(description='Ack the reception of a Kubestronaut in the sheet')

parser.add_argument('-e','--email', help='', required=True)
args = vars(parser.parse_args())

email = args['email']

load_dotenv()
# Store credentials
pwd = os.getenv('KUBESTRONAUT_RECEIVERS')


# Let's open the GoogleSheet to write Kubestronaut info + coupons
#authorization
gc = pygsheets.authorize(service_file='kubestronauts-handling-service-file.json')
#open the google spreadsheet
sh = gc.open_by_key(KUBESTRONAUT_RECEIVERS)
#select the first sheet
wks = sh[0]

NON_acked_Kubestronauts=[]

list_kubestronauts_cells=wks.find(pattern=email, cols=(2,2), matchEntireCell=False)
number_matching_cells = len(list_kubestronauts_cells)

if (number_matching_cells==1):
email_cell = list_kubestronauts_cells[0]
wks.update_value("G"+str(email_cell.row),"")
cell_f2 = wks.cell('F2')
bg_color_f2 = cell_f2.color

cell=wks.cell("F"+str(email_cell.row))
cell.color = bg_color_f2
print("F"+str(email_cell.row))
print("Kubestronaut with email "+email+" : ACKed")
elif (number_matching_cells==0):
print("Kubestronaut with email "+email+" not found !!")
NON_acked_Kubestronauts.append(email)
else:
print("Kubestronaut with email "+email+" found multiple times !!")
NON_acked_Kubestronauts.append(email)

if NON_acked_Kubestronauts:
print("List of Kubestroauts that were NOT ACKED:")
for email_address in NON_acked_Kubestronauts:
print("\t"+email_address)
Loading
Loading