Skip to content

fix: auto-detect token/cluster for agent install/update#57

Merged
9trocode merged 1 commit intomainfrom
fix/agent-install-update-auto-config
Feb 19, 2026
Merged

fix: auto-detect token/cluster for agent install/update#57
9trocode merged 1 commit intomainfrom
fix/agent-install-update-auto-config

Conversation

@9trocode
Copy link
Contributor

Summary

This PR improves the user experience for pipeops agent install, update, and upgrade commands by automatically detecting the existing configuration from the cluster if one is already present.

This means that if a user has an existing agent installation, they can simply run pipeops agent update without needing to provide the --token or --cluster-name arguments again. The CLI will fetch these values from the pipeops-agent-config secret in the pipeops-system namespace.

Changes

  • Added cmd/agent/cluster_config.go: Contains logic to fetch pipeops-agent-config secret using kubectl.
  • Updated cmd/agent/install.go:
    • Args validation now allows empty arguments if a valid cluster config is found.
    • Run logic attempts to use the cluster config if token/cluster name are missing.
  • Updated cmd/agent/update.go:
    • Run logic attempts to use the cluster config if token/cluster name are missing.

Testing

  • Validated via unit tests (none added for this specific interaction as it relies on kubectl execution which is mocked in integration tests).
  • Verified make build and make lint pass.

- Add cmd/agent/cluster_config.go to read existing agent config from cluster
- Update cmd/agent/install.go to use existing config if token/cluster name missing
- Update cmd/agent/update.go to use existing config if token/cluster name missing
- Allow running install/update without args if config exists in cluster
@9trocode 9trocode merged commit 9730a3e into main Feb 19, 2026
1 check 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.

1 participant