Skip to content

Conversation

@TheoBrigitte
Copy link
Member

kubectl-gs-deploy-interactive

🎄 A kubectl-gs Christmas Carol 🎄

⭐ The Tale of the Deploy Command ⭐

'Twas the night before release, and all through the cluster, 🌙
Not a pod was deploying—the team in a fluster. 😰
The manifests were scattered in Git with despair, 📜
In hopes that a solution would soon appear there. ✨

Young Dev sat at her terminal, coffee grown cold, ☕
Wrestling with Flux reconciliation, growing quite old. 👵
"I just want to test this app version!" she cried, 😭
"But Flux keeps reverting—my hands are all tied!" 🤝

When out from the kubectl there arose such a clatter, 🔊
She ran kubectl gs --help to see what was the matter. 🤔
And what to her wondering eyes did appear, 👀
But a new deploy command—oh, Christmas cheer! 🎅🎉


👻 Chapter 1: The Ghost of Deployments Past 🕰️

"Listen well," spoke the command in its help text so bright, 💡
"I'll show you the magic of deployment done right!" ✨🪄

kubectl gs deploy -d [email protected]

"With just this one line, I'll suspend Flux's hold, ⏸️
Deploy your test version—be daring, be bold! 🦁
No more editing YAMLs in thirty-two places, 📝
No more kubectl patches with syntax disgraces!" 🙈

Dev's eyes lit up brightly, her heart filled with glee, 🤩
"But what of config repos?" asked she curiously. 🤷‍♀️


🎁 Chapter 2: The Ghost of Configuration Present 🎀

The deploy command smiled, its flags all aglow: 🚩✨

kubectl gs deploy -t config -d config-repo@feature-branch

"Config repos too! Switch branches with ease, 🌿
Test your configurations, do as you please! 😌
I'll patch your GitRepository, set the branch right, ⚙️
Suspend reconciliation—it's a wonderful sight!" 🌟

"But wait!" Dev exclaimed, "What if things go awry? 😱
What if my test fails and I need to say goodbye?" 👋


🔮 Chapter 3: The Ghost of Deployments Future 🚀

"Fear not!" said the command, with a wink of its flag: 😉🚩

kubectl gs deploy -d [email protected]

"I'll wait till your app is all Ready and true, ✅
Then stand guard and watch over your testing for you. 💂
When you're done with your work and you signal goodbye, 👋
I'll restore what once was—like magic, I fly! 🪄✨
Your cluster pristine, as if nothing occurred, 🧹
Not a trace of the test—on my honor, my word!" 🤞

"And there's more!" it continued with holiday cheer: 🎊

kubectl gs deploy -d -i
# Or for configs:
kubectl gs deploy -d -i -t config

"Interactive mode! A TUI so neat! 🖥️
Browse apps, configs, and versions—take a seat! 🪑
For apps or configs, I work just the same, 🎯
Select what you need with a fuzzy-search game!" 🎮


⏰ Chapter 4: The Magic of Patience ⌛

Dev leaned in closer, "But how do you know? 🧐
When pods are all ready, when flux has let go?" 🤔

The command just smiled with a knowing delight: 😊

kubectl gs deploy -d [email protected]

"I trigger Flux reconciliation, watch till it's through, 👁️
Then show you the status—all tailored for you! 🎨
No more kubectl wait or anxious refresh, 😓
I'll handle the watching while you stay fresh. 🌿
When everything's ready, I'll let you know, 📢
Then guard your deployment till you're ready to go!" 🚦


🎅 Chapter 5: The List Before Christmas 📝

"How do I know what's deployed?" Dev inquired with grace, 💁‍♀️
"What apps are suspended? What's the cluster's current state?" 🤷‍♀️

# Check what's suspended
kubectl gs deploy --status

# List all available apps
kubectl gs deploy -l apps

# List versions for testing
kubectl gs deploy -l versions my-app

# List config repositories
kubectl gs deploy -l configs

# List config versions (open PRs!)
kubectl gs deploy -l versions shared-config -t config

"I'll show you it all!" the command did declare, 📣
"What's ready, what's not, what needs your care! 🩺
Apps from the catalog, versions galore, 📚
Config PRs from GitHub—and so much more! 🎁
With gh CLI magic, I'll fetch every PR, 🪄
Show branches and titles—both near and far!" 🌍


🎶 Chapter 6: The Undeploy Carol 🔄

"And when you are finished," the command sang out: 🎵

kubectl gs deploy -u my-app

"Just undeploy! I'll remove my annotation hold, 🏷️
Let Flux take back over, as the story is told. 📖
Your cluster returns to its GitOps-managed state, ♻️
No manual cleanup—isn't that great?" 🎉


🌅 Epilogue: Christmas Morning ☀️

Dev sat back in wonder, her coffee now warm, ☕✨
She'd mastered deployment through snow, sleet, and storm. ❄️⛈️
No more YAML wrestling, no more Git commit strife, 🤼
The deploy command brought joy to her DevOps life! 😊💖

