Skip to content

feat: add --logs-collector-enabled flag to kubernetes create Fixes #485 - #596

Open
yuvarajrece wants to merge 52 commits into
civo:masterfrom
yuvarajrece:master
Open

yuvarajrece wants to merge 52 commits into
civo:masterfrom
yuvarajrece:master

Conversation

@yuvarajrece

Copy link
Copy Markdown
Contributor

Summary

Fixes #485

Adds a --logs-collector-enabled flag to civo kubernetes create,
allowing users to control whether the logs collector is installed on a
new cluster.

  • If the flag is explicitly set, that value is always respected
    regardless of node size.
  • If not explicitly set, the logs collector is automatically disabled on
    standard small/xsmall nodes (g4s.kube.small, g4s.kube.xsmall) to
    save node resources, and an informational message is printed:
    "Logs collector not installed by default to save resource on small and
    xsmall standard nodes. If you wish to enable logs collector create the
    cluster with LogsCollectorEnable set to true"
  • For all other node sizes, the value is left unset by default, so the
    API's own default applies.

Depends on civo/civogo#<PR_NUMBER_HERE> for the underlying
LogsCollectorEnabled field on KubernetesClusterConfig — needs to be
merged and released before this PR can build against a real civogo
version bump (currently uses a local replace only for testing, removed
before submission).

Testing

Added unit tests in utility/kubernetes_test.go covering node-size
detection and the enable/disable resolution logic (explicit flag,
auto-disable on standard small/xsmall, default-deferred on other sizes,
and confirming non-standard tiers like performance/RAM/CPU-optimized are
not affected).

Added a flag to enable or disable logs collection for the Civo platform dashboard.
Added logs collector feature to Kubernetes creation command.
@yuvarajrece

yuvarajrece commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor Author

@alessandroargentieri @alejandrojnm Kindly review the pr and approve it

Added a 'quiet' flag to suppress prompts and output.
Add error handling for missing name and API key in quiet mode.
Fix missing newline at end of file
Replace spinner initialization with utility.NewSpinner and add quiet mode check for output.
Removed logs collector functionality and updated spinner usage.
Add Quiet option to suppress prompts and output.
Added common.Quiet checks to suppress messages in quiet mode.
Added handling for --quiet mode in AskForConfirm function.
Implement NewSpinner function for progress indication.
@yuvarajrece

Copy link
Copy Markdown
Contributor Author

@alessandroargentieri @alejandrojnm @fulviodenza Review this code

@fulviodenza fulviodenza left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for working on #485, but this PR can't be merged in its current state and I think it is best to restart it from a clean branch.

  1. It doesn't compile. cmd/kubernetes/kubernetes.go binds --logs-collector-enabled to logsCollectorEnabled, but a later commit ("Refactor kubernetes_create.go to remove logs collector") deleted both that variable and the ResolveLogsCollectorEnabled call, so the build fails with undefined: logsCollectorEnabled and Lint/Security/Test are red. The logs collector feature itself is effectively no longer in the PR.
  2. It depends on an unmerged civogo change. configKubernetes.LogsCollectorEnabled doesn't exist in the civogo version pinned in go.mod (v0.7.2), so even before that refactor this could not build. The civogo side (civo/civogo#239) needs to be merged and released first, then go.mod bumped here. The PR body still says civo/civogo#<PR_NUMBER_HERE>.
  3. Unrelated changes. Roughly 40 of the 46 files implement a global --quiet/-q flag (#497), not #485. That changes behaviour well beyond this feature (for example "Operation aborted." moves from stdout to stderr with an Error: prefix, and --quiet without --yes aborts with exit 0 and hides the reason). It deserves its own PR and review.
  4. Branch. The PR is opened from your fork's master, which is why later work got mixed in. Please use a dedicated feature branch per change.

Suggested path: one PR for the logs collector flag (once civogo has the field), with a test that kubernetes create actually wires the flag into the request, and a separate PR for --quiet if you'd like to pursue #497. A couple of small notes for the redo: the user-facing message should name the real flag (--logs-collector-enabled=true) rather than LogsCollectorEnable, and IsStandardSmallOrXSmallKubeSize should only match kubernetes node sizes.

I'm going to request changes here; feel free to close this one and open fresh PRs.

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.

Add the LogsCollectorEnabled option (true/false) to CLI when creating clusters

2 participants