Skip to content

[KAAP-550] Added force remove flag in byohctl deauthorise and decommission - #201

Merged
snslk merged 8 commits into
mainfrom
private/snh/KAAP-550
Aug 31, 2026
Merged

[KAAP-550] Added force remove flag in byohctl deauthorise and decommission#201
snslk merged 8 commits into
mainfrom
private/snh/KAAP-550

Conversation

@snslk

@snslk snslk commented Aug 19, 2026

Copy link
Copy Markdown

Summary

Add force flag for byohctl deauthorise and byohctl decommission .

ubuntu@byoh-snh-1:~$ ./byohctl deauthorise -h
Deauthorise a host from the respective byo cluster.
This command will:
1. Authenticate with Platform9
2. Deauthorise the host from the byo cluster
3. Host must have been part of some cluster before deauthorisation

Usage:
  byohctl deauthorise [flags]

Examples:
  byohctl deauthorise -v all

Flags:
  -f, --force              Force deauthorise of the host.
  -h, --help               help for deauthorise
  -v, --verbosity string   Log verbosity level (all, important, minimal, critical, none) (default "minimal")

BUG

https://platform9.atlassian.net/browse/KAAP-550

Testing

After onboarding byohost deleted DU , not able to deauthorise or decommission . Using updated deauthorise binary successfully able to deauthorise and decommission host .

root@byoh-snh-1:~# ./byohctl deauthorise -f
[2026-08-19 07:25:21] [SUCCESS] Successfully retrieved Kubernetes client
failed to get ByoHosts object from the management plane: error getting ByoHosts: Get "https://test-du-ciprsmoke-5014697.app.qa-pcd.platform9.com/k8s-api/apis/infrastructure.cluster.x-k8s.io/v1beta1/namespaces/test-du-ciprsmoke-5014697-default-service/byohosts/byoh-snh-1": dial tcp: lookup test-du-ciprsmoke-5014697.app.qa-pcd.platform9.com on 127.0.0.53:53: no such host
[2026-08-19 07:25:21] [SUCCESS] Successfully deauthorised host from the byo cluster
root@byoh-snh-1:~# ./byohctl decommission  
[2026-08-19 07:25:40] [SUCCESS] Successfully retrieved Kubernetes client
failed to get ByoHosts object from the management plane: error getting ByoHosts: Get "https://test-du-ciprsmoke-5014697.app.qa-pcd.platform9.com/k8s-api/apis/infrastructure.cluster.x-k8s.io/v1beta1/namespaces/test-du-ciprsmoke-5014697-default-service/byohosts/byoh-snh-1": dial tcp: lookup test-du-ciprsmoke-5014697.app.qa-pcd.platform9.com on 127.0.0.53:53: no such host
Do you want to proceed with host cleanup? (y/n): y
[2026-08-19 07:25:45] [SUCCESS] Successfully purged Debian package pf9-byohost-agent
[2026-08-19 07:25:45] [SUCCESS] Successfully ran dpkg purge
[2026-08-19 07:25:45] [SUCCESS] Successfully decommissioned host from the pf9 kaapi management cluster
root@byoh-snh-1:~# systemctl list-units | grep pf9
root@byoh-snh-1:~# dpkg -l | grep pf9
root@byoh-snh-1:~# find / -name byohctl
/root/byohctl
/home/ubuntu/byohctl
root@byoh-snh-1:~# 

…-node . Added force removal of byohost CR in case of DU deletion
@snslk
snslk requested review from a team, badrinath-pf9 and srm6867 August 19, 2026 07:35
@snslk snslk changed the title [KAAP-550] Added force remove option of byohctl deauthrize-node and decommission [KAAP-550] Added force remove flag in byohctl deauthorise and decommission Aug 19, 2026
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sebastian-pf9 sebastian-pf9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

needs test. (code lgtm)

sebastian-pf9
sebastian-pf9 previously approved these changes Aug 19, 2026

@sebastian-pf9 sebastian-pf9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@sebastian-pf9 sebastian-pf9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

no changes to previous commit. still lgtm

@indradhanush indradhanush left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Request changes because context.TODO and package level client.

Additional suggestions: Please look into adding an E2E test for the --force flag. We already have existing test Ginkgo based suites in this repo, which should help.

Comment thread cmd/byohctl/client/k8s.go Outdated
Comment thread cmd/byohctl/pkg/host_operations.go Outdated
Comment thread cmd/byohctl/pkg/host_operations.go Outdated
Comment thread cmd/byohctl/pkg/host_operations.go Outdated
Comment thread cmd/byohctl/pkg/host_operations_test.go Outdated
@snslk
snslk force-pushed the private/snh/KAAP-550 branch from 78a17ea to 830f403 Compare August 20, 2026 09:43
@snslk
snslk requested a review from indradhanush August 20, 2026 10:02

@indradhanush indradhanush left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry for not approving yet. I think I was not super clear in my previous comment.

Comment thread cmd/byohctl/client/k8s.go Outdated
Comment thread cmd/byohctl/pkg/host_operations_test.go Outdated
@snslk
snslk force-pushed the private/snh/KAAP-550 branch from ba5757c to 7d5ce21 Compare August 24, 2026 06:31
@snslk
snslk force-pushed the private/snh/KAAP-550 branch from 7d5ce21 to 5fa431c Compare August 25, 2026 08:45
@snslk
snslk force-pushed the private/snh/KAAP-550 branch from 08a5c04 to d52b23e Compare August 25, 2026 10:06

@indradhanush indradhanush left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved to unblock. Please fix merge conflicts to proceed.

Comment thread cmd/byohctl/cmd/deauthorise.go Outdated
Comment thread cmd/byohctl/cmd/deauthorise.go
Comment thread cmd/byohctl/cmd/decommission.go Outdated
Comment thread cmd/byohctl/pkg/host_operations.go Outdated
Comment thread cmd/byohctl/pkg/host_operations_test.go Outdated
Comment thread cmd/byohctl/pkg/host_operations.go Outdated
Comment thread cmd/byohctl/pkg/host_operations.go
@snslk
snslk merged commit f5978f6 into main Aug 31, 2026
18 checks passed
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.

3 participants