[deckhouse-cli] Better enable/disable status reporting#251
Merged
Conversation
…etailed status messages - Now if module is already enabled or already disabled - the output will be more specific and not just "operation is successful" - If module can't be enabled because of allowExperimentalModules: false - there will be a friendly message about it instead of raw kubectl output log Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
…ready enabled/disabled states Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
ldmonster
approved these changes
Jan 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Issues with
d8 system module enable/disable:enableon an already-enabled module silently succeeds (no warning)enableafterdisablefails for experimental modules if permission flag is missing, but if it was alreadyenabled- the command still silently succeeds (which leads to users confusion)The solution
enable/disablecommands output more specific and user-friendly (suggest a way to enable experimental modules)Before
After
📦 Additional module refactoring
🏗️ Structural Changes
Before Refactoring
After Refactoring
📁 Moves and Renames
1. API Types
v1alpha1/api/v1alpha1/Why: Standard Go convention — API types are placed in an
api/directory, and deckhouse also has similar layout.2. CLI Commands →
cmd/module.gocmd/module.goenable/enable.gocmd/enable/enable.godisable/disable.gocmd/disable/disable.goapprove/approve.gocmd/approve/approve.goapplynow/applynow.gocmd/applynow/applynow.golist/list.gocmd/list/list.govalues/values.gocmd/values/values.gosnapshots/snapshots.gocmd/snapshots/snapshots.goWhy: Isolate Cobra commands from business logic. Clear separation of the presentation layer.
3. Decomposition of
operatemodule/(god package)operatemodule/)cli_completion.gocli/completion.goclicli_messages.gocli/output.goclioptionsmodule.godeckhouse/api.godeckhouseswitchmodule.gomoduleconfig/enabled_state.gomoduleconfigmodulerelease.gomodulereleases/module_release.gomodulereleasesrelease_filter.gomodulereleases/release_filter.gomodulereleasesversion.gomodulereleases/version.gomodulereleasesWhy:
operatemodulewas a "god package" — it mixed CLI logic, ModuleConfig operations, and ModuleRelease handling. Now each package is responsible for a single domain.🆕 New Files
cli/k8s_dynamic_client.goconst/k8s_operations_timeout.go✏️ Function Renames
OptionsModule()QueryAPI()deckhouseOperateModule()SetEnabledState()moduleconfigWhy:
QueryAPI— more accurate name, the function queries the internal Deckhouse API with curl inside of the pod.SetEnabledState— clearly describes what the function does: sets thespec.enabledfield in ModuleConfig.✏️ Type and Constant Renames in
moduleconfigModuleStateEnabledStateModuleEnabledEnabledModuleDisabledDisabledOperateResultStatusResultStatusOperateResultResultResultChangedChangedResultAlreadyInStateAlreadyInStateWhy: Since the package is already named
moduleconfig, prefixes likeModuleandOperateare redundant. Cleaner API:🎯 Summary of Design Principles
operatemoduleinto logical unitsapi/,cmd/structurecli— user interactionmoduleconfig— ModuleConfig logicmodulereleases— ModuleRelease logicdeckhouse— Deckhouse APImoduleconfigandmodulereleases(no underscores) to follow Go standards