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

pass log level to KCM #1155

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkg/controllers/kube-controller-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"sort"
"strconv"

embedded "github.com/openshift/microshift/assets"
"github.com/openshift/microshift/pkg/assets"
Expand Down Expand Up @@ -92,6 +93,7 @@ func configure(cfg *config.MicroshiftConfig) (args []string, applyFn func() erro
"use-service-account-credentials": {"true"},
"cluster-signing-cert-file": {clusterSigningCert},
"cluster-signing-key-file": {clusterSigningKey},
"v": {strconv.Itoa(cfg.LogVLevel)},
},
}

Expand Down Expand Up @@ -171,7 +173,11 @@ func GetKubeControllerManagerArgs(config map[string]interface{}) []string {
args := []string{}
for key, value := range extendedArguments.(map[string]interface{}) {
for _, arrayValue := range value.([]interface{}) {
args = append(args, fmt.Sprintf("--%s=%s", key, arrayValue.(string)))
if len(key) == 1 {
args = append(args, fmt.Sprintf("-%s=%s", key, arrayValue.(string)))
Copy link
Contributor

Choose a reason for hiding this comment

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

This should work with double dash too.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, you are right. But for example -h doesn't, so it shouldn't hurt anything to keep this here.

Copy link
Member Author

Choose a reason for hiding this comment

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

also a minor plus for consistency is that we are using -v in KCM operator as well when generating the args.

Nevertheless, I don't have a strong preference if you want to remove this.

Copy link
Contributor

Choose a reason for hiding this comment

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

log level verbosity flag in KCM supports simple or double dash. So this sounds good to me.

} else {
args = append(args, fmt.Sprintf("--%s=%s", key, arrayValue.(string)))
}
}
}
// make sure to sort the arguments, otherwise we might get mismatch
Expand Down
1 change: 1 addition & 0 deletions pkg/controllers/kube-controller-manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func TestConfigure(t *testing.T) {
"--secure-port=10257",
fmt.Sprintf("--service-account-private-key-file=%s", kcmServiceAccountPrivateKeyFile()),
"--use-service-account-credentials=true",
"-v=0",
}

argsGot := kcm.args
Expand Down