Skip to content
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

[GEN-2309] fix: config set command #2372

Merged
merged 257 commits into from
Feb 4, 2025

Conversation

alonkeyval
Copy link
Collaborator

This pull request introduces several changes to the cli/cmd/config.go file to enhance configuration management in Odigos. The changes include importing new packages, updating command arguments, and modifying the configuration update process.

Imports and Dependencies:

  • Added imports for resources, odigospro, common, and consts packages to support new functionalities.

Command Argument Handling:

  • Changed the Args for the setConfigCmd command from cobra.ExactArgs(2) to cobra.MinimumNArgs(2) to allow for multiple values.

Configuration Update Process:

  • Replaced the updateConfigProperty function with setConfigProperty to handle a broader range of configuration properties and to increment the ConfigVersion.
  • Introduced a new process to fetch the current configuration and apply changes using resources.GetCurrentConfig, resources.CreateResourceManagers, and resources.ApplyResourceManagers.
  • Added error handling for deprecated configurations and cleanup of old Odigos resources.

These changes improve the flexibility and robustness of the configuration management in Odigos.

alonkeyval and others added 30 commits July 30, 2023 14:06
…urces-card

Task 107 overview sources card
…rce-manage-list

Task 142 display source manage list
…sources-connection

Task 145 handle new sources connection
Copy link

},
}

func updateConfigProperty(ctx context.Context, client *kube.Client, ns, property, value string) error {
configMapName := "odigos-config"
func setConfigProperty(config *common.OdigosConfiguration, property string, value []string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we err in case the property expects 1 value but the value array has more than one?
instead of ignoring it

Comment on lines 34 to 37
ns, _ := cmd.Flags().GetString("namespace")
if ns == "" {
ns = "odigos-system"
ns = consts.DefaultOdigosNamespace
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

please use

ns, err := resources.GetOdigosNamespace(client, ctx)

To automatically get the namespace instead of having the user supplying it

@damemi
Copy link
Contributor

damemi commented Feb 3, 2025

@alonkeyval @blumamir do you think this could replace #2303? My intent with that was to be able to override settings like image prefix. I had also considered a new odigos subcommand, but I didn't know about the config set command already. I think what you have here is probably a better way to do it, but let me know what you think

@alonkeyval
Copy link
Collaborator Author

@damemi It sounds like we can use this command for the purposes you described as well.

@alonkeyval alonkeyval merged commit 6628afe into odigos-io:main Feb 4, 2025
45 checks 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.

4 participants