-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
94 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func newLogLevelFlag() *cli.IntFlag { | ||
return &cli.IntFlag{ | ||
Name: "log-level", Aliases: []string{"v"}, EnvVars: []string{"LOG_LEVEL"}, | ||
Usage: "number of the log level verbosity", | ||
Value: 0, | ||
} | ||
} | ||
|
||
func newLogFormatFlag() *cli.StringFlag { | ||
return &cli.StringFlag{ | ||
Name: "log-format", EnvVars: []string{"LOG_FORMAT"}, | ||
Usage: "sets the log format (values: [json, console])", | ||
Value: "console", | ||
Action: func(context *cli.Context, format string) error { | ||
if format == "console" || format == "json" { | ||
return nil | ||
} | ||
_ = cli.ShowAppHelp(context) | ||
return fmt.Errorf("unknown log format: %s", format) | ||
}, | ||
} | ||
} | ||
|
||
func newLeaderElectionEnabledFlag(dest *bool) *cli.BoolFlag { | ||
return &cli.BoolFlag{ | ||
Name: "leader-election-enabled", Value: false, EnvVars: []string{"LEADER_ELECTION_ENABLED"}, | ||
Usage: "Use leader election for the controller manager.", | ||
Destination: dest, | ||
} | ||
} | ||
|
||
func newWebhookTLSCertDirFlag(dest *string) *cli.StringFlag { | ||
return &cli.StringFlag{ | ||
Name: "webhook-tls-cert-dir", EnvVars: []string{"WEBHOOK_TLS_CERT_DIR"}, // Env var is set by Crossplane | ||
Usage: "Directory containing the certificates for the webhook server. If empty, the webhook server is not started.", | ||
Destination: dest, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.