She deployed with -d, she undeployed with -u, 🔄
She listed with -l all the apps that she knew. 📋
She went interactive when the names wouldn't come, 🎮
And tested her configs with branches—how fun! 🎢

The command would wait till her apps were all Ready, ⏰✅
Then guard her deployments so patient and steady. 🛡️
When testing was done with a Ctrl+C press, ⌨️
It cleaned up behind her—no trace, no mess! 🧽✨

"Happy deploying to all!" she exclaimed with delight, 🎊
"And to all my dear colleagues—ship code left and right!" 🚢💻


🎁 The Moral of the Story 🎁

The kubectl gs deploy command brings you: 🎉

🎄 Easy app deployments - Deploy any version from your catalog 📦
🎁 Config repo switching - Test different branches/PRs without GitOps fights 🥊
Interactive mode - Select apps, configs, and versions with a beautiful TUI 🖥️
🔔 Automatic cleanup - Press Ctrl+C and everything's restored 🧹
🎅 Patient waiting - Watches reconciliation so you don't have to ⏰
❄️ Status checking - See what's deployed and what's suspended 🔍
🤶 List everything - Apps, versions, configs, catalogs, and GitHub PRs 📋

May your deployments be merry and your rollbacks be few! 🎊🎉


🧦 Quick Reference Card (Stuff Your Stocking!) 🎁

# Deploy an app (waits for Ready, cleans up on Ctrl+C) 🚀
kubectl gs deploy -d [email protected]

# Deploy interactively (apps or configs) 🎮
kubectl gs deploy -d -i
kubectl gs deploy -d -i -t config

# Deploy config repo branch/PR 🌿
kubectl gs deploy -t config -d config-repo@branch

# Disable auto-cleanup if needed 🛑
kubectl gs deploy -d [email protected] --undeploy-on-exit=false

# Disable sync if needed (async mode) ⚡
kubectl gs deploy -d [email protected] --sync=false

# Undeploy (return to Flux) 🔄
kubectl gs deploy -u my-app

# Interactive undeploy 🎯
kubectl gs deploy -u -i

# Check status 📊
kubectl gs deploy --status

# List apps from catalog 📚
kubectl gs deploy -l apps

# List installed apps only ✅
kubectl gs deploy -l apps --installed-only

# List app versions 🔢
kubectl gs deploy -l versions my-app

# List config repos 📦
kubectl gs deploy -l configs

# List config versions (GitHub PRs) 🔀
kubectl gs deploy -l versions shared-config -t config

The End 🎄✨🎅🎁⭐


A little word from the human.

It all started with a deploy.sh that I have been using in order to have a simple way to deploy changes for testing purposes. I mainly needed to deploy app or config (ccr repos) changes. This implied a sophisticated dance of labeling resources, changing versions, catalog, and the same but slightly different process for config repos. I also wanted a one line to restore the state once I am done with my testing. This command does all of that in one go.

Yes it's a very large PR and was 99% vibe coded, and well I got carried away, but yet I think it's a useful tool to have.

Screenshots 📷

kubectl-gs-deploy-status-dirty kubectl-gs-deploy-list-apps kubectl-gs-deploy-list-catalogs kubectl-gs-deploy-list-versions kubectl-gs-deploy-status-clean

@TheoBrigitte TheoBrigitte requested a review from a team December 10, 2025 21:16
@TheoBrigitte TheoBrigitte requested a review from a team as a code owner December 10, 2025 21:16
@marians
Copy link
Member

marians commented Dec 11, 2025

Theo and I talked about this PR.

I would prefer if the functionality added in this PR would become a separate CLI tool, for two main reasons:

Once we recommend HelmRelase and OCIRepository (instead of App CR etc.) as a deployment method to customers, we would like to offer a command for deploying apps that serve customer's needs first and foremost., as a replacement for kubectl gs template app. Having a kubectl gs deploy command family already would limit our options, so we would either have to change the entire kubectl gs deploy command or add another one.

The current implementation is targeting Giant Swarm staff. The use case is quite specific: deploying an alternative (dev) version of an application to a management cluster (what opsctl deploy did back in the days), temporarily. Then there are some supporting commands around it, like listing apps, listing versions, listing PRs and their branch names. This fits a specific CLI quite well IMO.

@TheoBrigitte
Copy link
Member Author

Any recommendation for a good CLI name for this ?

@hervenicol
Copy link

The current implementation is targeting Giant Swarm staff.

I reckon we already have a CLI tool for GS-specific actions, right? Although it's supposed to be deprecated :trollface:

@QuentinBisson
Copy link

What about kubectl gs deploy apps|helmrelease?

That should give us enough leeway for the future?

@marians
Copy link
Member

marians commented Dec 11, 2025

Any recommendation for a good CLI name for this ?

deploy
deployer
deploya
deeploy

@hervenicol
Copy link

Are we looking for a name for a tool that does only the deploy thing, or for something that could become a giantswarm staff swiss army CLI?

@TheoBrigitte
Copy link
Member Author

I think the idea here is to have a specific tool for deployment. I think we are not too keen on having another swiss army CLI like opsctl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants