Skip to content

Commit

Permalink
pass log level to KCM
Browse files Browse the repository at this point in the history
  • Loading branch information
atiratree committed Nov 30, 2022
1 parent bd97f31 commit e0fd9f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/controllers/kube-controller-manager.go
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,10 +93,12 @@ 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)},
},
}

args, err = mergeAndConvertToArgs(overrides)

applyFn = func() error {
return assets.ApplyNamespaces([]string{
"core/namespace-openshift-kube-controller-manager.yaml",
Expand Down Expand Up @@ -171,7 +174,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)))
} 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
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

0 comments on commit e0fd9f4

Please sign in to comment.