cleanup of messages

This commit is contained in:
Dan Finneran
2025-02-05 09:24:39 +00:00
parent 81c0b4faf5
commit e1481db95c
6 changed files with 10 additions and 24 deletions

View File

@@ -34,8 +34,7 @@ var kubeKubeadmInit = &cobra.Command{
Short: "kube-vip init",
Long: "The \"init\" subcommand will generate the Kubernetes manifest that will be started by kubeadm through the kubeadm init process",
Run: func(cmd *cobra.Command, args []string) { //nolint TODO
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(logLevel))
initConfig.LoadBalancers = append(initConfig.LoadBalancers, initLoadBalancer)
// TODO - A load of text detailing what's actually happening
err := kubevip.ParseEnvironment(&initConfig)
@@ -75,8 +74,6 @@ var kubeKubeadmJoin = &cobra.Command{
Use: "join",
Short: "kube-vip join",
Run: func(cmd *cobra.Command, args []string) { //nolint TODO
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(logLevel))
initConfig.LoadBalancers = append(initConfig.LoadBalancers, initLoadBalancer)
// TODO - A load of text detailing what's actually happening

View File

@@ -49,9 +49,6 @@ var kubeManifestPod = &cobra.Command{
return
}
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(initConfig.Logging))
// The control plane has a requirement for a VIP being specified
if initConfig.EnableControlPlane && (initConfig.VIP == "" && initConfig.Address == "" && !initConfig.DDNS) {
_ = cmd.Help()
@@ -85,10 +82,6 @@ var kubeManifestDaemon = &cobra.Command{
log.Error("parsing environment", "err", err)
return
}
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(initConfig.Logging))
// The control plane has a requirement for a VIP being specified
if initConfig.EnableControlPlane && (initConfig.VIP == "" && initConfig.Address == "" && !initConfig.DDNS) {
_ = cmd.Help()
@@ -115,9 +108,7 @@ var kubeManifestRbac = &cobra.Command{
Short: "Generate an RBAC Manifest",
Run: func(cmd *cobra.Command, args []string) { //nolint TODO
var err error
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(logLevel))
initConfig.LoadBalancers = append(initConfig.LoadBalancers, initLoadBalancer)
// TODO - A load of text detailing what's actually happening
if err := kubevip.ParseEnvironment(&initConfig); err != nil {

View File

@@ -29,7 +29,7 @@ var inCluster bool
var configMap string
// Configure the level of logging
var logLevel uint32
var logLevel int32
// Provider Config
var providerConfig string
@@ -111,7 +111,7 @@ func init() {
kubeVipCmd.PersistentFlags().StringVarP(&initConfig.Namespace, "namespace", "n", "kube-system", "The namespace for the configmap defined within the cluster")
// Manage logging
kubeVipCmd.PersistentFlags().Uint32Var(&logLevel, "log", 0, "Set the level of logging")
kubeVipCmd.PersistentFlags().Int32Var(&logLevel, "log", 0, "Set the level of logging")
// Service flags
kubeVipService.Flags().StringVarP(&configMap, "configMap", "c", "plndr", "The configuration map defined within the cluster")
@@ -159,6 +159,9 @@ func init() {
kubeVipCmd.AddCommand(kubeVipSample)
kubeVipCmd.AddCommand(kubeVipService)
kubeVipCmd.AddCommand(kubeVipVersion)
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(logLevel))
}
// Execute - starts the command parsing process
@@ -191,8 +194,6 @@ var kubeVipService = &cobra.Command{
Use: "service",
Short: "Start the Virtual IP / Load balancer as a service within a Kubernetes cluster",
Run: func(cmd *cobra.Command, args []string) { //nolint TODO
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(logLevel))
// parse environment variables, these will overwrite anything loaded or flags
err := kubevip.ParseEnvironment(&initConfig)
@@ -257,9 +258,6 @@ var kubeVipManager = &cobra.Command{
}
}
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(initConfig.Logging))
// Welome messages
log.Info("kube-vip.io", "version", Release.Version, "build", Release.Build)