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

Add new flag --ssh-hostkey-algos #711

Merged
merged 1 commit into from
May 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ func main() {
helmCacheMaxSize int
helmCacheTTL string
helmCachePurgeInterval string
kexAlgos []string
artifactRetentionTTL time.Duration
artifactRetentionRecords int
)
Expand Down Expand Up @@ -124,8 +123,10 @@ func main() {
"The TTL of an index in the cache. Valid time units are ns, us (or µs), ms, s, m, h.")
flag.StringVar(&helmCachePurgeInterval, "helm-cache-purge-interval", "1m",
"The interval at which the cache is purged. Valid time units are ns, us (or µs), ms, s, m, h.")
flag.StringSliceVar(&kexAlgos, "ssh-kex-algos", []string{},
flag.StringSliceVar(&git.KexAlgos, "ssh-kex-algos", []string{},
Copy link
Member

Choose a reason for hiding this comment

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

Although is technically alright, I wonder if it'd be better to have all the flag vars organized in the same place. This is honestly very trivial, so if you feel like your current change is fine, it's okay by me.

Copy link
Member Author

Choose a reason for hiding this comment

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

That was the one thing I wasn't too sure about as well. The motivation for taking this approach was that both vars are not used within main.go, so I did not see much benefit for declaring them there - specially considering that in the feature we may add another one/two similar flags (i.e. --ssh-macs and --ssh-ciphers).

But I am happy to declare the vars within main.go if anyone feels strongly about it.

Copy link
Member

Choose a reason for hiding this comment

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

We really need to get these flags into docs, like we do for the Flux CLI with https://github.com/fluxcd/flux2/blob/main/cmd/flux/docgen.go

The more flags we add, the harder it gets for users to comprehend Flux global config.

"The list of key exchange algorithms to use for ssh connections, arranged from most preferred to the least.")
flag.StringSliceVar(&git.HostKeyAlgos, "ssh-hostkey-algos", []string{},
"The list of hostkey algorithms to use for ssh connections, arranged from most preferred to the least.")
flag.DurationVar(&artifactRetentionTTL, "artifact-retention-ttl", 60*time.Second,
"The duration of time that artifacts will be kept in storage before being garbage collected.")
flag.IntVar(&artifactRetentionRecords, "artifact-retention-records", 2,
Expand Down Expand Up @@ -185,7 +186,6 @@ func main() {
storageAdvAddr = determineAdvStorageAddr(storageAddr, setupLog)
}
storage := mustInitStorage(storagePath, storageAdvAddr, artifactRetentionTTL, artifactRetentionRecords, setupLog)
setPreferredKexAlgos(kexAlgos)

if err = (&controllers.GitRepositoryReconciler{
Client: mgr.GetClient(),
Expand Down Expand Up @@ -345,7 +345,3 @@ func envOrDefault(envName, defaultValue string) string {

return defaultValue
}

func setPreferredKexAlgos(algos []string) {
git.KexAlgos = algos
}