Skip to content

Commit

Permalink
k8s-keystone-auth: Remove handling for glog
Browse files Browse the repository at this point in the history
This is quite similar but not identical to the earlier removal of glog
handling in client-keystone-auth. As with that utility, we are using
pflag rather than cobra here, but unlike that utility the klog options
are not being registered.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
  • Loading branch information
stephenfin committed Sep 7, 2023
1 parent eb7417f commit c57e0ad
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions cmd/k8s-keystone-auth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ limitations under the License.
package main

import (
"flag"
"fmt"
"os"

Expand All @@ -29,32 +28,12 @@ import (
)

func main() {
// Glog requires this otherwise it complains.
err := flag.CommandLine.Parse(nil)
if err != nil {
klog.Fatalf("Unable to parse flags: %v", err)
}

var showVersion bool
pflag.BoolVar(&showVersion, "version", false, "Show current version and exit")

// This is a temporary hack to enable proper logging until upstream dependencies
// are migrated to fully utilize klog instead of glog.
klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
klog.InitFlags(klogFlags)

logs.AddFlags(pflag.CommandLine)
keystone.AddExtraFlags(pflag.CommandLine)

// Sync the glog and klog flags.
flag.CommandLine.VisitAll(func(f1 *flag.Flag) {
f2 := klogFlags.Lookup(f1.Name)
if f2 != nil {
value := f1.Value.String()
_ = f2.Value.Set(value)
}
})

logs.InitLogs()
defer logs.FlushLogs()

Expand Down

0 comments on commit c57e0ad

Please sign in to comment.