-
Notifications
You must be signed in to change notification settings - Fork 11
feat: abctl config init
command
#179
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
Conversation
- Add ConfigMapGet, ConfigMapCreate, and ConfigMapUpdate methods to Client interface - Implement methods in DefaultK8sClient using Kubernetes clientset - Add comprehensive unit tests for all three methods with happy path and error cases - Maintains consistency with existing Secret operations
Enable DefaultK8s to use Kubernetes' standard configuration resolution when an empty kubeconfig path is provided. This allows the function to automatically respect the KUBECONFIG environment variable and fall back to ~/.kube/config, matching kubectl's behavior. Why: The init command needs to connect to external Kubernetes clusters using standard kubeconfig resolution, while other commands continue to use the explicit kind cluster configuration. How: When kubecfg is empty, use clientcmd.NewDefaultClientConfigLoadingRules() which implements the standard Kubernetes config search order. Otherwise, maintain backward compatibility by using the explicit path.
Add a new 'abctl init' command that extracts configuration from an existing Airbyte installation and creates an abctl ConfigMap for future operations. Why: Enable abctl to work with existing Airbyte deployments by reading their configuration and storing it in a standardized format. How: The command reads the airbyte-env ConfigMap, extracts the Airbyte API host, then creates an abctl ConfigMap with this configuration for subsequent abctl operations.
Add unit tests for the AbctlConfigFromData function and update the mock k8s client to support ConfigMap operations needed by the init command.
Should this be under the |
This is more aimed at not local (but will work for local and remote). The commands that will use this feature will be more for API interactions, like |
internal/cmd/init/init.go
Outdated
|
||
const suffix = "-airbyte-env" | ||
for _, cm := range configMaps.Items { | ||
if len(cm.Name) >= len(suffix) && cm.Name[len(cm.Name)-len(suffix):] == suffix { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has this be replaced with strings.HasSuffix
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I can fix that up.
I do wonder if there is a sub-command (or namespace) we could throw this under. I'm reluctant to introduce a root command to |
We did talk about having a completely separate executable, or using a command like |
As discussed with @colesnodgrass . I have added a fixup commit that moves I also addressed comment regarding |
Summary
Works towards Airbyte dataplane installation and management. Adds
abctl config init
command to bootstrap abctl configuration from existing Airbyte Kubernetes deployments. Auto-detects Airbyte ConfigMaps ending with-airbyte-env
suffix and extracts API endpoints and auth settings. It is envisioned that Abctl installation will automatically create the Abctl configmap during installation. Though I have added ample test coverage, and put some thought into this PR, there will might be some gaps. I'm hoping I can address these issues in future PRs before cutting a new release.What's New
abctl config init
CommandBetter Kubeconfig Handling
K8s Client Extensions
Added ConfigMap operations: Get, List, Create, Update
Config Utilities
Usage
Auto-detect and init
Manual source
Force overwrite
Note
The bernielomax/feat/auth-login-logout branch adds GetCurrentNamespace() for better namespace detection from kubeconfig context - pairs nicely with this init command. It also introduces the
auth login
auth logout
command which builds upon this PR.Tests
Full test coverage for ConfigMap operations, config extraction, and kubeconfig resolution.