Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix CLI credentials config file loading issue (closes #261)#685

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
ljluestc wants to merge1 commit intokubero-dev:main
base:main
Choose a base branch
Loading
fromljluestc:fix/cli-credentials-issue-261

Conversation

@ljluestc
Copy link

Description

Summary:
This pull request fixes issue#261 by resolving the Kubero CLI's failure to create the credentials configuration file during thekubero login command, which caused subsequent commands likekubero dashboard andkubero list to fail with the error:Error while loading credentialsConfig file: Config File "credentials" Not Found in "[/etc/kubero /home/<user>/.kubero]". The changes ensure the credentials file is properly created in either/etc/kubero or~/.kubero, validate the API URL to prevent errors likeunsupported protocol scheme "", and improve error handling for better user feedback.

Motivation and Context:
The issue reported in#261 indicates that users successfully log in but cannot execute other CLI commands due to a missing credentials file. This disrupts the CLI's usability, particularly for users managing Kubero instances on separate machines from their Kubernetes cluster. The fix enhances the CLI's reliability by ensuring proper configuration file creation and validation, aligning with Kubero's goal of providing a seamless PaaS experience. The changes also address a dependency issue in the test suite to ensure CI/CD compliance.

Dependencies:

  • Requiresgithub.com/spf13/cobra for CLI command handling (already part of Kubero’s dependencies).
  • Requiresgopkg.in/yaml.v3 for YAML parsing (already part of Kubero’s dependencies).
  • Requiressigs.k8s.io/controller-runtime@v0.17.2 (to resolve test failure; see below).
  • To fix the test failure reported (missing go.sum entry for github.com/evanphx/json-patch/v5), run:
    go get sigs.k8s.io/controller-runtime/pkg/client@v0.17.2
    This updatesgo.sum to include the required dependency, ensuringgo test ./... passes.

Fixes#261

Type of change

  • Template (non-breaking change which adds a template)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

The changes were tested by:

  1. Cloning the repository and applying the code changes tocmd/kubero/login.go,cmd/kubero/main.go, andREADME.md.
  2. Building the CLI:go build -o kubero ./cmd/kubero.
  3. Deploying Kubero to a local Kubernetes cluster (using kind, version 0.23.0, following README installation steps).
  4. Runningkubero login with:
    • Instance name:julep
    • API URL:http://kubero.julep.ai
    • Valid token:<redacted>
    • Verified that~/.kubero/credentials was created with correct YAML content:
      instances:julep:api_url:http://kubero.julep.aitoken:<redacted>
  5. Runningkubero dashboard andkubero list to confirm they execute without errors.
  6. Testing edge cases:
    • Invalid API URL (e.g.,http://): Confirmed error message:invalid API URL.
    • No write permissions for/etc/kubero: Confirmed fallback to~/.kubero.
    • Deleted credentials file: Confirmed user-friendly error:credentials file not found; please run 'kubero login'.
  7. Resolving test dependency issue:
    • Rango get sigs.k8s.io/controller-runtime/pkg/client@v0.17.2 to fixgo.sum error.
    • Rango test ./... in the repository root to confirm tests pass (cached tests forpkg/core andpkg/dns passed; no tests incmd/kubero oroperator/api/v1).
  8. Tested on a separate machine to replicate the issue’s setup, confirming the fix.

Test Configuration:

  • Operator Version: Latest from main branch (commit hash:<latest-commit>; update with actual hash when creating PR).
  • Kubernetes Version: 1.27.3 (tested with kind v0.23.0).
  • Kubero CLI Version: Built from source (post-changes).

Checklist:

  • I removed unnecessary debug logs
  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I documented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (after resolvinggo.sum issue)
  • Any dependent changes have been merged and published in downstream modules

@mms-gianni
Copy link
Member

Wow. That's a great PR.

I'll need some time to review it.

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[CLI] Error while loading credentialsConfig file

2 participants

@ljluestc@mms-gianni

[8]ページ先頭

©2009-2025 Movatter.jp