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

Registry config command #2220

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Cortey
Copy link
Contributor

@Cortey Cortey commented Sep 26, 2024

Description

Changes proposed in this pull request:

  • Added a command to save registry config.json to a local file

Related issue(s)
#2217

@Cortey Cortey requested review from a team as code owners September 26, 2024 06:50
@kyma-bot kyma-bot added cla: yes Indicates the PR's author has signed the CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 26, 2024
@Cortey Cortey enabled auto-merge (squash) September 26, 2024 06:51
}

func runConfig(cfg *cfgConfig) clierror.Error {
registryConfig, err := registry.GetConfig(cfg.Ctx, cfg.KubeClient)
Copy link
Contributor

Choose a reason for hiding this comment

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

We can't use the registry.GetConfig func here because it returns secrets containing data used for local (in-cluster) connection, but users may expect config they can use for external connection.

}

if cfg.externalurl {
fmt.Print(registryConfig.SecretData.PushRegAddr)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest using fmt.Println, or adding \n at the end of the format because when I've specified both flags the output looks weird:

./kyma-cli alpha registry config --dockerconfig --externalurl

Docker config saved to config.jsondockerregistry.kyma-system.svc.cluster.local:5000

}

cfg.KubeClientConfig.AddFlag(cmd)
cmd.Flags().BoolVar(&cfg.dockerconfig, "dockerconfig", false, "Generate a docker config.json file for the Kyma registry")
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest removing this flag and dealing with its behavior as a default for the registry config command. Right now the registry config default is useless without passing additional flags which may be really confusing


cfg.KubeClientConfig.AddFlag(cmd)
cmd.Flags().BoolVar(&cfg.dockerconfig, "dockerconfig", false, "Generate a docker config.json file for the Kyma registry")
cmd.Flags().BoolVar(&cfg.externalurl, "externalurl", false, "External URL for the Kyma registry")
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest replacing the --externalurl flag with the --external-url one.

Also, the description is confusing because it does not describe what is causing this flag. Maybe this would be better:

Print docker registry external URL

Copy link
Contributor

Choose a reason for hiding this comment

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

In general, I don't get the goal of this flag, because it's not cooperating with the --output flag and exactly the same information will be located in the config.json after running the registry config --dockerconfig command. Maybe we should remove this flag? or move it to a command command like registry external-up? or I don't know...

But this is only a suggestion. For sure this flag should be re-designed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates the PR's author has signed the CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants